phpdoc-cache-file_cf4a09d8df611b16cc2429d5ad48d47d.dat

1 lines ASCII Unix (LF)
1
O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:"*hash";s:32:"6505949843229e7e04805ea46ef470a7";s:7:"*path";s:19:"View/CViewBasic.php";s:9:"*source";s:2194:"<?php

namespace Anax\View;

/**
 * A view connected to a template file.
 *
 */
class CViewBasic implements \Anax\DI\IInjectionAware
{
    use \Anax\DI\TInjectable;



    /**
    * Properties
    *
    */
    private $template;          // Template file or array 
    private $templateData = []; // Data to send to template file
    private $sortOrder;         // For sorting views
    private $type;              // Type of view



    /**
     * Set values for the view.
     *
     * @param string/array $template the template file, or array 
     * @param array        $data     variables to make available to the view, default is empty
     * @param int          $sort     which order to display the views, if suitable
     * @param string       $type     which type of view
     *
     * @return $this
     */
    public function set($template, $data = [], $sort = 0, $type = 'file') 
    {
        $this->template     = $template;
        $this->templateData = $data;
        $this->sortOrder    = $sort;
        $this->type         = $type;
    }



    /**
     * Render the view.
     *
     * @return void
     */
    public function render() 
    {
        switch ($this->type) {

            case 'file':

                if (!is_readable($this->template)) {
                    throw new \Exception("Could not find template file: " . $this->template);
                }

                extract($this->templateData);
                include $this->template;

                break;

            case 'callback':
    
                if (!isset($this->template['callback']) || !is_callable($this->template['callback'])) {
                    throw new \Exception("View missing callback.");
                }

                echo call_user_func($this->template['callback']);

                break;

            case 'string':

                echo $this->template;

                break;

            default:
                throw new \Exception("Not a valid template type: " . $this->type);
        }
    }



