@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $request = $event->getRequest(); |
| 36 | 36 | $restAttributes = $request->attributes->get('_rest', []); |
| 37 | 37 | |
| 38 | - if (! isset($restAttributes['decode_request']) || ! $restAttributes['decode_request']) { |
|
| 38 | + if (!isset($restAttributes['decode_request']) || !$restAttributes['decode_request']) { |
|
| 39 | 39 | return; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $jsonBody = $request->getContent(false); |
| 57 | 57 | $decodedBody = json_decode($jsonBody, true); |
| 58 | 58 | |
| 59 | - if (! is_array($decodedBody)) { |
|
| 59 | + if (!is_array($decodedBody)) { |
|
| 60 | 60 | $decodedBody = array(); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $this->registerResponseEncoder($app); |
| 25 | 25 | |
| 26 | 26 | $app['dispatcher'] = $app->share( |
| 27 | - $app->extend('dispatcher', function (EventDispatcherInterface $dispatcher) use ($app) { |
|
| 27 | + $app->extend('dispatcher', function(EventDispatcherInterface $dispatcher) use ($app) { |
|
| 28 | 28 | $this->bindResultListeners($app, $dispatcher); |
| 29 | 29 | |
| 30 | 30 | return $dispatcher; |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $app['alchemy_rest.decode_request_content_types'] = array('application/json'); |
| 61 | 61 | |
| 62 | - $app['alchemy_rest.decode_request_listener'] = $app->share(function () use ($app) { |
|
| 62 | + $app['alchemy_rest.decode_request_listener'] = $app->share(function() use ($app) { |
|
| 63 | 63 | return new EventListener\DecodeJsonBodyRequestListener($app['alchemy_rest.content_type_matcher']); |
| 64 | 64 | }); |
| 65 | 65 | |
| 66 | - $app['alchemy_rest.request_decoder'] = $app->protect(function (Request $request) use ($app) { |
|
| 66 | + $app['alchemy_rest.request_decoder'] = $app->protect(function(Request $request) use ($app) { |
|
| 67 | 67 | $app['alchemy_rest.decode_request_listener']->decodeBody($request); |
| 68 | 68 | }); |
| 69 | 69 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | private function registerResponseEncoder(Application $app) |
| 76 | 76 | { |
| 77 | - $app['alchemy_rest.encode_response_listener'] = $app->share(function () use ($app) { |
|
| 77 | + $app['alchemy_rest.encode_response_listener'] = $app->share(function() use ($app) { |
|
| 78 | 78 | return new EventListener\EncodeJsonResponseListener(); |
| 79 | 79 | }); |
| 80 | 80 | } |
@@ -85,22 +85,22 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | private function registerResponseListener(Application $app) |
| 87 | 87 | { |
| 88 | - $app['alchemy_rest.fractal_manager'] = $app->share(function () { |
|
| 88 | + $app['alchemy_rest.fractal_manager'] = $app->share(function() { |
|
| 89 | 89 | return new Manager(); |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | - $app['alchemy_rest.transformers_registry'] = $app->share(function () { |
|
| 92 | + $app['alchemy_rest.transformers_registry'] = $app->share(function() { |
|
| 93 | 93 | return new \Pimple(); |
| 94 | 94 | }); |
| 95 | 95 | |
| 96 | - $app['alchemy_rest.array_transformer'] = $app->share(function () use ($app) { |
|
| 96 | + $app['alchemy_rest.array_transformer'] = $app->share(function() use ($app) { |
|
| 97 | 97 | return new ArrayTransformer( |
| 98 | 98 | $app['alchemy_rest.fractal_manager'], |
| 99 | 99 | $app['alchemy_rest.transformers_registry'] |
| 100 | 100 | ); |
| 101 | 101 | }); |
| 102 | 102 | |
| 103 | - $app['alchemy_rest.transform_response_listener'] = $app->share(function () use ($app) { |
|
| 103 | + $app['alchemy_rest.transform_response_listener'] = $app->share(function() use ($app) { |
|
| 104 | 104 | return new EventListener\TransformResponseListener( |
| 105 | 105 | $app['alchemy_rest.array_transformer'], |
| 106 | 106 | $app['url_generator'] |
@@ -113,19 +113,19 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | private function registerControllerResultListeners(Application $app) |
| 115 | 115 | { |
| 116 | - $this->shareEventListener($app, 'alchemy_rest.transform_success_result_listener', function () { |
|
| 116 | + $this->shareEventListener($app, 'alchemy_rest.transform_success_result_listener', function() { |
|
| 117 | 117 | return new EventListener\SuccessResultListener(); |
| 118 | 118 | }); |
| 119 | 119 | |
| 120 | - $this->shareEventListener($app, 'alchemy_rest.transform_bad_request_listener', function () { |
|
| 120 | + $this->shareEventListener($app, 'alchemy_rest.transform_bad_request_listener', function() { |
|
| 121 | 121 | return new EventListener\BadRequestListener(); |
| 122 | 122 | }); |
| 123 | 123 | |
| 124 | - $this->shareEventListener($app, 'alchemy_rest.transform_request_accepted_listener', function () { |
|
| 124 | + $this->shareEventListener($app, 'alchemy_rest.transform_request_accepted_listener', function() { |
|
| 125 | 125 | return new EventListener\RequestAcceptedListener(); |
| 126 | 126 | }); |
| 127 | 127 | |
| 128 | - $this->shareEventListener($app, 'alchemy_rest.transform_resource_created_listener', function () use ($app) { |
|
| 128 | + $this->shareEventListener($app, 'alchemy_rest.transform_resource_created_listener', function() use ($app) { |
|
| 129 | 129 | return new EventListener\ResourceCreatedListener($app['alchemy_rest.array_transformer']); |
| 130 | 130 | }); |
| 131 | 131 | } |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $app['alchemy_rest.paginate_options.offset_parameter'] = 'offset'; |
| 59 | 59 | $app['alchemy_rest.paginate_options.limit_parameter'] = 'limit'; |
| 60 | - $app['alchemy_rest.paginate_options_factory'] = $app->share(function () use ($app) { |
|
| 60 | + $app['alchemy_rest.paginate_options_factory'] = $app->share(function() use ($app) { |
|
| 61 | 61 | return new PaginationOptionsFactory( |
| 62 | 62 | $app['alchemy_rest.paginate_options.offset_parameter'], |
| 63 | 63 | $app['alchemy_rest.paginate_options.limit_parameter'] |
| 64 | 64 | ); |
| 65 | 65 | }); |
| 66 | 66 | |
| 67 | - $app['alchemy_rest.paginate_request_listener'] = $app->share(function () use ($app) { |
|
| 67 | + $app['alchemy_rest.paginate_request_listener'] = $app->share(function() use ($app) { |
|
| 68 | 68 | return new EventListener\PaginationParamRequestListener($app['alchemy_rest.paginate_options_factory']); |
| 69 | 69 | }); |
| 70 | 70 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $app['alchemy_rest.sort_options.sort_parameter'] = 'sort'; |
| 75 | 75 | $app['alchemy_rest.sort_options.direction_parameter'] = 'dir'; |
| 76 | 76 | $app['alchemy_rest.sort_options.multi_sort_parameter'] = 'sorts'; |
| 77 | - $app['alchemy_rest.sort_options_factory'] = $app->share(function () use ($app) { |
|
| 77 | + $app['alchemy_rest.sort_options_factory'] = $app->share(function() use ($app) { |
|
| 78 | 78 | return new SortOptionsFactory( |
| 79 | 79 | $app['alchemy_rest.sort_options.sort_parameter'], |
| 80 | 80 | $app['alchemy_rest.sort_options.direction_parameter'], |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | ); |
| 83 | 83 | }); |
| 84 | 84 | |
| 85 | - $app['alchemy_rest.sort_request_listener'] = $app->share(function () use ($app) { |
|
| 85 | + $app['alchemy_rest.sort_request_listener'] = $app->share(function() use ($app) { |
|
| 86 | 86 | return new EventListener\SortParamRequestListener($app['alchemy_rest.sort_options_factory']); |
| 87 | 87 | }); |
| 88 | 88 | } |
@@ -91,26 +91,26 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | $app['alchemy_rest.date_parser.timezone'] = 'UTC'; |
| 93 | 93 | $app['alchemy_rest.date_parser.format'] = 'Y-m-d H:i:s'; |
| 94 | - $app['alchemy_rest.date_parser'] = $app->share(function () use ($app) { |
|
| 94 | + $app['alchemy_rest.date_parser'] = $app->share(function() use ($app) { |
|
| 95 | 95 | return new FormatDateParser( |
| 96 | 96 | $app['alchemy_rest.date_parser.timezone'], |
| 97 | 97 | $app['alchemy_rest.date_parser.format'] |
| 98 | 98 | ); |
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | - $app['alchemy_rest.date_request_listener'] = $app->share(function () use ($app) { |
|
| 101 | + $app['alchemy_rest.date_request_listener'] = $app->share(function() use ($app) { |
|
| 102 | 102 | return new EventListener\DateParamRequestListener($app['alchemy_rest.date_parser']); |
| 103 | 103 | }); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | private function registerExceptionListener(Application $app) |
| 107 | 107 | { |
| 108 | - $app['alchemy_rest.exception_transformer'] = $app->share(function () use ($app) { |
|
| 108 | + $app['alchemy_rest.exception_transformer'] = $app->share(function() use ($app) { |
|
| 109 | 109 | return new DefaultExceptionTransformer($app['alchemy_rest.debug']); |
| 110 | 110 | }); |
| 111 | 111 | |
| 112 | 112 | $app['alchemy_rest.exception_handling_content_types'] = array('application/json'); |
| 113 | - $app['alchemy_rest.exception_listener'] = $app->share(function () use ($app) { |
|
| 113 | + $app['alchemy_rest.exception_listener'] = $app->share(function() use ($app) { |
|
| 114 | 114 | return new EventListener\ExceptionListener( |
| 115 | 115 | $app['alchemy_rest.content_type_matcher'], |
| 116 | 116 | $app['alchemy_rest.exception_transformer'], |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | private function registerContentTypeMatcher(Application $app) |
| 123 | 123 | { |
| 124 | - $app['alchemy_rest.negotiator'] = $app->share(function () use ($app) { |
|
| 124 | + $app['alchemy_rest.negotiator'] = $app->share(function() use ($app) { |
|
| 125 | 125 | return new Negotiator(); |
| 126 | 126 | }); |
| 127 | - $app['alchemy_rest.content_type_matcher'] = $app->share(function () use ($app) { |
|
| 127 | + $app['alchemy_rest.content_type_matcher'] = $app->share(function() use ($app) { |
|
| 128 | 128 | return new ContentTypeMatcher($app['alchemy_rest.negotiator']); |
| 129 | 129 | }); |
| 130 | 130 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | private function registerEventSubscribers(Application $app) |
| 136 | 136 | { |
| 137 | 137 | $app['dispatcher'] = $app->share( |
| 138 | - $app->extend('dispatcher', function (EventDispatcherInterface $dispatcher) use ($app) { |
|
| 138 | + $app->extend('dispatcher', function(EventDispatcherInterface $dispatcher) use ($app) { |
|
| 139 | 139 | $this->bindRequestListeners($app, $dispatcher); |
| 140 | 140 | |
| 141 | 141 | // Bind exception |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | protected function loadInternal(array $config, ContainerBuilder $container) |
| 28 | 28 | { |
| 29 | 29 | $loader = new YamlFileLoader($container, new FileLocator( |
| 30 | - __DIR__ . '/../Resources/config' |
|
| 30 | + __DIR__.'/../Resources/config' |
|
| 31 | 31 | )); |
| 32 | 32 | |
| 33 | 33 | $loader->load('services.yml'); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | protected function configureExceptionListener(array $config, ContainerBuilder $container) |
| 47 | 47 | { |
| 48 | - if (! $config['enabled']) { |
|
| 48 | + if (!$config['enabled']) { |
|
| 49 | 49 | $container->removeDefinition('alchemy_rest.exception_listener'); |
| 50 | 50 | |
| 51 | 51 | return; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | protected function configureDateRequestListener(array $config, ContainerBuilder $container) |
| 68 | 68 | { |
| 69 | - if (! $config['dates']['enabled']) { |
|
| 69 | + if (!$config['dates']['enabled']) { |
|
| 70 | 70 | $container->removeDefinition('alchemy_rest.date_request_listener'); |
| 71 | 71 | |
| 72 | 72 | return; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | protected function configureSortRequestListener(array $config, ContainerBuilder $container) |
| 88 | 88 | { |
| 89 | - if (! $config['sort']['enabled']) { |
|
| 89 | + if (!$config['sort']['enabled']) { |
|
| 90 | 90 | $container->removeDefinition('alchemy_rest.sort_request_listener'); |
| 91 | 91 | |
| 92 | 92 | return; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | protected function configurePaginationRequestListener(array $config, ContainerBuilder $container) |
| 108 | 108 | { |
| 109 | - if (! $config['pagination']['enabled']) { |
|
| 109 | + if (!$config['pagination']['enabled']) { |
|
| 110 | 110 | $container->removeDefinition('alchemy_rest.paginate_request_listener'); |
| 111 | 111 | |
| 112 | 112 | return; |