Beispiel #1
0
 public function load($locale = null)
 {
     $filename = app_path() . DIRECTORY_SEPARATOR . $this->baseLocaleDir . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'language.php';
     if (is_readable($filename)) {
         $this->locale = $locale;
         $this->translations = (include $filename);
     } else {
         Suricate::Logger()->debug(sprintf('Missing translation file for %s', $this->locale));
     }
 }
Beispiel #2
0
 /**
  * Loop through each defined routes, to find good one
  * @return null
  */
 public function doRouting()
 {
     $hasRoute = false;
     foreach ($this->routes as $route) {
         if ($route->isMatched) {
             $hasRoute = true;
             Suricate::Logger()->debug('Route "' . $route->getPath() . '" matched, target: ' . json_encode($route->target));
             $result = $route->dispatch($this->response, $this->appMiddlewares);
             if ($result === false) {
                 break;
             }
         }
     }
     // No route matched
     if (!$hasRoute) {
         Suricate::Logger()->debug('No route found');
         app()->abort('404');
     }
     $this->response->write();
 }