public setHandler ( object | callback $handler ) : |
||
$handler | object | callback | The command handler or the callable creating a new command handler on demand. |
return | The current instance. |
public function setHandler($handler)
{
if (!is_object($handler) && !is_callable($handler)) {
throw new InvalidArgumentException(sprintf('Expected an object or a callable. Got: %s', is_object($handler) ? get_class($handler) : gettype($handler)));
}
$this->handler = $handler;
return $this;
}
/** * @expectedException \InvalidArgumentException */ public function testSetHandlerFailsIfNeitherObjectNorCallable() { $this->config->setHandler(1234); }