@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param Container $container |
122 | 122 | * @return boolean |
123 | 123 | */ |
124 | - $container['debug'] = function (Container $container) { |
|
124 | + $container['debug'] = function(Container $container) { |
|
125 | 125 | if (isset($container['config']['debug'])) { |
126 | 126 | $debug = !!$container['config']['debug']; |
127 | 127 | } elseif (isset($container['config']['dev_mode'])) { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param Container $container |
143 | 143 | * @return \Psr\Http\Message\UriInterface |
144 | 144 | */ |
145 | - $container['base-url'] = function (Container $container) { |
|
145 | + $container['base-url'] = function(Container $container) { |
|
146 | 146 | if (isset($container['config']['base_url'])) { |
147 | 147 | $baseUrl = $container['config']['base_url']; |
148 | 148 | } else { |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param Container $container A container instance. |
179 | 179 | * @return \Charcoal\App\Handler\HandlerInterface |
180 | 180 | */ |
181 | - $container->extend('notFoundHandler', function ($handler, Container $container) use ($config) { |
|
181 | + $container->extend('notFoundHandler', function($handler, Container $container) use ($config) { |
|
182 | 182 | if ($handler instanceof \Slim\Handlers\NotFound) { |
183 | 183 | $notFoundConfig = isset($config['notFound']) ? $config['notFound'] : []; |
184 | 184 | $handler = new NotFound($container, $notFoundConfig); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @param Container $container A container instance. |
198 | 198 | * @return \Charcoal\App\Handler\HandlerInterface |
199 | 199 | */ |
200 | - $container->extend('notAllowedHandler', function ($handler, Container $container) use ($config) { |
|
200 | + $container->extend('notAllowedHandler', function($handler, Container $container) use ($config) { |
|
201 | 201 | if ($handler instanceof \Slim\Handlers\NotAllowed) { |
202 | 202 | $notAllowedConfig = isset($config['notAllowed']) ? $config['notAllowed'] : []; |
203 | 203 | $handler = new NotAllowed($container, $notAllowedConfig); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param Container $container A container instance. |
217 | 217 | * @return \Charcoal\App\Handler\HandlerInterface |
218 | 218 | */ |
219 | - $container->extend('phpErrorHandler', function ($handler, Container $container) use ($config) { |
|
219 | + $container->extend('phpErrorHandler', function($handler, Container $container) use ($config) { |
|
220 | 220 | if ($handler instanceof \Slim\Handlers\PhpError) { |
221 | 221 | $phpErrorConfig = isset($config['phpError']) ? $config['phpError'] : []; |
222 | 222 | $handler = new PhpError($container, $phpErrorConfig); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @param Container $container A container instance. |
236 | 236 | * @return \Charcoal\App\Handler\HandlerInterface |
237 | 237 | */ |
238 | - $container->extend('errorHandler', function ($handler, Container $container) use ($config) { |
|
238 | + $container->extend('errorHandler', function($handler, Container $container) use ($config) { |
|
239 | 239 | if ($handler instanceof \Slim\Handlers\Error) { |
240 | 240 | $errorConfig = isset($config['error']) ? $config['error'] : []; |
241 | 241 | $handler = new Error($container, $errorConfig); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @param Container $container A Pimple DI container. |
256 | 256 | * @return \Charcoal\App\Handler\HandlerInterface |
257 | 257 | */ |
258 | - $container['maintenanceHandler'] = function (Container $container) use ($config) { |
|
258 | + $container['maintenanceHandler'] = function(Container $container) use ($config) { |
|
259 | 259 | $maintenanceConfig = isset($config['maintenance']) ? $config['maintenance'] : []; |
260 | 260 | $handler = new Maintenance($container, $maintenanceConfig); |
261 | 261 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @param Container $container A container instance. |
283 | 283 | * @return \Charcoal\Factory\FactoryInterface |
284 | 284 | */ |
285 | - $container['route/factory'] = function (Container $container) { |
|
285 | + $container['route/factory'] = function(Container $container) { |
|
286 | 286 | return new Factory([ |
287 | 287 | 'base_class' => RouteInterface::class, |
288 | 288 | 'resolver_options' => [ |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @param Container $container A container instance. |
327 | 327 | * @return \Charcoal\Factory\FactoryInterface |
328 | 328 | */ |
329 | - $container['action/factory'] = function (Container $container) { |
|
329 | + $container['action/factory'] = function(Container $container) { |
|
330 | 330 | return new Factory([ |
331 | 331 | 'base_class' => ActionInterface::class, |
332 | 332 | 'resolver_options' => [ |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * @param Container $container A container instance. |
350 | 350 | * @return \Charcoal\Factory\FactoryInterface |
351 | 351 | */ |
352 | - $container['template/factory'] = function (Container $container) { |
|
352 | + $container['template/factory'] = function(Container $container) { |
|
353 | 353 | return new Factory([ |
354 | 354 | 'base_class' => TemplateInterface::class, |
355 | 355 | 'resolver_options' => [ |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * @param Container $container A container instance. |
372 | 372 | * @return \Charcoal\Factory\FactoryInterface |
373 | 373 | */ |
374 | - $container['widget/factory'] = function (Container $container) { |
|
374 | + $container['widget/factory'] = function(Container $container) { |
|
375 | 375 | return new Factory([ |
376 | 376 | 'base_class' => WidgetInterface::class, |
377 | 377 | 'resolver_options' => [ |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | * @param Container $container A container instance. |
389 | 389 | * @return WidgetBuilder |
390 | 390 | */ |
391 | - $container['widget/builder'] = function (Container $container) { |
|
391 | + $container['widget/builder'] = function(Container $container) { |
|
392 | 392 | return new WidgetBuilder($container['widget/factory'], $container); |
393 | 393 | }; |
394 | 394 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @param Container $container A container instance. |
408 | 408 | * @return \Charcoal\Factory\FactoryInterface |
409 | 409 | */ |
410 | - $container['module/factory'] = function (Container $container) { |
|
410 | + $container['module/factory'] = function(Container $container) { |
|
411 | 411 | return new Factory([ |
412 | 412 | 'base_class' => ModuleInterface::class, |
413 | 413 | 'resolver_options' => [ |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * @param Container $container A container instance. |
426 | 426 | * @return array |
427 | 427 | */ |
428 | - $container['module/classes'] = function (Container $container) { |
|
428 | + $container['module/classes'] = function(Container $container) { |
|
429 | 429 | $appConfig = $container['config']; |
430 | 430 | |
431 | 431 | $modules = $appConfig['modules']; |
@@ -435,11 +435,11 @@ discard block |
||
435 | 435 | 'suffix' => 'Module' |
436 | 436 | ]); |
437 | 437 | |
438 | - $modules = array_map(function ($module) use ($moduleResolver) { |
|
438 | + $modules = array_map(function($module) use ($moduleResolver) { |
|
439 | 439 | return $moduleResolver->resolve($module); |
440 | 440 | }, $modules); |
441 | 441 | |
442 | - array_filter($modules, function ($class) { |
|
442 | + array_filter($modules, function($class) { |
|
443 | 443 | return class_exists($class); |
444 | 444 | }); |
445 | 445 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | protected function registerViewServices(Container $container) |
457 | 457 | { |
458 | 458 | if (!isset($container['view/mustache/helpers'])) { |
459 | - $container['view/mustache/helpers'] = function () { |
|
459 | + $container['view/mustache/helpers'] = function() { |
|
460 | 460 | return []; |
461 | 461 | }; |
462 | 462 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | * |
467 | 467 | * @return array |
468 | 468 | */ |
469 | - $container->extend('view/mustache/helpers', function (array $helpers, Container $container) { |
|
469 | + $container->extend('view/mustache/helpers', function(array $helpers, Container $container) { |
|
470 | 470 | $baseUrl = $container['base-url']; |
471 | 471 | $urls = [ |
472 | 472 | /** |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @param string $uri A URI path to wrap. |
494 | 494 | * @return UriInterface|null |
495 | 495 | */ |
496 | - 'withBaseUrl' => function ($uri, LambdaHelper $helper = null) use ($baseUrl) { |
|
496 | + 'withBaseUrl' => function($uri, LambdaHelper $helper = null) use ($baseUrl) { |
|
497 | 497 | if ($helper) { |
498 | 498 | $uri = $helper->render($uri); |
499 | 499 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } else { |
505 | 505 | $parts = parse_url($uri); |
506 | 506 | if (!isset($parts['scheme'])) { |
507 | - if (!in_array($uri[0], [ '/', '#', '?' ])) { |
|
507 | + if (!in_array($uri[0], ['/', '#', '?'])) { |
|
508 | 508 | $path = isset($parts['path']) ? $parts['path'] : ''; |
509 | 509 | $query = isset($parts['query']) ? $parts['query'] : ''; |
510 | 510 | $hash = isset($parts['fragment']) ? $parts['fragment'] : ''; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | return $uri; |
520 | 520 | }, |
521 | - 'renderContext' => function ($text, LambdaHelper $helper = null) { |
|
521 | + 'renderContext' => function($text, LambdaHelper $helper = null) { |
|
522 | 522 | return $helper->render('{{>'.$helper->render($text).'}}'); |
523 | 523 | } |
524 | 524 | ]; |