    /**
     * Give the sort order for this view.
     *
     * @return int
     */
    public function sortOrder() 
    {   
        return $this->sortOrder;
    }
}";s:19:"*namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:11:"*includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:41:"phpDocumentor\Reflection\IncludeReflector":3:{s:7:"*node";O:27:"PHPParser_Node_Expr_Include":2:{s:11:"*subNodes";a:2:{s:4:"expr";O:33:"PHPParser_Node_Expr_PropertyFetch":2:{s:11:"*subNodes";a:2:{s:3:"var";O:28:"PHPParser_Node_Expr_Variable":2:{s:11:"*subNodes";a:1:{s:4:"name";s:4:"this";}s:13:"*attributes";a:2:{s:9:"startLine";i:62;s:7:"endLine";i:62;}}s:4:"name";s:8:"template";}s:13:"*attributes";a:2:{s:9:"startLine";i:62;s:7:"endLine";i:62;}}s:4:"type";i:1;}s:13:"*attributes";a:2:{s:9:"startLine";i:62;s:7:"endLine";i:62;}}s:23:"*default_package_name";s:0:"";s:10:"*context";O:41:"phpDocumentor\Reflection\DocBlock\Context":3:{s:12:"*namespace";s:9:"Anax\View";s:20:"*namespace_aliases";a:0:{}s:7:"*lsen";s:0:"";}}}}s:12:"*constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:12:"*functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:10:"*classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:21:"\Anax\View\CViewBasic";O:40:"phpDocumentor\Descriptor\ClassDescriptor":19:{s:9:"*parent";s:0:"";s:13:"*implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:24:"\Anax\DI\IInjectionAware";s:24:"\Anax\DI\IInjectionAware";}}s:11:"*abstract";b:0;s:8:"*final";b:0;s:12:"*constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:13:"*properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:4:{s:8:"template";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:"*parent";r:39;s:8:"*types";N;s:10:"*default";N;s:9:"*static";b:0;s:13:"*visibility";s:7:"private";s:8:"*fqsen";s:31:"\Anax\View\CViewBasic::template";s:7:"*name";s:8:"template";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:10:"Properties";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:19;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:12:"templateData";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:"*parent";r:39;s:8:"*types";N;s:10:"*default";s:7:"array()";s:9:"*static";b:0;s:13:"*visibility";s:7:"private";s:8:"*fqsen";s:35:"\Anax\View\CViewBasic::templateData";s:7:"*name";s:12:"templateData";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:20;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:"*severity";s:5:"error";s:7:"*code";s:13:"PPC:ERR-50007";s:7:"*line";i:20;s:10:"*context";a:1:{i:0;s:13:"$templateData";}}}}s:19:"*inheritedElement";N;}s:9:"sortOrder";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:"*parent";r:39;s:8:"*types";N;s:10:"*default";N;s:9:"*static";b:0;s:13:"*visibility";s:7:"private";s:8:"*fqsen";s:32:"\Anax\View\CViewBasic::sortOrder";s:7:"*name";s:9:"sortOrder";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:21;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:"*severity";s:5:"error";s:7:"*code";s:13:"PPC:ERR-50007";s:7:"*line";i:21;s:10:"*context";a:1:{i:0;s:10:"$sortOrder";}}}}s:19:"*inheritedElement";N;}s:4:"type";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:"*parent";r:39;s:8:"*types";N;s:10:"*default";N;s:9:"*static";b:0;s:13:"*visibility";s:7:"private";s:8:"*fqsen";s:27:"\Anax\View\CViewBasic::type";s:7:"*name";s:4:"type";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:22;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:"*severity";s:5:"error";s:7:"*code";s:13:"PPC:ERR-50007";s:7:"*line";i:22;s:10:"*context";a:1:{i:0;s:5:"$type";}}}}s:19:"*inheritedElement";N;}}}s:10:"*methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:3:{s:3:"set";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:39;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:6:"public";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:4:{s:9:"$template";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:23:"\Anax\View\string/array";}}}s:10:"*default";N;s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:9:"$template";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:27:"the template file, or array";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:5:"$data";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:5:"array";}}}s:10:"*default";s:7:"array()";s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:5:"$data";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:57:"variables to make available to the view, default is empty";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:5:"$sort";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:47:"phpDocumentor\Descriptor\Type\IntegerDescriptor":0:{}}}s:10:"*default";s:1:"0";s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:5:"$sort";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:45:"which order to display the views, if suitable";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:5:"$type";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:"*default";s:6:"'file'";s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:5:"$type";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:18:"which type of view";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:8:"*fqsen";s:28:"\Anax\View\CViewBasic::set()";s:7:"*name";s:3:"set";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:24:"Set values for the view.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:36;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:4:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:9:"$template";s:8:"*types";r:163;s:7:"*name";s:5:"param";s:14:"*description";s:27:"the template file, or array";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}i:1;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:5:"$data";s:8:"*types";r:184;s:7:"*name";s:5:"param";s:14:"*description";s:57:"variables to make available to the view, default is empty";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}i:2;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:5:"$sort";s:8:"*types";r:205;s:7:"*name";s:5:"param";s:14:"*description";s:45:"which order to display the views, if suitable";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}i:3;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:5:"$type";s:8:"*types";r:225;s:7:"*name";s:5:"param";s:14:"*description";s:18:"which type of view";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:5:"$this";}}}s:7:"*name";s:6:"return";s:14:"*description";s:0:"";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:6:"render";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:39;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:6:"public";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:8:"*fqsen";s:31:"\Anax\View\CViewBasic::render()";s:7:"*name";s:6:"render";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:16:"Render the view.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:51;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:4:"void";}}}s:7:"*name";s:6:"return";s:14:"*description";s:0:"";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:9:"sortOrder";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:39;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:6:"public";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:8:"*fqsen";s:34:"\Anax\View\CViewBasic::sortOrder()";s:7:"*name";s:9:"sortOrder";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:34:"Give the sort order for this view.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:94;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:47:"phpDocumentor\Descriptor\Type\IntegerDescriptor":0:{}}}s:7:"*name";s:6:"return";s:14:"*description";s:0:"";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:13:"*usedTraits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;s:20:"\Anax\DI\TInjectable";}}s:8:"*fqsen";s:21:"\Anax\View\CViewBasic";s:7:"*name";s:10:"CViewBasic";s:12:"*namespace";s:10:"\Anax\View";s:10:"*package";s:0:"";s:10:"*summary";s:36:"A view connected to a template file.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";r:1;s:7:"*line";i:9;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:"*name";s:7:"package";s:14:"*description";s:7:"Default";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:13:"*interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:10:"*markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:4:{i:0;a:3:{s:4:"type";s:0:"";s:7:"message";s:23:"Template file or array ";s:4:"line";i:19;}i:1;a:3:{s:4:"type";s:0:"";s:7:"message";s:29:"Data to send to template file";s:4:"line";i:20;}i:2;a:3:{s:4:"type";s:0:"";s:7:"message";s:17:"For sorting views";s:4:"line";i:21;}i:3;a:3:{s:4:"type";s:0:"";s:7:"message";s:12:"Type of view";s:4:"line";i:22;}}}s:8:"*fqsen";s:0:"";s:7:"*name";s:14:"CViewBasic.php";s:12:"*namespace";N;s:10:"*package";s:7:"Default";s:10:"*summary";s:0:"";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:7:"package";r:378;s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:"*severity";s:5:"error";s:7:"*code";s:13:"PPC:ERR-50000";s:7:"*line";i:0;s:10:"*context";a:2:{s:11:"{{ value }}";s:2:"""";i:0;s:0:"";}}}}s:19:"*inheritedElement";N;}