public function executeCallback($cb, array $args = [], $filter = false)
    {
        if ($cb instanceof Closure) {
            return call_user_func_array($cb, $args);
        }

        if (is_string($cb) && strpos($cb, "@") !== false) {
            $cb = explode('@', $cb);
        }

        if (is_array($cb) && count($cb) == 2) {
            if (!is_object($cb[0])) {
                $cb = $this->resolveCallback($cb);
            }

            if (isset($cb[0], $cb[1]) && is_object($cb[0]) && !method_exists($cb[0], $cb[1])) {
                $name = get_class($cb[0]);
                throw new ControllerNotFoundException("Controller '{$name}->{$cb[1]}' not found");
            }

            return call_user_func_array($cb, $args);
        }

        if (is_string($cb) && strpos($cb, "::") !== false) {
            return call_user_func_array($cb, $args);
        }

        throw new Exception('Invalid callback');
    }
public function executeCallback($cb, array $args = [], $filter = false)
    {
        if ($cb instanceof Closure) {
            return call_user_func_array($cb, $args);
        }

        if (is_string($cb) && strpos($cb, "@") !== false) {
            $cb = explode('@', $cb);
        }

        if (is_array($cb) && count($cb) == 2) {
            if (!is_object($cb[0])) {
                $cb = $this->resolveCallback($cb);
            }

            if (isset($cb[0], $cb[1]) && is_object($cb[0]) && !method_exists($cb[0], $cb[1])) {
                $name = get_class($cb[0]);
                throw new ControllerNotFoundException("Controller '{$name}->{$cb[1]}' not found");
            }

            return call_user_func_array($cb, $args);
        }

        if (is_string($cb) && strpos($cb, "::") !== false) {
            return call_user_func_array($cb, $args);
        }

        throw new Exception('Invalid callback');
    }
public function executeCallback ( $ cb , array $ args = [ ] , $ filter = false ) { if ( $ cb instanceof Closure ) { return call_user_func_array ( $ cb , $ args ) ; } if ( is_string ( $ cb ) && strpos ( $ cb , "@" ) !== false ) { $ cb = explode ( '@' , $ cb ) ; } if ( is_array ( $ cb ) && count ( $ cb ) == 2 ) { if ( ! is_object ( $ cb [ 0 ] ) ) { $ cb = $ this -> resolveCallback ( $ cb ) ; } if ( isset ( $ cb [ 0 ] , $ cb [ 1 ] ) && is_object ( $ cb [ 0 ] ) && ! method_exists ( $ cb [ 0 ] , $ cb [ 1 ] ) ) { $ name = get_class ( $ cb [ 0 ] ) ; throw new ControllerNotFoundException ( "Controller '{$name}->{$cb[1]}' not found" ) ; } return call_user_func_array ( $ cb , $ args ) ; } if ( is_string ( $ cb ) && strpos ( $ cb , "::" ) !== false ) { return call_user_func_array ( $ cb , $ args ) ; } throw new Exception ( 'Invalid callback' ) ; }
Execute a callback

@param  mixed   $cb
@param  array   $args
@param  boolean $filter Set if the callback is a filter or not

@return mixed

@throws Exception If the filter is unknown
@throws Exception If the callback isn't in one of the accepted formats
Execute a callback