public function addCallback(string $name, $callback)
    {
        if (!is_object($callback)) {
            throw new \InvalidArgumentException('Given callback must be an object');
        }

        $this->callbacks[$name] = $callback;
    }
public function addCallback(string $name, $callback)
    {
        if (!is_object($callback)) {
            throw new \InvalidArgumentException('Given callback must be an object');
        }

        $this->callbacks[$name] = $callback;
    }
public function addCallback ( string $ name , $ callback ) { if ( ! is_object ( $ callback ) ) { throw new \ InvalidArgumentException ( 'Given callback must be an object' ) ; } $ this -> callbacks [ $ name ] = $ callback ; }
register a new instance as callback

@param   string  $name      name to register the callback under
@param   object  $callback
@throws  \InvalidArgumentException
register a new instance as callback