protected function ensureListener($listener)
    {
        if ($listener instanceof ListenerInterface) {
            return $listener;
        }

        if (is_callable($listener)) {
            return CallbackListener::fromCallable($listener);
        }

        throw new InvalidArgumentException('Listeners should be be ListenerInterface, Closure or callable. Received type: '.gettype($listener));
    }
protected function ensureListener($listener)
    {
        if ($listener instanceof ListenerInterface) {
            return $listener;
        }

        if (is_callable($listener)) {
            return CallbackListener::fromCallable($listener);
        }

        throw new InvalidArgumentException('Listeners should be be ListenerInterface, Closure or callable. Received type: '.gettype($listener));
    }
protected function ensureListener ( $ listener ) { if ( $ listener instanceof ListenerInterface ) { return $ listener ; } if ( is_callable ( $ listener ) ) { return CallbackListener :: fromCallable ( $ listener ) ; } throw new InvalidArgumentException ( 'Listeners should be be ListenerInterface, Closure or callable. Received type: ' . gettype ( $ listener ) ) ; }
Ensure the input is a listener.

@param ListenerInterface|callable $listener

@throws InvalidArgumentException

@return ListenerInterface
Ensure the input is a listener .