Skip to content

Instantly share code, notes, and snippets.

@fivestar
Created October 1, 2013 06:40
Show Gist options
  • Save fivestar/6774649 to your computer and use it in GitHub Desktop.
Save fivestar/6774649 to your computer and use it in GitHub Desktop.
<?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