public function distribute($return = false)
    {
        $this->processSessionValues();

        try {
            $routing = $this->request
                ->parseWDBRequest()
                ->getWDBRouting();
        } catch (NotFoundException $e) {
            throw $e;
        }

        $this->processQueryArguments();

        $input_file = $this->getInputFile();
        if (empty($input_file)) {
            $input_path = $this->getInputPath();
            if (!empty($input_path)) {
                $input_file = Kernel::getPath('web').trim($input_path, '/');
            }
        }
        $result = null;
        if (!empty($routing)) {
            $ctrl_cls   = $routing['controller_classname'];
            /* @var \WebDocBook\Abstracts\AbstractController $ctrl_obj */
            $ctrl_obj   = new $ctrl_cls();
            $this->setController($ctrl_obj);
            $result     = Helper::fetchArguments(
                $this->getController(), $routing['action'], array('path'=>$input_file)
            );
        }
        if (empty($result) || !is_array($result) || (count($result)!=2 && count($result)!=3)) {
            $str        = gettype($result);
            if (is_array($result)) {
                $str    .= ' length '.count($result);
            }
            throw new RuntimeException(
                sprintf('A controller action must return a two or three entries array like [ template file , content (, params) ]! Received %s from class "%s::%s()".',
                $str, $routing['controller_classname'], $routing['action'])
            );
        } else {
            $template   = $result[0];
            $content    = $result[1];
            $params     = isset($result[2]) ? $result[2] : array();
        }

        // debug if so
        if (!empty($_GET) && isset($_GET['debug'])) {
            Kernel::debug($this);
        }

        $this->display($content, $template, $params, true);
    }
public function distribute($return = false)
    {
        $this->processSessionValues();

        try {
            $routing = $this->request
                ->parseWDBRequest()
                ->getWDBRouting();
        } catch (NotFoundException $e) {
            throw $e;
        }

        $this->processQueryArguments();

        $input_file = $this->getInputFile();
        if (empty($input_file)) {
            $input_path = $this->getInputPath();
            if (!empty($input_path)) {
                $input_file = Kernel::getPath('web').trim($input_path, '/');
            }
        }
        $result = null;
        if (!empty($routing)) {
            $ctrl_cls   = $routing['controller_classname'];
            /* @var \WebDocBook\Abstracts\AbstractController $ctrl_obj */
            $ctrl_obj   = new $ctrl_cls();
            $this->setController($ctrl_obj);
            $result     = Helper::fetchArguments(
                $this->getController(), $routing['action'], array('path'=>$input_file)
            );
        }
        if (empty($result) || !is_array($result) || (count($result)!=2 && count($result)!=3)) {
            $str        = gettype($result);
            if (is_array($result)) {
                $str    .= ' length '.count($result);
            }
            throw new RuntimeException(
                sprintf('A controller action must return a two or three entries array like [ template file , content (, params) ]! Received %s from class "%s::%s()".',
                $str, $routing['controller_classname'], $routing['action'])
            );
        } else {
            $template   = $result[0];
            $content    = $result[1];
            $params     = isset($result[2]) ? $result[2] : array();
        }

        // debug if so
        if (!empty($_GET) && isset($_GET['debug'])) {
            Kernel::debug($this);
        }

        $this->display($content, $template, $params, true);
    }
public function distribute ( $ return = false ) { $ this -> processSessionValues ( ) ; try { $ routing = $ this -> request -> parseWDBRequest ( ) -> getWDBRouting ( ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ this -> processQueryArguments ( ) ; $ input_file = $ this -> getInputFile ( ) ; if ( empty ( $ input_file ) ) { $ input_path = $ this -> getInputPath ( ) ; if ( ! empty ( $ input_path ) ) { $ input_file = Kernel :: getPath ( 'web' ) . trim ( $ input_path , '/' ) ; } } $ result = null ; if ( ! empty ( $ routing ) ) { $ ctrl_cls = $ routing [ 'controller_classname' ] ; /* @var \WebDocBook\Abstracts\AbstractController $ctrl_obj */ $ ctrl_obj = new $ ctrl_cls ( ) ; $ this -> setController ( $ ctrl_obj ) ; $ result = Helper :: fetchArguments ( $ this -> getController ( ) , $ routing [ 'action' ] , array ( 'path' => $ input_file ) ) ; } if ( empty ( $ result ) || ! is_array ( $ result ) || ( count ( $ result ) != 2 && count ( $ result ) != 3 ) ) { $ str = gettype ( $ result ) ; if ( is_array ( $ result ) ) { $ str .= ' length ' . count ( $ result ) ; } throw new RuntimeException ( sprintf ( 'A controller action must return a two or three entries array like [ template file , content (, params) ]! Received %s from class "%s::%s()".' , $ str , $ routing [ 'controller_classname' ] , $ routing [ 'action' ] ) ) ; } else { $ template = $ result [ 0 ] ; $ content = $ result [ 1 ] ; $ params = isset ( $ result [ 2 ] ) ? $ result [ 2 ] : array ( ) ; } // debug if so if ( ! empty ( $ _GET ) && isset ( $ _GET [ 'debug' ] ) ) { Kernel :: debug ( $ this ) ; } $ this -> display ( $ content , $ template , $ params , true ) ; }
This will distribute the request and return the response

@param bool $return
@throws \WebDocBook\Exception\NotFoundException
@throws \WebDocBook\Exception\RuntimeException if the controller action does not return a valid array
@return void
This will distribute the request and return the response