public function setListener($listener = null)
    {
        if (null !== $listener && !is_object($listener) && !is_string($listener)) {
            throw new \InvalidArgumentException(sprintf(
                'Workflow state listener must be type of null, object or string, %s given.',
                gettype($listener)
            ));
        }

        if (null !== $listener && !is_subclass_of($listener, 'BackBee\Workflow\ListenerInterface')) {
            throw new \LogicException(sprintf(
                'Workflow state listener must implement %s.',
                'BackBee\Workflow\ListenerInterface'
            ));
        }

        $this->_listener = is_object($listener) ? get_class($listener) : $listener;
        $this->listenerInstance = null;

        return $this;
    }
public function setListener($listener = null)
    {
        if (null !== $listener && !is_object($listener) && !is_string($listener)) {
            throw new \InvalidArgumentException(sprintf(
                'Workflow state listener must be type of null, object or string, %s given.',
                gettype($listener)
            ));
        }

        if (null !== $listener && !is_subclass_of($listener, 'BackBee\Workflow\ListenerInterface')) {
            throw new \LogicException(sprintf(
                'Workflow state listener must implement %s.',
                'BackBee\Workflow\ListenerInterface'
            ));
        }

        $this->_listener = is_object($listener) ? get_class($listener) : $listener;
        $this->listenerInstance = null;

        return $this;
    }
public function setListener ( $ listener = null ) { if ( null !== $ listener && ! is_object ( $ listener ) && ! is_string ( $ listener ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Workflow state listener must be type of null, object or string, %s given.' , gettype ( $ listener ) ) ) ; } if ( null !== $ listener && ! is_subclass_of ( $ listener , 'BackBee\Workflow\ListenerInterface' ) ) { throw new \ LogicException ( sprintf ( 'Workflow state listener must implement %s.' , 'BackBee\Workflow\ListenerInterface' ) ) ; } $ this -> _listener = is_object ( $ listener ) ? get_class ( $ listener ) : $ listener ; $ this -> listenerInstance = null ; return $ this ; }
Sets the optional listener classname.

@param mixed $listener The listener; it must implement BackBee\Workflow\ListenerInterface
@return self
@throws \InvalidArgumentException if provided listener is not type of null, object or string
@throws \LogicException if provided listener does not implement BackBee\Workflow\ListenerInterface
Sets the optional listener classname .