function __construct(Config $conf = null, $debug = false) { $this->config = $conf; if ($conf instanceof Config) { $this->output = $conf->getOutput(); $this->url = $conf->getUrl(); } else { $this->output = 'json'; } $this->debug = $debug; }
public function __construct(array $set = array(), Config $conf = null) { if ($conf) { //set defaults $this->output = $conf->getOutput(); $this->mode = $conf->getMode(); } foreach ($set as $k => $v) { //allow overrides $k = 'set' . ucfirst($k); if (method_exists($this, $k)) { $this->{$k}($v); } } }