Ejemplo n.º 1
0
 public function printTrace()
 {
     $header = Html::tag('div', $this->exception . ' at ' . Hash::get($_SERVER, 'REQUEST_URI'), ['class' => 'head message']);
     $message = Html::tag('h2', "Record not found.", ['class' => 'message']);
     $debug = Html::tag('div', $this->fullCallerString, ['class' => 'debug']);
     echo Html::tag('div', $header . $message . $debug, ['class' => 'exception']);
 }
Ejemplo n.º 2
0
 public function printTrace()
 {
     $header = Html::tag('div', $this->exception . ' at ' . Hash::get($_SERVER, 'REQUEST_URI'), ['class' => 'head message']);
     $message = Html::tag('h2', "'{$this->calledWithArgs}' not a valid argument for '{$this->methodWhoCall}'", ['class' => 'message']);
     $debug = Html::tag('div', $this->fullCallerString, ['class' => 'debug']);
     echo Html::tag('div', $header . $message . $debug, ['class' => 'exception']);
 }
Ejemplo n.º 3
0
 public function render($partial, $variables = [])
 {
     try {
         if (is_array($variables)) {
             foreach ($variables as $variable => $value) {
                 ${$variable} = $value;
             }
             unset($variables);
         } else {
             throw new ArgumentError();
         }
         $partialSubPath = $this->getPartialPath($partial);
         $partialPath = $this->viewsPath . Hash::get($partialSubPath, 'dir') . DIRECTORY_SEPARATOR . Hash::get($partialSubPath, 'file');
         if (file_exists($partialPath)) {
             ob_start();
             require_once $partialPath;
             return $content = ob_get_clean();
         } else {
             throw new RequireFileException($partialPath);
         }
     } catch (ArgumentError $e) {
         die($e->printTrace());
     } catch (RequireFileException $e) {
         die($e->printTrace());
     }
 }
Ejemplo n.º 4
0
 public function __construct($code = 0, Exception $previous = null)
 {
     parent::__construct($code, $previous);
     $callers = Hash::get($this->getTrace(), 0);
     $caller = Hash::get($this->getTrace(), 1);
     $this->fullCallerString = Hash::get($caller, 'class') . Hash::get($caller, 'type') . Hash::get($caller, 'function') . '() with arguments: \'' . implode(', ', Hash::get($caller, 'args')) . '\' at line: ' . Hash::get($caller, 'line');
     $this->controllerCallLine = Hash::get($callers, 'line');
     $this->methodWhoCall = Hash::get($callers, 'function');
     $this->calledFromClass = Hash::get($callers, 'class');
     $this->calledWithArgs = Hash::get($callers, 'args')[0];
 }
Ejemplo n.º 5
0
 public function __get($key)
 {
     return Hash::get($this->columns, $key);
 }
Ejemplo n.º 6
0
 /**
  * return method caller from backtrace
  * @return string
  */
 private function getCallingMethodName()
 {
     return Hash::get(debug_backtrace(), '2.function');
 }
Ejemplo n.º 7
0
 /**
  * Controller handler by request params.
  *
  * @param array $url Request string (URI)
  * @return void
  */
 private function initializeController($url)
 {
     if (is_readable(Env::path() . implode('/', $url))) {
         exit;
     }
     $this->controller = $this->routes->getControllerName();
     try {
         $this->createInstance(Env::path('controller') . $this->controller . '.php');
     } catch (Exception $e) {
         echo 'wrong controller';
     }
     $this->action = empty($url[0]) ? Hash::get($this->route, 'action') : Hash::extract($url);
     $this->initializeAction($url);
 }
Ejemplo n.º 8
0
 public function get($key)
 {
     return Hash::get($this->yaml, $key);
 }