@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $this->hasRouteName($name); |
| 18 | 18 | |
| 19 | - if(!$this->loaded){ |
|
| 19 | + if (!$this->loaded) { |
|
| 20 | 20 | $this->loadIn($name); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function hasCurrentRoute(): void |
| 27 | 27 | { |
| 28 | - if(!isset($this->currentRoute)){ |
|
| 28 | + if (!isset($this->currentRoute)) { |
|
| 29 | 29 | throw new \RuntimeException('Route not yet loaded'); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -8,23 +8,23 @@ |
||
| 8 | 8 | use Psr\Http\Server\MiddlewareInterface; |
| 9 | 9 | use Psr\Http\Server\RequestHandlerInterface; |
| 10 | 10 | |
| 11 | -class Middleware implements MiddlewareInterface{ |
|
| 11 | +class Middleware implements MiddlewareInterface { |
|
| 12 | 12 | protected static array $data = []; |
| 13 | 13 | protected static Response $response; |
| 14 | 14 | |
| 15 | 15 | public function __get($key) |
| 16 | 16 | { |
| 17 | - return (array_key_exists($key,self::$data)) ? self::$data[$key] : null; |
|
| 17 | + return (array_key_exists($key, self::$data)) ? self::$data[$key] : null; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function __set($key,$value) |
|
| 20 | + public function __set($key, $value) |
|
| 21 | 21 | { |
| 22 | 22 | self::$data[$key] = $value; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
| 26 | 26 | { |
| 27 | - if(!isset(self::$response)){ |
|
| 27 | + if (!isset(self::$response)) { |
|
| 28 | 28 | self::$response = new Response(); |
| 29 | 29 | } |
| 30 | 30 | return self::$response; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $route = self::getInstance()->inSave(); |
| 26 | 26 | $route['name'] = $name; |
| 27 | 27 | self::getInstance()->routesName[$name] = $name; |
| 28 | - self::getInstance()->unsetRoute(array_key_last(self::getInstance()->getRoutes()))->updateRoute($route,$name); |
|
| 28 | + self::getInstance()->unsetRoute(array_key_last(self::getInstance()->getRoutes()))->updateRoute($route, $name); |
|
| 29 | 29 | return self::getInstance(); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | self::getInstance()->loaded = true; |
| 65 | 65 | self::getInstance()->sortRoutes(); |
| 66 | 66 | |
| 67 | - foreach(self::getInstance()->getRoutes() as $r => $route){ |
|
| 67 | + foreach (self::getInstance()->getRoutes() as $r => $route) { |
|
| 68 | 68 | self::getInstance()->currentRoute = $route; |
| 69 | 69 | self::getInstance()->currentRoute['name'] = $r; |
| 70 | 70 | |
| 71 | - try{ |
|
| 71 | + try { |
|
| 72 | 72 | self::getInstance()->checkMethod($route, $_SERVER['REQUEST_METHOD']); |
| 73 | 73 | self::getInstance()->checkData($route, (new Uri($_SERVER['REQUEST_URI']))->getPath()); |
| 74 | 74 | return self::getInstance(); |
| 75 | - }catch(\Exception $er){ |
|
| 75 | + }catch (\Exception $er) { |
|
| 76 | 76 | continue; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public static function run(): RouterInterface |
| 85 | 85 | { |
| 86 | - if(!self::getInstance()->loaded){ |
|
| 86 | + if (!self::getInstance()->loaded) { |
|
| 87 | 87 | self::getInstance()->load(); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | self::getInstance()->executeBefore(); |
| 91 | 91 | |
| 92 | - try{ |
|
| 92 | + try { |
|
| 93 | 93 | self::getInstance()->executeRouteAction(); |
| 94 | - }catch(\Exception $er){ |
|
| 94 | + }catch (\Exception $er) { |
|
| 95 | 95 | self::getInstance()->error = $er; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | private function checkError(): void |
| 106 | 106 | { |
| 107 | - if(isset($this->error)){ |
|
| 107 | + if (isset($this->error)) { |
|
| 108 | 108 | throw $this->error; |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -11,27 +11,27 @@ discard block |
||
| 11 | 11 | $staticRoutes = []; |
| 12 | 12 | $paramRoutes = []; |
| 13 | 13 | |
| 14 | - foreach($this->getRoutes() as $r => $route){ |
|
| 14 | + foreach ($this->getRoutes() as $r => $route) { |
|
| 15 | 15 | |
| 16 | 16 | $path = urldecode($route['uri']->getPath()); |
| 17 | 17 | |
| 18 | - if(strstr($path,'{')){ |
|
| 19 | - $paramRoutes[$this->getKeyArray(substr_count($path,'/') + substr_count($path,'{'),$paramRoutes)] = $route; |
|
| 18 | + if (strstr($path, '{')) { |
|
| 19 | + $paramRoutes[$this->getKeyArray(substr_count($path, '/')+substr_count($path, '{'), $paramRoutes)] = $route; |
|
| 20 | 20 | continue; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - $staticRoutes[$this->getKeyArray(substr_count($path,'/'),$staticRoutes)] = $route; |
|
| 23 | + $staticRoutes[$this->getKeyArray(substr_count($path, '/'), $staticRoutes)] = $route; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | rsort($paramRoutes); |
| 27 | 27 | rsort($staticRoutes); |
| 28 | 28 | |
| 29 | - $this->orderRoutes(array_merge($staticRoutes,$paramRoutes)); |
|
| 29 | + $this->orderRoutes(array_merge($staticRoutes, $paramRoutes)); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | private function getKeyArray(int $index, array $array): int |
| 33 | 33 | { |
| 34 | - while(array_key_exists($index,$array)){ |
|
| 34 | + while (array_key_exists($index, $array)) { |
|
| 35 | 35 | $index++; |
| 36 | 36 | } |
| 37 | 37 | return $index; |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | private function orderRoutes(array $routes):void |
| 41 | 41 | { |
| 42 | 42 | $kRoutes = $routes; |
| 43 | - foreach($routes as $r => $route){ |
|
| 44 | - if(array_key_exists('name',$route)){ |
|
| 43 | + foreach ($routes as $r => $route) { |
|
| 44 | + if (array_key_exists('name', $route)) { |
|
| 45 | 45 | unset($kRoutes[$r]); |
| 46 | 46 | $kRoutes["'{$route['name']}'"] = $route; |
| 47 | 47 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | |
| 46 | 46 | protected function setRoutes(array $routes): void |
| 47 | 47 | { |
| 48 | - $this->routes = $routes; |
|
| 48 | + $this->routes = $routes; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | protected function getGroup(): ?string |
@@ -10,28 +10,28 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected function hasRouteName(string $name): void |
| 12 | 12 | { |
| 13 | - if(!isset($this->routesName[$name])){ |
|
| 13 | + if (!isset($this->routesName[$name])) { |
|
| 14 | 14 | throw new \RuntimeException("There is no route named with {$name}"); |
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | protected function isInNameGroup(): void |
| 19 | 19 | { |
| 20 | - if(!is_null($this->getGroup())){ |
|
| 20 | + if (!is_null($this->getGroup())) { |
|
| 21 | 21 | throw new \RuntimeException("It is not allowed to assign names to groups"); |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | protected function isInPseudGroup(): void |
| 26 | 26 | { |
| 27 | - if(!is_null($this->getGroup())){ |
|
| 27 | + if (!is_null($this->getGroup())) { |
|
| 28 | 28 | throw new \RuntimeException("To assign actions before or after the execution of the route, use beforeGroup or afterGroup"); |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | protected function existRouteName(string $name): void |
| 33 | 33 | { |
| 34 | - if(isset($this->routesName[$name])){ |
|
| 34 | + if (isset($this->routesName[$name])) { |
|
| 35 | 35 | throw new \RuntimeException("There is already a route named with {$name}"); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | protected function checkMethod(array $route, $method): void |
| 40 | 40 | { |
| 41 | 41 | $hasMethod = false; |
| 42 | - foreach(explode('|',$route['method']) as $routeMethod){ |
|
| 43 | - if(@preg_match("/{$routeMethod}/",$method) !== 0 || $method === '*'){ |
|
| 42 | + foreach (explode('|', $route['method']) as $routeMethod) { |
|
| 43 | + if (@preg_match("/{$routeMethod}/", $method) !== 0 || $method === '*') { |
|
| 44 | 44 | $hasMethod = true; |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | - if(!$hasMethod){ |
|
| 47 | + if (!$hasMethod) { |
|
| 48 | 48 | throw new \Exception('This route is not released for the accessed method'); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | protected function getState(string $state, bool $except = false) |
| 17 | 17 | { |
| 18 | - if($state === 'before'){ |
|
| 18 | + if ($state === 'before') { |
|
| 19 | 19 | return ($except) ? $this->beforeExcepts : $this->beforeAll; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | protected function setState(string $state, $settable, bool $except = false): bool |
| 26 | 26 | { |
| 27 | - if($state === 'before'){ |
|
| 28 | - if($except){ |
|
| 27 | + if ($state === 'before') { |
|
| 28 | + if ($except) { |
|
| 29 | 29 | $this->beforeExcepts = $settable; |
| 30 | 30 | return true; |
| 31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | return true; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if($except){ |
|
| 37 | + if ($except) { |
|
| 38 | 38 | $this->afterExcepts = $settable; |
| 39 | 39 | return true; |
| 40 | 40 | } |
@@ -45,24 +45,24 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public static function before($closure): RouterInterface |
| 47 | 47 | { |
| 48 | - return self::addInRoute('before',$closure); |
|
| 48 | + return self::addInRoute('before', $closure); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public static function after($closure): RouterInterface |
| 52 | 52 | { |
| 53 | - return self::addInRoute('after',$closure); |
|
| 53 | + return self::addInRoute('after', $closure); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public static function beforeAll($closure, $excepts): RouterInterface |
| 57 | 57 | { |
| 58 | - self::getInstance()->setState('before', (is_array($excepts)) ? $excepts : [ $excepts ] ,true); |
|
| 58 | + self::getInstance()->setState('before', (is_array($excepts)) ? $excepts : [$excepts], true); |
|
| 59 | 59 | self::getInstance()->setState('before', $closure, false); |
| 60 | 60 | return self::getInstance(); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public static function afterAll($closure, $excepts): RouterInterface |
| 64 | 64 | { |
| 65 | - self::getInstance()->setState('after', (is_array($excepts)) ? $excepts : [ $excepts ] ,true); |
|
| 65 | + self::getInstance()->setState('after', (is_array($excepts)) ? $excepts : [$excepts], true); |
|
| 66 | 66 | self::getInstance()->setState('after', $closure, false); |
| 67 | 67 | return self::getInstance(); |
| 68 | 68 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | protected function executeRouteAction(): bool |
| 81 | 81 | { |
| 82 | - if(is_callable($this->current()['action'])){ |
|
| 82 | + if (is_callable($this->current()['action'])) { |
|
| 83 | 83 | call_user_func_array($this->current()['action'], $_REQUEST); |
| 84 | 84 | return true; |
| 85 | 85 | } |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | private static function addInRoutes(string $state, $closure, $excepts): RouterInterface |
| 92 | 92 | { |
| 93 | 93 | self::getInstance()->isInPseudGroup(); |
| 94 | - $excepts = (is_array($excepts)) ? $excepts : [ $excepts ]; |
|
| 94 | + $excepts = (is_array($excepts)) ? $excepts : [$excepts]; |
|
| 95 | 95 | $group = self::getInstance()->inSave()['group']; |
| 96 | 96 | |
| 97 | - foreach(self::getInstance()->getRoutes() as $r => $route){ |
|
| 98 | - if($route['group'] === $group && !in_array($r,$excepts)){ |
|
| 99 | - self::getInstance()->getRoutes()[$r][$state] = (is_null($route[$state])) ? [ $closure ] : array_merge($route[$state], [ $closure ]); |
|
| 97 | + foreach (self::getInstance()->getRoutes() as $r => $route) { |
|
| 98 | + if ($route['group'] === $group && !in_array($r, $excepts)) { |
|
| 99 | + self::getInstance()->getRoutes()[$r][$state] = (is_null($route[$state])) ? [$closure] : array_merge($route[$state], [$closure]); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | private static function addInRoute(string $state, $closure): RouterInterface |
| 107 | 107 | { |
| 108 | 108 | $route = self::getInstance()->inSave(); |
| 109 | - $route[$state] = (!is_null($route[$state])) ? [ $closure ] : array_merge($route[$state], [ $closure ]); |
|
| 110 | - self::updateRoute($route,array_key_last(self::getInstance()->getRoutes())); |
|
| 109 | + $route[$state] = (!is_null($route[$state])) ? [$closure] : array_merge($route[$state], [$closure]); |
|
| 110 | + self::updateRoute($route, array_key_last(self::getInstance()->getRoutes())); |
|
| 111 | 111 | return self::getInstance(); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | protected function executeBefore(): void |
| 115 | 115 | { |
| 116 | - if(!in_array($this->currentName(), (array) $this->getState('before', true))){ |
|
| 116 | + if (!in_array($this->currentName(), (array) $this->getState('before', true))) { |
|
| 117 | 117 | ($this->getState('before', false))(); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | protected function executeAfter(): void |
| 124 | 124 | { |
| 125 | - if(!in_array($this->currentName(), (array) $this->getState('after', true))){ |
|
| 125 | + if (!in_array($this->currentName(), (array) $this->getState('after', true))) { |
|
| 126 | 126 | ($this->getState('after', false))(); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | private function executeState(string $stage): void |
| 133 | 133 | { |
| 134 | - foreach($this->current()[$stage] as $state){ |
|
| 135 | - if(is_callable($state)){ |
|
| 134 | + foreach ($this->current()[$stage] as $state) { |
|
| 135 | + if (is_callable($state)) { |
|
| 136 | 136 | $state(); |
| 137 | 137 | continue; |
| 138 | 138 | } |
@@ -143,31 +143,31 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | private function executeController(string $controllerMeth): void |
| 145 | 145 | { |
| 146 | - if(count(explode('@',$controllerMeth)) !== 2){ |
|
| 146 | + if (count(explode('@', $controllerMeth)) !== 2) { |
|
| 147 | 147 | $path = urldecode($this->current()['uri']->getPath()); |
| 148 | 148 | throw new \RuntimeException("Misconfigured route action ({$path})"); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $controller = (string) explode('@',$controllerMeth)[0]; |
|
| 152 | - $method = (string) explode('@',$controllerMeth)[1]; |
|
| 151 | + $controller = (string) explode('@', $controllerMeth)[0]; |
|
| 152 | + $method = (string) explode('@', $controllerMeth)[1]; |
|
| 153 | 153 | |
| 154 | 154 | $this->checkControllerMeth($controllerMeth); |
| 155 | 155 | |
| 156 | - call_user_func_array([(new $controller()),$method], $_REQUEST); |
|
| 156 | + call_user_func_array([(new $controller()), $method], $_REQUEST); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | private function checkControllerMeth(string $controllerMeth): void |
| 160 | 160 | { |
| 161 | - $routeURI = str_replace(['{:','{','}'],'',urldecode($this->current()['uri']->getPath())); |
|
| 161 | + $routeURI = str_replace(['{:', '{', '}'], '', urldecode($this->current()['uri']->getPath())); |
|
| 162 | 162 | |
| 163 | - $controller = (string) explode('@',$controllerMeth)[0]; |
|
| 164 | - $method = (string) explode('@',$controllerMeth)[1]; |
|
| 163 | + $controller = (string) explode('@', $controllerMeth)[0]; |
|
| 164 | + $method = (string) explode('@', $controllerMeth)[1]; |
|
| 165 | 165 | |
| 166 | - if(!class_exists($controller)){ |
|
| 166 | + if (!class_exists($controller)) { |
|
| 167 | 167 | throw new \RuntimeException("Controller not found in route URI {$routeURI}"); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if(!method_exists($controller, $method)){ |
|
| 170 | + if (!method_exists($controller, $method)) { |
|
| 171 | 171 | throw new \RuntimeException("Method {$method} not found in controller {$controller} in route URI {$routeURI}"); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -10,32 +10,32 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | public static function get(string $uri, $closure): RouterInterface |
| 12 | 12 | { |
| 13 | - return self::set('get',$uri,$closure); |
|
| 13 | + return self::set('get', $uri, $closure); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public static function post(string $uri, $closure): RouterInterface |
| 17 | 17 | { |
| 18 | - return self::set('post',$uri,$closure); |
|
| 18 | + return self::set('post', $uri, $closure); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public static function ajax(string $uri, $closure): RouterInterface |
| 22 | 22 | { |
| 23 | - return self::set('ajax',$uri,$closure); |
|
| 23 | + return self::set('ajax', $uri, $closure); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function delete(string $uri, $closure): RouterInterface |
| 27 | 27 | { |
| 28 | - return self::set('delete',$uri,$closure); |
|
| 28 | + return self::set('delete', $uri, $closure); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public static function put(string $uri, $closure): RouterInterface |
| 32 | 32 | { |
| 33 | - return self::set('put',$uri,$closure); |
|
| 33 | + return self::set('put', $uri, $closure); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public static function patch(string $uri, $closure): RouterInterface |
| 37 | 37 | { |
| 38 | - return self::set('patch',$uri,$closure); |
|
| 38 | + return self::set('patch', $uri, $closure); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public static function match(string $method, string $uri, $closure): RouterInterface |
@@ -46,20 +46,20 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public static function any(string $uri, $closure): RouterInterface |
| 48 | 48 | { |
| 49 | - return self::set('*',$uri,$closure); |
|
| 49 | + return self::set('*', $uri, $closure); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | private static function set(string $method, string $uri, $closure): RouterInterface |
| 53 | 53 | { |
| 54 | - $uri = (substr($uri,0,1) !=='/' and strlen($uri) > 0) ? "/{$uri}" : $uri; |
|
| 54 | + $uri = (substr($uri, 0, 1) !== '/' and strlen($uri) > 0) ? "/{$uri}" : $uri; |
|
| 55 | 55 | |
| 56 | - self::checkDuplicity($uri,$method); |
|
| 56 | + self::checkDuplicity($uri, $method); |
|
| 57 | 57 | |
| 58 | 58 | $routes = self::getInstance()->getRoutes(); |
| 59 | 59 | |
| 60 | 60 | $index = sha1(date('d/m/Y H:i:s').count($routes)); |
| 61 | 61 | |
| 62 | - while(array_key_exists($index,$routes)){ |
|
| 62 | + while (array_key_exists($index, $routes)) { |
|
| 63 | 63 | $index = sha1(date('d/m/Y H:i:s').rand(count($routes))); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | private static function checkDuplicity(string $uri, string $method): void |
| 84 | 84 | { |
| 85 | - foreach(self::getInstance()->getRoutes() as $route){ |
|
| 86 | - if( md5($route['uri'].$route['method']) === md5($uri.$method) ){ |
|
| 85 | + foreach (self::getInstance()->getRoutes() as $route) { |
|
| 86 | + if (md5($route['uri'].$route['method']) === md5($uri.$method)) { |
|
| 87 | 87 | throw new \RuntimeException("There is already a route with the URI {$uri} and with the {$method} METHOD configured."); |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | /* NOTE: in case of error an exception is thrown */ |
| 11 | 11 | |
| 12 | -try{ |
|
| 12 | +try { |
|
| 13 | 13 | |
| 14 | 14 | Router::globalMiddlewares([ |
| 15 | 15 | 'Lasted'=> \HnrAzevedo\Router\Example\Middleware\Lasted::class |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | /* Return current action route */ |
| 27 | 27 | $action = Router::currentAction(); |
| 28 | 28 | |
| 29 | -}catch(Exception $er){ |
|
| 29 | +}catch (Exception $er) { |
|
| 30 | 30 | |
| 31 | 31 | die("Code Error: {$er->getCode()}, Line: {$er->getLine()}, File: {$er->getFile()}, Message: {$er->getMessage()}."); |
| 32 | 32 | |