Example #1
0
 private function getPartialPath($partial)
 {
     $path = [];
     $partial = ltrim($partial, '/') . '.html.php';
     if (!strpos($partial, '/')) {
         Hash::set($path, 'dir', strtolower(get_class($this)));
         Hash::set($path, 'file', $partial);
     } else {
         $tmp = explode('/', $partial);
         Hash::set($path, 'file', array_pop($tmp));
         Hash::set($path, 'dir', join($tmp));
     }
     return $path;
 }
Example #2
0
 /**
  * Controller handler by request params.
  *
  * @param array $url Request string (URI)
  * @throws Exception
  * @return void
  */
 private function applyController($url)
 {
     $this->controller = Hash::shift($url);
     if (is_null($this->controller)) {
         $this->controller = $this->routes->get('root.resource');
     }
     $controller_path = $this->controllersPath() . $this->controller . '.php';
     try {
         if (file_exists($controller_path)) {
             require_once $controller_path;
             $this->controller = new $this->controller($this);
             $this->action = empty($url[0]) ? $this->routes->get('root.action') : Hash::shift($url);
             $this->applyControllerAction($url);
         } else {
             throw new RequireFileException('controller', $this->controller, $this->controllersPath());
         }
     } catch (RequireFileException $e) {
         die($e);
     }
 }
Example #3
0
 public function set(array $item, $value)
 {
     Hash::set($this->items, $item, $value);
 }