public function executeHandler($handler, $params, $prevOutput = null)
    {
        // a function(-ish) thing which can be called
        if (is_callable($handler)) {
            return $handler($this, $params, $prevOutput);
        }

        // aliased handler
        if ($actualHandler = @$this->handlerAlias[$handler]) {
            return $this->executeHandler($actualHandler, $params, $prevOutput);
        }

        // only callable and controller/method pair (`:` seprated string) can be accepted
        if (!is_string($handler)) {
            $type = gettype($handler);
            throw new \Exception("'{$type}' can not be used as handler, should be a callable or controller/method pair!");
        }

        if (false === $pos = strpos($handler, ':')) {
            throw new \Exception("Can not parse '{$handler}' for corresponding controller/method!");
        }

        // controller/method pair
        list($class, $method) = explode(':', $handler, 2);
        $class = $this->handlerClassPrefix ? "{$this->handlerClassPrefix}{$class}" : $class;
        $controller = new $class;
        return $controller->$method($this, $params, $prevOutput);
    }
public function executeHandler($handler, $params, $prevOutput = null)
    {
        // a function(-ish) thing which can be called
        if (is_callable($handler)) {
            return $handler($this, $params, $prevOutput);
        }

        // aliased handler
        if ($actualHandler = @$this->handlerAlias[$handler]) {
            return $this->executeHandler($actualHandler, $params, $prevOutput);
        }

        // only callable and controller/method pair (`:` seprated string) can be accepted
        if (!is_string($handler)) {
            $type = gettype($handler);
            throw new \Exception("'{$type}' can not be used as handler, should be a callable or controller/method pair!");
        }

        if (false === $pos = strpos($handler, ':')) {
            throw new \Exception("Can not parse '{$handler}' for corresponding controller/method!");
        }

        // controller/method pair
        list($class, $method) = explode(':', $handler, 2);
        $class = $this->handlerClassPrefix ? "{$this->handlerClassPrefix}{$class}" : $class;
        $controller = new $class;
        return $controller->$method($this, $params, $prevOutput);
    }
public function executeHandler ( $ handler , $ params , $ prevOutput = null ) { // a function(-ish) thing which can be called if ( is_callable ( $ handler ) ) { return $ handler ( $ this , $ params , $ prevOutput ) ; } // aliased handler if ( $ actualHandler = @ $ this -> handlerAlias [ $ handler ] ) { return $ this -> executeHandler ( $ actualHandler , $ params , $ prevOutput ) ; } // only callable and controller/method pair (`:` seprated string) can be accepted if ( ! is_string ( $ handler ) ) { $ type = gettype ( $ handler ) ; throw new \ Exception ( "'{$type}' can not be used as handler, should be a callable or controller/method pair!" ) ; } if ( false === $ pos = strpos ( $ handler , ':' ) ) { throw new \ Exception ( "Can not parse '{$handler}' for corresponding controller/method!" ) ; } // controller/method pair list ( $ class , $ method ) = explode ( ':' , $ handler , 2 ) ; $ class = $ this -> handlerClassPrefix ? "{$this->handlerClassPrefix}{$class}" : $ class ; $ controller = new $ class ; return $ controller -> $ method ( $ this , $ params , $ prevOutput ) ; }
Parse and execute request handler
Parse and execute request handler