| @@ -3,11 +3,11 @@ | ||
| 3 | 3 | * Autoload without composer. | 
| 4 | 4 | */ | 
| 5 | 5 | $srcRoot = dirname(__FILE__); | 
| 6 | -spl_autoload_register(function ($path) use ($srcRoot) { | |
| 7 | - $root = rtrim($srcRoot, '/') . '/'; | |
| 6 | +spl_autoload_register(function($path) use ($srcRoot) { | |
| 7 | + $root = rtrim($srcRoot, '/').'/'; | |
| 8 | 8 |      $path = str_replace('Dspbee\\Test\\', '', $path); | 
| 9 | 9 |      $path = str_replace('Dspbee\\', '', $path); | 
| 10 | - $path = $root . $path . '.php'; | |
| 10 | + $path = $root.$path.'.php'; | |
| 11 | 11 |      if (file_exists($path)) { | 
| 12 | 12 | require_once $path; | 
| 13 | 13 | } | 
| @@ -58,7 +58,7 @@ | ||
| 58 | 58 |          if (isset($_SERVER[$key])) { | 
| 59 | 59 | return $_SERVER[$key]; | 
| 60 | 60 |          } else { | 
| 61 | - $key = 'HTTP_' . $key; | |
| 61 | + $key = 'HTTP_'.$key; | |
| 62 | 62 | return $_SERVER[$key] ?? $default; | 
| 63 | 63 | } | 
| 64 | 64 | } | 
| @@ -78,7 +78,7 @@ | ||
| 78 | 78 | |
| 79 | 79 | // PHP_AUTH_USER/PHP_AUTH_PW | 
| 80 | 80 |          if (isset($headers['PHP_AUTH_USER'])) { | 
| 81 | - $headers['AUTHORIZATION'] = 'Basic ' . base64_encode($headers['PHP_AUTH_USER'] . ':' . $headers['PHP_AUTH_PW']); | |
| 81 | + $headers['AUTHORIZATION'] = 'Basic '.base64_encode($headers['PHP_AUTH_USER'].':'.$headers['PHP_AUTH_PW']); | |
| 82 | 82 |          } elseif (isset($headers['PHP_AUTH_DIGEST'])) { | 
| 83 | 83 | $headers['AUTHORIZATION'] = $headers['PHP_AUTH_DIGEST']; | 
| 84 | 84 | } | 
| @@ -87,7 +87,7 @@ | ||
| 87 | 87 |              throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); | 
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | - $target = rtrim($directory, '/\\') . DIRECTORY_SEPARATOR . (null === $name ? $this->getBasename() : $this->getName($name)); | |
| 90 | + $target = rtrim($directory, '/\\').DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); | |
| 91 | 91 | |
| 92 | 92 | return new self($target, false); | 
| 93 | 93 | } | 
| @@ -21,7 +21,7 @@ | ||
| 21 | 21 | public function initFromArray(array $data) | 
| 22 | 22 |      { | 
| 23 | 23 |          foreach ($data as $name => $value) { | 
| 24 | - $method = 'set' . ucfirst($name); | |
| 24 | + $method = 'set'.ucfirst($name); | |
| 25 | 25 |              if (method_exists($this, $method)) { | 
| 26 | 26 | call_user_func_array([$this, $method], [$value]); | 
| 27 | 27 |              } else { | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | public static function handleFatal() | 
| 46 | 46 |      { | 
| 47 | 47 | $error = error_get_last(); | 
| 48 | -        if(null !== $error) { | |
| 48 | +        if (null !== $error) { | |
| 49 | 49 | self::render($error["type"], $error["message"], $error["file"], $error["line"]); | 
| 50 | 50 | } | 
| 51 | 51 | } | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 | } | 
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | - $template = new Native(dirname(__FILE__) . '/', null, true); | |
| 92 | + $template = new Native(dirname(__FILE__).'/', null, true); | |
| 93 | 93 | $response = new Response(); | 
| 94 | 94 | $response->headerStatus(418); | 
| 95 | 95 |          $response->setContent($template->getContent('catch.html.php', $data)); | 
| @@ -23,10 +23,10 @@ | ||
| 23 | 23 | $objects = scandir($dir); | 
| 24 | 24 |              foreach ($objects as $object) { | 
| 25 | 25 |                  if ('.' != $object && '..' != $object) { | 
| 26 | -                    if ('dir' == filetype($dir . '/' .$object)) { | |
| 27 | - self::removeFromDir($dir . '/' . $object, true); | |
| 26 | +                    if ('dir' == filetype($dir.'/'.$object)) { | |
| 27 | + self::removeFromDir($dir.'/'.$object, true); | |
| 28 | 28 |                      } else { | 
| 29 | - unlink($dir . '/' . $object); | |
| 29 | + unlink($dir.'/'.$object); | |
| 30 | 30 | } | 
| 31 | 31 | } | 
| 32 | 32 | } | 
| @@ -75,7 +75,7 @@ discard block | ||
| 75 | 75 | /** | 
| 76 | 76 | * Request URL. | 
| 77 | 77 | */ | 
| 78 | - $this->url = '/' . $url; | |
| 78 | + $this->url = '/'.$url; | |
| 79 | 79 | |
| 80 | 80 | /** | 
| 81 | 81 | * Get method. | 
| @@ -163,20 +163,20 @@ discard block | ||
| 163 | 163 | $controller = ''; | 
| 164 | 164 |          if (false !== strpos($this->url, '.php')) { | 
| 165 | 165 |              $controller = explode('.php', $this->url); | 
| 166 | - $controller = ltrim($controller[0], '/') . '.php'; | |
| 166 | + $controller = ltrim($controller[0], '/').'.php'; | |
| 167 | 167 | } | 
| 168 | 168 | $route = trim($route, '/'); | 
| 169 | 169 |          if ('Original' == $this->package) { | 
| 170 | 170 |              if ($this->languageCode != $this->languageDefault) { | 
| 171 | -                $url = trim('/' . $this->languageCode . '/' . $route, '/'); | |
| 171 | +                $url = trim('/'.$this->languageCode.'/'.$route, '/'); | |
| 172 | 172 |              } else { | 
| 173 | -                $url = trim('/' . $route, '/'); | |
| 173 | +                $url = trim('/'.$route, '/'); | |
| 174 | 174 | } | 
| 175 | 175 |          } else { | 
| 176 | 176 |              if ($this->languageCode != $this->languageDefault) { | 
| 177 | -                $url = trim('/' . $this->languageCode . '/' . lcfirst($this->package) . '/' . $route, '/'); | |
| 177 | +                $url = trim('/'.$this->languageCode.'/'.lcfirst($this->package).'/'.$route, '/'); | |
| 178 | 178 |              } else { | 
| 179 | -                $url = trim('/' . lcfirst($this->package) . '/' . $route, '/'); | |
| 179 | +                $url = trim('/'.lcfirst($this->package).'/'.$route, '/'); | |
| 180 | 180 | } | 
| 181 | 181 | } | 
| 182 | 182 |          if ($domain) { | 
| @@ -194,15 +194,15 @@ discard block | ||
| 194 | 194 | $protocol = 'https://'; | 
| 195 | 195 | } | 
| 196 | 196 |              if (empty($controller)) { | 
| 197 | - $url = $protocol . $host . '/' . $url; | |
| 197 | + $url = $protocol.$host.'/'.$url; | |
| 198 | 198 |              } else { | 
| 199 | - $url = $protocol . $host . '/' . $controller . '/' . $url; | |
| 199 | + $url = $protocol.$host.'/'.$controller.'/'.$url; | |
| 200 | 200 | } | 
| 201 | 201 |          } else { | 
| 202 | 202 |              if (empty($controller)) { | 
| 203 | - $url = '/' . $url; | |
| 203 | + $url = '/'.$url; | |
| 204 | 204 |              } else { | 
| 205 | - $url = '/' . $controller . '/' . $url; | |
| 205 | + $url = '/'.$controller.'/'.$url; | |
| 206 | 206 | } | 
| 207 | 207 | } | 
| 208 | 208 | |
| @@ -22,17 +22,17 @@ discard block | ||
| 22 | 22 | */ | 
| 23 | 23 | public function __construct($appRoot) | 
| 24 | 24 |      { | 
| 25 | - $appRoot = rtrim($appRoot, '/') . '/'; | |
| 25 | + $appRoot = rtrim($appRoot, '/').'/'; | |
| 26 | 26 | $this->packageRoot = $appRoot; | 
| 27 | 27 | |
| 28 | 28 | /** | 
| 29 | 29 | * Register autoload to app/$package/src dir's. | 
| 30 | 30 | */ | 
| 31 | -        spl_autoload_register(function ($path) use ($appRoot) { | |
| 31 | +        spl_autoload_register(function($path) use ($appRoot) { | |
| 32 | 32 |              $path = explode('\\', $path); | 
| 33 | - array_shift($path); // Vendor | |
| 34 | - $package = $appRoot . array_shift($path); // Package | |
| 35 | -            $path = $package . '/src/' . implode('/', $path) . '.php'; | |
| 33 | + array_shift($path); // Vendor | |
| 34 | + $package = $appRoot.array_shift($path); // Package | |
| 35 | +            $path = $package.'/src/'.implode('/', $path).'.php'; | |
| 36 | 36 |              if (file_exists($path)) { | 
| 37 | 37 | require_once $path; | 
| 38 | 38 | } | 
| @@ -53,7 +53,7 @@ discard block | ||
| 53 | 53 |      { | 
| 54 | 54 | $request = new Request($languageList, $packageList, $url); | 
| 55 | 55 | |
| 56 | - $this->packageRoot .= $request->package() . '/'; | |
| 56 | + $this->packageRoot .= $request->package().'/'; | |
| 57 | 57 | |
| 58 | 58 | /** | 
| 59 | 59 | * Process request. | 
| @@ -65,13 +65,13 @@ discard block | ||
| 65 | 65 | /** | 
| 66 | 66 | * Path to router class. | 
| 67 | 67 | */ | 
| 68 | - $path = $this->packageRoot . $routeClassList[$request->package()] . '.php'; | |
| 68 | + $path = $this->packageRoot.$routeClassList[$request->package()].'.php'; | |
| 69 | 69 |              if (file_exists($path)) { | 
| 70 | 70 | require $path; | 
| 71 | 71 | /** | 
| 72 | 72 | * Name of router class. | 
| 73 | 73 | */ | 
| 74 | - $route = $request->package() . '\\' . $routeClassList[$request->package()]; | |
| 74 | + $route = $request->package().'\\'.$routeClassList[$request->package()]; | |
| 75 | 75 | /** | 
| 76 | 76 | * @var IRoute $route | 
| 77 | 77 | */ | 
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 | $response->headerStatus(404); | 
| 99 | 99 | |
| 100 | 100 | $content = '404 Not Found'; | 
| 101 | -        if (file_exists($this->packageRoot . '/view/404.html.php')) { | |
| 101 | +        if (file_exists($this->packageRoot.'/view/404.html.php')) { | |
| 102 | 102 |              $content = (new Native($this->packageRoot))->getContent('404.html.php'); | 
| 103 | 103 | } | 
| 104 | 104 | |