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;
    }
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;
    }
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 ; }
Sets the command handler to execute when a command is run.

You can pass:

* An object with handler methods.
* A callable that receives a {@link Command} and returns an object with
handler methods.

The name of the executed handler method can be configured with
{@link setHandlerMethod()}. By default, the method `handle()` is
executed.

@param object|callback $handler The command handler or the callable
creating a new command handler on demand.

@return ApplicationConfig|CommandConfig|SubCommandConfig|OptionCommandConfig The current instance.

@see getHandler()
Sets the command handler to execute when a command is run .