@@ -129,29 +129,29 @@ |
||
129 | 129 | return $response instanceof Response ? $response : new Response((string)$response, 200); |
130 | 130 | } |
131 | 131 | |
132 | - public function get(string $pattern, Closure|string $callback, ?string $routeName = null): self |
|
132 | + public function get(string $pattern, Closure | string $callback, ?string $routeName = null): self |
|
133 | 133 | { |
134 | 134 | return $this->mount($pattern, $callback, $routeName, [Request::METHOD_GET]); |
135 | 135 | } |
136 | 136 | |
137 | - public function post(string $pattern, Closure|string $callback, ?string $routeName = null): self |
|
137 | + public function post(string $pattern, Closure | string $callback, ?string $routeName = null): self |
|
138 | 138 | { |
139 | 139 | return $this->mount($pattern, $callback, $routeName, [Request::METHOD_POST]); |
140 | 140 | } |
141 | 141 | |
142 | - public function put(string $pattern, Closure|string $callback, ?string $routeName = null): self |
|
142 | + public function put(string $pattern, Closure | string $callback, ?string $routeName = null): self |
|
143 | 143 | { |
144 | 144 | return $this->mount($pattern, $callback, $routeName, [Request::METHOD_PUT]); |
145 | 145 | } |
146 | 146 | |
147 | - public function delete(string $pattern, Closure|string $callback, ?string $routeName = null): self |
|
147 | + public function delete(string $pattern, Closure | string $callback, ?string $routeName = null): self |
|
148 | 148 | { |
149 | 149 | return $this->mount($pattern, $callback, $routeName, [Request::METHOD_DELETE]); |
150 | 150 | } |
151 | 151 | |
152 | 152 | public function mount( |
153 | 153 | string $pattern, |
154 | - Closure|string $callback, |
|
154 | + Closure | string $callback, |
|
155 | 155 | ?string $routeName = null, |
156 | 156 | array $methods = [] |
157 | 157 | ): self { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | final public function register( |
86 | 86 | string $eventName, |
87 | - callable|array|string $callback, |
|
87 | + callable | array | string $callback, |
|
88 | 88 | int $priority = 0 |
89 | 89 | ): self { |
90 | 90 | $eventName = trim($eventName); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | /** |
131 | 131 | * Normalize different callback formats to a callable |
132 | 132 | */ |
133 | - private function normalizeCallback(callable|array|string $callback): callable |
|
133 | + private function normalizeCallback(callable | array | string $callback): callable |
|
134 | 134 | { |
135 | 135 | return match (true) { |
136 | 136 | is_callable($callback) => $callback, |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $c['session.storage.handler'] |
60 | 60 | ); |
61 | 61 | |
62 | - $container['session'] = function (Container $app): Session { |
|
62 | + $container['session'] = function(Container $app): Session { |
|
63 | 63 | if (!isset($app['session.storage'])) { |
64 | 64 | $app['session.storage'] = $app['session.storage.native']; |
65 | 65 | } |
@@ -173,21 +173,21 @@ |
||
173 | 173 | |
174 | 174 | public function offsetExists(mixed $offset): bool |
175 | 175 | { |
176 | - return $this->has((string) $offset); |
|
176 | + return $this->has((string)$offset); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | public function offsetGet(mixed $offset): mixed |
180 | 180 | { |
181 | - return $this->get((string) $offset); |
|
181 | + return $this->get((string)$offset); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | public function offsetSet(mixed $offset, mixed $value): void |
185 | 185 | { |
186 | - $this->set((string) $offset, $value); |
|
186 | + $this->set((string)$offset, $value); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | public function offsetUnset(mixed $offset): void |
190 | 190 | { |
191 | - $this->unset((string) $offset); |
|
191 | + $this->unset((string)$offset); |
|
192 | 192 | } |
193 | 193 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $path = $route->path(); |
90 | 90 | |
91 | 91 | foreach ($params as $key => $value) { |
92 | - $path = str_replace(['{' . $key . '}', '{' . $key . '?}'], $value, $path); |
|
92 | + $path = str_replace(['{'.$key.'}', '{'.$key.'?}'], $value, $path); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return $path; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | return true; |
106 | 106 | } |
107 | 107 | |
108 | - if (!empty($regex) && preg_match('#^' . $regex . '/?$#', $currentPath, $matches)) { |
|
108 | + if (!empty($regex) && preg_match('#^'.$regex.'/?$#', $currentPath, $matches)) { |
|
109 | 109 | $params = $route->extractParameters($matches); |
110 | 110 | $request->query->add($params); |
111 | 111 | return true; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | return $result instanceof Response |
124 | 124 | ? $result |
125 | - : new Response((string) $result); |
|
125 | + : new Response((string)$result); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | private function getRouteByName(string $routeName): Route |
@@ -133,6 +133,6 @@ discard block |
||
133 | 133 | private function normalizePath(string $path): string |
134 | 134 | { |
135 | 135 | $normalized = ltrim($path, '/'); |
136 | - return str_ends_with($normalized, '/') ? $normalized : $normalized . '/'; |
|
136 | + return str_ends_with($normalized, '/') ? $normalized : $normalized.'/'; |
|
137 | 137 | } |
138 | 138 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | $app = new Mabs\Application(true); |
6 | 6 | |
7 | -$app->get('hello/{name}', function ($name) { |
|
7 | +$app->get('hello/{name}', function($name) { |
|
8 | 8 | |
9 | 9 | return 'Hello '.$name; |
10 | 10 | })->run(); |
11 | 11 | \ No newline at end of file |