Koshceyshka

Untitled

Dec 13th, 2020
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. namespace university\core\base;
  5.  
  6.  
  7. /**
  8. * Base coontroller
  9. */
  10. abstract class Controller{
  11.  
  12.  
  13.     /**
  14.     * Current route
  15.     * @var array
  16.     */
  17.     public $route = [];
  18.    
  19.     /**
  20.     * View for controller
  21.     * @var array
  22.     */
  23.     public $view;
  24.  
  25.     /**
  26.     * Layout for View
  27.     * @var array
  28.     */
  29.     public $layout;
  30.  
  31.  
  32.     /**
  33.     * Users data
  34.     * @var array
  35.     */
  36.     public $vars = [];
  37.  
  38.  
  39.     public function __construct($route){
  40.         $this->route = $route;
  41.         $this->view = $route['action'];
  42.     }
  43.  
  44.     /**
  45.     * Render of View
  46.     * @return array
  47.     */
  48.     public function getView(){
  49.         $vObj = new View($this->route, $this->layout, $this->view);
  50.         $vObj->render($this->vars);
  51.     }
  52.  
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment