public function triggerProtocol(string $protocol, ...$args)
    {
        list($protocol, $name) = explode('://', $protocol, 2);

        //if it's not a registered protocol
        if (!isset($this->protocols[$protocol])) {
            //oops?
            return $this;
        }

        //get the protocol
        $protocol = $this->protocols[$protocol];

        //we should deal with strings
        //then callables respectively
        //to allow overriding

        //they can call a class
        if (is_string($protocol) && strpos($protocol, '@') !== false) {
            return $this->triggerController($protocol, $name, ...$args);
        }

        //late binding ?
        if ($protocol instanceof Closure) {
            $protocol = $this->bindCallback($protocol);
        }

        if (is_callable($protocol)) {
            //call the protocol
            call_user_func($protocol, $name, ...$args);
        }

        //we can only deal with callable and strings
        //we don't want to throw an error
        //because it could just be a pseudo
        //placeholder
        return $this;
    }
public function triggerProtocol(string $protocol, ...$args)
    {
        list($protocol, $name) = explode('://', $protocol, 2);

        //if it's not a registered protocol
        if (!isset($this->protocols[$protocol])) {
            //oops?
            return $this;
        }

        //get the protocol
        $protocol = $this->protocols[$protocol];

        //we should deal with strings
        //then callables respectively
        //to allow overriding

        //they can call a class
        if (is_string($protocol) && strpos($protocol, '@') !== false) {
            return $this->triggerController($protocol, $name, ...$args);
        }

        //late binding ?
        if ($protocol instanceof Closure) {
            $protocol = $this->bindCallback($protocol);
        }

        if (is_callable($protocol)) {
            //call the protocol
            call_user_func($protocol, $name, ...$args);
        }

        //we can only deal with callable and strings
        //we don't want to throw an error
        //because it could just be a pseudo
        //placeholder
        return $this;
    }
public function triggerProtocol ( string $ protocol , ... $ args ) { list ( $ protocol , $ name ) = explode ( '://' , $ protocol , 2 ) ; //if it's not a registered protocol if ( ! isset ( $ this -> protocols [ $ protocol ] ) ) { //oops? return $ this ; } //get the protocol $ protocol = $ this -> protocols [ $ protocol ] ; //we should deal with strings //then callables respectively //to allow overriding //they can call a class if ( is_string ( $ protocol ) && strpos ( $ protocol , '@' ) !== false ) { return $ this -> triggerController ( $ protocol , $ name , ... $ args ) ; } //late binding ? if ( $ protocol instanceof Closure ) { $ protocol = $ this -> bindCallback ( $ protocol ) ; } if ( is_callable ( $ protocol ) ) { //call the protocol call_user_func ( $ protocol , $ name , ... $ args ) ; } //we can only deal with callable and strings //we don't want to throw an error //because it could just be a pseudo //placeholder return $ this ; }
Calls a protocol

@param *string $protocol In the form of protocol://event
@param mixed   ...$args

@return Base
Calls a protocol