public function attach($event, Closure $listener)
    {
        if (!is_callable($listener)) {
            throw new InvalidArgumentException(sprintf(
                'Second argument must be callable not "%s"', gettype($listener)
            ));
        }

        if (!is_string($event)) {
            throw new InvalidArgumentException(sprintf(
                'First argument must be string, got "%s"', gettype($event)
            ));
        }

        $this->listeners[$event] = $listener;
        return $this;
    }
public function attach($event, Closure $listener)
    {
        if (!is_callable($listener)) {
            throw new InvalidArgumentException(sprintf(
                'Second argument must be callable not "%s"', gettype($listener)
            ));
        }

        if (!is_string($event)) {
            throw new InvalidArgumentException(sprintf(
                'First argument must be string, got "%s"', gettype($event)
            ));
        }

        $this->listeners[$event] = $listener;
        return $this;
    }
public function attach ( $ event , Closure $ listener ) { if ( ! is_callable ( $ listener ) ) { throw new InvalidArgumentException ( sprintf ( 'Second argument must be callable not "%s"' , gettype ( $ listener ) ) ) ; } if ( ! is_string ( $ event ) ) { throw new InvalidArgumentException ( sprintf ( 'First argument must be string, got "%s"' , gettype ( $ event ) ) ) ; } $ this -> listeners [ $ event ] = $ listener ; return $ this ; }
Attaches a new event

@param string $event Event name
@param \Closure $listener
@throws \InvalidArgumentException If either listener isn't callable or event name's isn't a string
@return \Krystal\Event\EventManager
Attaches a new event