@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * OCS routes go into a different collection |
81 | 81 | */ |
82 | 82 | $oldCollection = $this->router->getCurrentCollection(); |
83 | - $this->router->useCollection($oldCollection . '.ocs'); |
|
83 | + $this->router->useCollection($oldCollection.'.ocs'); |
|
84 | 84 | |
85 | 85 | // parse ocs simple routes |
86 | 86 | $this->processOCS($this->routes); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | foreach ($ocsRoutes as $ocsRoute) { |
97 | 97 | $name = $ocsRoute['name']; |
98 | 98 | $postfix = $ocsRoute['postfix'] ?? ''; |
99 | - $root = $ocsRoute['root'] ?? '/apps/' . $this->appName; |
|
99 | + $root = $ocsRoute['root'] ?? '/apps/'.$this->appName; |
|
100 | 100 | |
101 | - $url = $root . $ocsRoute['url']; |
|
101 | + $url = $root.$ocsRoute['url']; |
|
102 | 102 | $verb = strtoupper($ocsRoute['verb'] ?? 'GET'); |
103 | 103 | |
104 | 104 | $split = explode('#', $name, 2); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $controllerName = $this->buildControllerName($controller); |
111 | 111 | $actionName = $this->buildActionName($action); |
112 | 112 | |
113 | - $routeName = 'ocs.' . $this->appName . '.' . $controller . '.' . $action . $postfix; |
|
113 | + $routeName = 'ocs.'.$this->appName.'.'.$controller.'.'.$action.$postfix; |
|
114 | 114 | |
115 | 115 | // register the route |
116 | 116 | $handler = new RouteActionHandler($this->container, $controllerName, $actionName); |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | |
122 | 122 | // optionally register requirements for route. This is used to |
123 | 123 | // tell the route parser how url parameters should be matched |
124 | - if(array_key_exists('requirements', $ocsRoute)) { |
|
124 | + if (array_key_exists('requirements', $ocsRoute)) { |
|
125 | 125 | $router->requirements($ocsRoute['requirements']); |
126 | 126 | } |
127 | 127 | |
128 | 128 | // optionally register defaults for route. This is used to |
129 | 129 | // tell the route parser how url parameters should be default valued |
130 | - if(array_key_exists('defaults', $ocsRoute)) { |
|
130 | + if (array_key_exists('defaults', $ocsRoute)) { |
|
131 | 131 | $router->defaults($ocsRoute['defaults']); |
132 | 132 | } |
133 | 133 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $controllerName = $this->buildControllerName($controller); |
157 | 157 | $actionName = $this->buildActionName($action); |
158 | 158 | |
159 | - $routeName = $this->appName . '.' . $controller . '.' . $action . $postfix; |
|
159 | + $routeName = $this->appName.'.'.$controller.'.'.$action.$postfix; |
|
160 | 160 | |
161 | 161 | // register the route |
162 | 162 | $handler = new RouteActionHandler($this->container, $controllerName, $actionName); |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | |
167 | 167 | // optionally register requirements for route. This is used to |
168 | 168 | // tell the route parser how url parameters should be matched |
169 | - if(array_key_exists('requirements', $simpleRoute)) { |
|
169 | + if (array_key_exists('requirements', $simpleRoute)) { |
|
170 | 170 | $router->requirements($simpleRoute['requirements']); |
171 | 171 | } |
172 | 172 | |
173 | 173 | // optionally register defaults for route. This is used to |
174 | 174 | // tell the route parser how url parameters should be default valued |
175 | - if(array_key_exists('defaults', $simpleRoute)) { |
|
175 | + if (array_key_exists('defaults', $simpleRoute)) { |
|
176 | 176 | $router->defaults($simpleRoute['defaults']); |
177 | 177 | } |
178 | 178 | } |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | |
201 | 201 | $resources = $routes['ocs-resources'] ?? []; |
202 | 202 | foreach ($resources as $resource => $config) { |
203 | - $root = $config['root'] ?? '/apps/' . $this->appName; |
|
203 | + $root = $config['root'] ?? '/apps/'.$this->appName; |
|
204 | 204 | |
205 | 205 | // the url parameter used as id to the resource |
206 | - foreach($actions as $action) { |
|
207 | - $url = $root . $config['url']; |
|
206 | + foreach ($actions as $action) { |
|
207 | + $url = $root.$config['url']; |
|
208 | 208 | $method = $action['name']; |
209 | 209 | $verb = strtoupper($action['verb'] ?? 'GET'); |
210 | 210 | $collectionAction = $action['on-collection'] ?? false; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $url .= '/{id}'; |
213 | 213 | } |
214 | 214 | if (isset($action['url-postfix'])) { |
215 | - $url .= '/' . $action['url-postfix']; |
|
215 | + $url .= '/'.$action['url-postfix']; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | $controller = $resource; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $controllerName = $this->buildControllerName($controller); |
221 | 221 | $actionName = $this->buildActionName($method); |
222 | 222 | |
223 | - $routeName = 'ocs.' . $this->appName . '.' . strtolower($resource) . '.' . strtolower($method); |
|
223 | + $routeName = 'ocs.'.$this->appName.'.'.strtolower($resource).'.'.strtolower($method); |
|
224 | 224 | |
225 | 225 | $this->router->create($routeName, $url)->method($verb)->action( |
226 | 226 | new RouteActionHandler($this->container, $controllerName, $actionName) |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | foreach ($resources as $resource => $config) { |
254 | 254 | |
255 | 255 | // the url parameter used as id to the resource |
256 | - foreach($actions as $action) { |
|
256 | + foreach ($actions as $action) { |
|
257 | 257 | $url = $config['url']; |
258 | 258 | $method = $action['name']; |
259 | 259 | $verb = strtoupper($action['verb'] ?? 'GET'); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $url .= '/{id}'; |
263 | 263 | } |
264 | 264 | if (isset($action['url-postfix'])) { |
265 | - $url .= '/' . $action['url-postfix']; |
|
265 | + $url .= '/'.$action['url-postfix']; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | $controller = $resource; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $controllerName = $this->buildControllerName($controller); |
271 | 271 | $actionName = $this->buildActionName($method); |
272 | 272 | |
273 | - $routeName = $this->appName . '.' . strtolower($resource) . '.' . strtolower($method); |
|
273 | + $routeName = $this->appName.'.'.strtolower($resource).'.'.strtolower($method); |
|
274 | 274 | |
275 | 275 | $this->router->create($routeName, $url)->method($verb)->action( |
276 | 276 | new RouteActionHandler($this->container, $controllerName, $actionName) |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | private function buildControllerName(string $controller): string { |
288 | 288 | if (!isset($this->controllerNameCache[$controller])) { |
289 | - $this->controllerNameCache[$controller] = $this->underScoreToCamelCase(ucfirst($controller)) . 'Controller'; |
|
289 | + $this->controllerNameCache[$controller] = $this->underScoreToCamelCase(ucfirst($controller)).'Controller'; |
|
290 | 290 | } |
291 | 291 | return $this->controllerNameCache[$controller]; |
292 | 292 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | $pattern = '/_[a-z]?/'; |
310 | 310 | return preg_replace_callback( |
311 | 311 | $pattern, |
312 | - function ($matches) { |
|
312 | + function($matches) { |
|
313 | 313 | return strtoupper(ltrim($matches[0], '_')); |
314 | 314 | }, |
315 | 315 | $str); |