Created
October 1, 2013 06:40
-
-
Save fivestar/6774649 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface AccessorInterface | |
{ | |
function setClient(WebPay $client); | |
} | |
class WebPay | |
{ | |
protected $accessors = []; | |
public function __construct() | |
{ | |
// ... | |
// register default accessors | |
$this->registerAccessor('charges', new Charges()); | |
$this->registerAccessor('customers', new Customers()); | |
$this->registerAccessor('events', new Events()); | |
$this->registerAccessor('tokens', new Tokens()); | |
$this->registerAccessor('account', new Account()); | |
} | |
public function registerAccessor($name, AccessorInterface $accessor) | |
{ | |
$accessor->setClient($this); | |
$this->accessors[$name] = $accessor; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment