@@ -77,14 +77,14 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | private function registerClassLoader() |
| 79 | 79 | { |
| 80 | - $this->container->setStaticDefinition('class_loader', function ($container) { |
|
| 80 | + $this->container->setStaticDefinition('class_loader', function($container) { |
|
| 81 | 81 | return new ClassLoader(); |
| 82 | 82 | }); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | private function registerPHPMatcher() |
| 86 | 86 | { |
| 87 | - $this->container->setStaticDefinition('php_matcher', function ($container) { |
|
| 87 | + $this->container->setStaticDefinition('php_matcher', function($container) { |
|
| 88 | 88 | return (new SimpleFactory())->createMatcher(); |
| 89 | 89 | }); |
| 90 | 90 | } |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | $resourcesPath |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - $this->container->setStaticDefinition('twig_loader', function ($container) { |
|
| 108 | + $this->container->setStaticDefinition('twig_loader', function($container) { |
|
| 109 | 109 | $stringLoader = new \Twig_Loader_String(); |
| 110 | 110 | $filesystemLoader = new \Twig_Loader_Filesystem(); |
| 111 | 111 | $filesystemLoader->addPath($container->getParameter('resources_path'), 'resources'); |
| 112 | 112 | return new \Twig_Loader_Chain([$filesystemLoader, $stringLoader]); |
| 113 | 113 | }); |
| 114 | 114 | |
| 115 | - $this->container->setStaticDefinition('twig' ,function ($container) { |
|
| 115 | + $this->container->setStaticDefinition('twig', function($container) { |
|
| 116 | 116 | $defaultOptions = [ |
| 117 | 117 | 'cache' => $container->getParameter('tutu.root_path') . '/var/twig', |
| 118 | 118 | 'globals' => [] |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | private function registerEventDispatcher() |
| 141 | 141 | { |
| 142 | - $this->container->setStaticDefinition('event_dispatcher' , function ($container) { |
|
| 142 | + $this->container->setStaticDefinition('event_dispatcher', function($container) { |
|
| 143 | 143 | $eventDispatcher = new EventDispatcher(); |
| 144 | 144 | $eventSubscribers = $container->getServicesByTag('event_dispatcher.subscriber'); |
| 145 | 145 | foreach ($eventSubscribers as $subscriber) { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | private function registerExtensionInitializer() |
| 154 | 154 | { |
| 155 | - $this->container->setDefinition('extension.initializer', function ($container) { |
|
| 155 | + $this->container->setDefinition('extension.initializer', function($container) { |
|
| 156 | 156 | return new Initializer($this->container->getService('class_loader')); |
| 157 | 157 | }); |
| 158 | 158 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $responsesPath |
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | - $this->container->setDefinition('response.config.loader.yaml', function ($container) { |
|
| 176 | + $this->container->setDefinition('response.config.loader.yaml', function($container) { |
|
| 177 | 177 | return new YamlLoader($container->getParameter('responses_file_path')); |
| 178 | 178 | }); |
| 179 | 179 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | }, ['matching_policy']); |
| 198 | 198 | |
| 199 | 199 | |
| 200 | - $this->container->setDefinition('request.matching_policy', function ($container) { |
|
| 200 | + $this->container->setDefinition('request.matching_policy', function($container) { |
|
| 201 | 201 | $matchingPolicy = new ChainMatchingPolicy(); |
| 202 | 202 | $matchingPolicies = $container->getServicesByTag('matching_policy'); |
| 203 | 203 | foreach ($matchingPolicies as $policy) { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | private function registerConfigResolver() |
| 212 | 212 | { |
| 213 | - $this->container->setStaticDefinition('response.config.resolver', function ($container) { |
|
| 213 | + $this->container->setStaticDefinition('response.config.resolver', function($container) { |
|
| 214 | 214 | return new Resolver( |
| 215 | 215 | $container->getService('response.config.loader.yaml'), |
| 216 | 216 | $container->getService('request.matching_policy') |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $this->container->setDefinition('request.path.parser', function($container) { |
| 224 | 224 | return new Parser(); |
| 225 | 225 | }); |
| 226 | - $this->container->setDefinition('response.builder', function ($container) { |
|
| 226 | + $this->container->setDefinition('response.builder', function($container) { |
|
| 227 | 227 | return new Builder($container->getService('twig'), $container->getService('request.path.parser')); |
| 228 | 228 | }); |
| 229 | 229 | } |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | if ($customPath = getenv('tutu_config')) { |
| 266 | 266 | if (!file_exists($customPath)) { |
| 267 | - throw new \RuntimeException('Custom config file not found at '.$customPath); |
|
| 267 | + throw new \RuntimeException('Custom config file not found at ' . $customPath); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - $configFiles = (array) $customPath; |
|
| 270 | + $configFiles = (array)$customPath; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | foreach ($configFiles as $filePath) { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | private function getExtensionArgumentsValues($arguments) |
| 313 | 313 | { |
| 314 | 314 | if (is_null($arguments)) { |
| 315 | - return ; |
|
| 315 | + return; |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | if (is_array($arguments)) { |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | return $value; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - if ($value[0] != '%' || $value[strlen($value) - 1] != '%') { |
|
| 343 | + if ($value[0] != '%' || $value[strlen($value) - 1] != '%') { |
|
| 344 | 344 | return $value; |
| 345 | 345 | } |
| 346 | 346 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function setAllowedMethods($methods) |
| 72 | 72 | { |
| 73 | - $this->allowedMethods = array_map(function ($method) { |
|
| 73 | + $this->allowedMethods = array_map(function($method) { |
|
| 74 | 74 | return strtoupper($method); |
| 75 | 75 | }, $methods); |
| 76 | 76 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function hasBodyParameters() |
| 98 | 98 | { |
| 99 | - return (boolean) count($this->request); |
|
| 99 | + return (boolean)count($this->request); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function hasQueryParameters() |
| 122 | 122 | { |
| 123 | - return (boolean) count($this->query); |
|
| 123 | + return (boolean)count($this->query); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function hasHeaders() |
| 146 | 146 | { |
| 147 | - return (boolean) count($this->headers); |
|
| 147 | + return (boolean)count($this->headers); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function removeService($id) |
| 68 | 68 | { |
| 69 | - if ($this->hasService($id)){ |
|
| 69 | + if ($this->hasService($id)) { |
|
| 70 | 70 | unset($this->serviceDefinitions[$id]); |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function setStaticDefinition($id, \Closure $definition, $tags = []) |
| 97 | 97 | { |
| 98 | - $this->setDefinition($id, function ($container) use ($definition) { |
|
| 98 | + $this->setDefinition($id, function($container) use ($definition) { |
|
| 99 | 99 | static $instance; |
| 100 | 100 | if (!isset($instance)) { |
| 101 | 101 | $instance = $definition($container); |