@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public function __invoke($transformerKey, $isList) |
10 | 10 | { |
11 | - return function (Request $request) use ($transformerKey, $isList) { |
|
11 | + return function(Request $request) use ($transformerKey, $isList) { |
|
12 | 12 | $restAttribute = $request->attributes->get('_rest', array()); |
13 | 13 | |
14 | 14 | $restAttribute['transform'] = $transformerKey; |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | $this->registerTransformListener($app); |
54 | 54 | |
55 | 55 | $app['alchemy_rest.decode_request_content_types'] = array('application/json'); |
56 | - $app['alchemy_rest.decode_request_listener'] = $app->share(function () use ($app) { |
|
56 | + $app['alchemy_rest.decode_request_listener'] = $app->share(function() use ($app) { |
|
57 | 57 | return new DecodeJsonBodyRequestListener($app['alchemy_rest.content_type_matcher']); |
58 | 58 | }); |
59 | 59 | |
60 | - $app['alchemy_rest.request_decoder'] = $app->protect(function (Request $request) use ($app) { |
|
60 | + $app['alchemy_rest.request_decoder'] = $app->protect(function(Request $request) use ($app) { |
|
61 | 61 | $app['alchemy_rest.decode_request_listener']->decodeBody($request); |
62 | 62 | }); |
63 | 63 | |
64 | - $app['alchemy_rest.encode_response_listener'] = $app->share(function () use ($app) { |
|
64 | + $app['alchemy_rest.encode_response_listener'] = $app->share(function() use ($app) { |
|
65 | 65 | return new EncodeJsonResponseListener(); |
66 | 66 | }); |
67 | 67 | |
68 | 68 | $this->registerMiddlewareFactories($app); |
69 | 69 | |
70 | 70 | $app['dispatcher'] = $app->share( |
71 | - $app->extend('dispatcher', function (EventDispatcherInterface $dispatcher) use ($app) { |
|
71 | + $app->extend('dispatcher', function(EventDispatcherInterface $dispatcher) use ($app) { |
|
72 | 72 | $this->bindRequestListeners($app, $dispatcher); |
73 | 73 | $this->bindResultListeners($app, $dispatcher); |
74 | 74 | |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | |
107 | 107 | private function registerMiddlewareFactories(Application $app) |
108 | 108 | { |
109 | - $app['alchemy_rest.middleware.parse_date_params'] = $app->share(function () { |
|
109 | + $app['alchemy_rest.middleware.parse_date_params'] = $app->share(function() { |
|
110 | 110 | return new SetDateAttributesMiddlewareFactory(); |
111 | 111 | }); |
112 | 112 | |
113 | - $app['alchemy_rest.middleware.parse_list_params'] = $app->share(function () { |
|
113 | + $app['alchemy_rest.middleware.parse_list_params'] = $app->share(function() { |
|
114 | 114 | return new SetPaginationAndSortAttributesMiddlewareFactory(); |
115 | 115 | }); |
116 | 116 | |
117 | - $app['alchemy_rest.middleware.transform_response'] = $app->share(function () { |
|
117 | + $app['alchemy_rest.middleware.transform_response'] = $app->share(function() { |
|
118 | 118 | return new SetTransformAttributeMiddlewareFactory(); |
119 | 119 | }); |
120 | 120 | |
121 | - $app['alchemy_rest.middleware.json_encoder'] = $app->share(function () { |
|
121 | + $app['alchemy_rest.middleware.json_encoder'] = $app->share(function() { |
|
122 | 122 | return new SetEncodingAttributeMiddlewareFactory(); |
123 | 123 | }); |
124 | 124 | } |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | { |
128 | 128 | $app['alchemy_rest.paginate_options.offset_parameter'] = 'offset'; |
129 | 129 | $app['alchemy_rest.paginate_options.limit_parameter'] = 'limit'; |
130 | - $app['alchemy_rest.paginate_options_factory'] = $app->share(function () use ($app) { |
|
130 | + $app['alchemy_rest.paginate_options_factory'] = $app->share(function() use ($app) { |
|
131 | 131 | return new PaginationOptionsFactory( |
132 | 132 | $app['alchemy_rest.paginate_options.offset_parameter'], |
133 | 133 | $app['alchemy_rest.paginate_options.limit_parameter'] |
134 | 134 | ); |
135 | 135 | }); |
136 | 136 | |
137 | - $app['alchemy_rest.paginate_request_listener'] = $app->share(function () use ($app) { |
|
137 | + $app['alchemy_rest.paginate_request_listener'] = $app->share(function() use ($app) { |
|
138 | 138 | return new PaginationParamRequestListener($app['alchemy_rest.paginate_options_factory']); |
139 | 139 | }); |
140 | 140 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $app['alchemy_rest.sort_options.sort_parameter'] = 'sort'; |
145 | 145 | $app['alchemy_rest.sort_options.direction_parameter'] = 'dir'; |
146 | 146 | $app['alchemy_rest.sort_options.multi_sort_parameter'] = 'sorts'; |
147 | - $app['alchemy_rest.sort_options_factory'] = $app->share(function () use ($app) { |
|
147 | + $app['alchemy_rest.sort_options_factory'] = $app->share(function() use ($app) { |
|
148 | 148 | return new SortOptionsFactory( |
149 | 149 | $app['alchemy_rest.sort_options.sort_parameter'], |
150 | 150 | $app['alchemy_rest.sort_options.direction_parameter'], |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | ); |
153 | 153 | }); |
154 | 154 | |
155 | - $app['alchemy_rest.sort_request_listener'] = $app->share(function () use ($app) { |
|
155 | + $app['alchemy_rest.sort_request_listener'] = $app->share(function() use ($app) { |
|
156 | 156 | return new SortParamRequestListener($app['alchemy_rest.sort_options_factory']); |
157 | 157 | }); |
158 | 158 | } |
@@ -161,26 +161,26 @@ discard block |
||
161 | 161 | { |
162 | 162 | $app['alchemy_rest.date_parser.timezone'] = 'UTC'; |
163 | 163 | $app['alchemy_rest.date_parser.format'] = 'Y-m-d H:i:s'; |
164 | - $app['alchemy_rest.date_parser'] = $app->share(function () use ($app) { |
|
164 | + $app['alchemy_rest.date_parser'] = $app->share(function() use ($app) { |
|
165 | 165 | return new FormatDateParser( |
166 | 166 | $app['alchemy_rest.date_parser.timezone'], |
167 | 167 | $app['alchemy_rest.date_parser.format'] |
168 | 168 | ); |
169 | 169 | }); |
170 | 170 | |
171 | - $app['alchemy_rest.date_request_listener'] = $app->share(function () use ($app) { |
|
171 | + $app['alchemy_rest.date_request_listener'] = $app->share(function() use ($app) { |
|
172 | 172 | return new DateParamRequestListener($app['alchemy_rest.date_parser']); |
173 | 173 | }); |
174 | 174 | } |
175 | 175 | |
176 | 176 | private function registerExceptionListener(Application $app) |
177 | 177 | { |
178 | - $app['alchemy_rest.exception_transformer'] = $app->share(function () use ($app) { |
|
178 | + $app['alchemy_rest.exception_transformer'] = $app->share(function() use ($app) { |
|
179 | 179 | return new DefaultExceptionTransformer($app['alchemy_rest.debug']); |
180 | 180 | }); |
181 | 181 | |
182 | 182 | $app['alchemy_rest.exception_handling_content_types'] = array('application/json'); |
183 | - $app['alchemy_rest.exception_listener'] = $app->share(function () use ($app) { |
|
183 | + $app['alchemy_rest.exception_listener'] = $app->share(function() use ($app) { |
|
184 | 184 | return new ExceptionListener( |
185 | 185 | $app['alchemy_rest.content_type_matcher'], |
186 | 186 | $app['alchemy_rest.exception_transformer'], |
@@ -191,37 +191,37 @@ discard block |
||
191 | 191 | |
192 | 192 | private function registerTransformListener(Application $app) |
193 | 193 | { |
194 | - $app['alchemy_rest.fractal_manager'] = $app->share(function () { |
|
194 | + $app['alchemy_rest.fractal_manager'] = $app->share(function() { |
|
195 | 195 | return new Manager(); |
196 | 196 | }); |
197 | 197 | |
198 | - $app['alchemy_rest.transformers_registry'] = $app->share(function () { |
|
198 | + $app['alchemy_rest.transformers_registry'] = $app->share(function() { |
|
199 | 199 | return new Pimple(); |
200 | 200 | }); |
201 | - $app['alchemy_rest.array_transformer'] = $app->share(function () use ($app) { |
|
201 | + $app['alchemy_rest.array_transformer'] = $app->share(function() use ($app) { |
|
202 | 202 | return new ArrayTransformer( |
203 | 203 | $app['alchemy_rest.fractal_manager'], |
204 | 204 | $app['alchemy_rest.transformers_registry'] |
205 | 205 | ); |
206 | 206 | }); |
207 | 207 | |
208 | - $app['alchemy_rest.transform_bad_request_listener'] = $app->share(function () { |
|
208 | + $app['alchemy_rest.transform_bad_request_listener'] = $app->share(function() { |
|
209 | 209 | return new BadRequestListener(); |
210 | 210 | }); |
211 | 211 | |
212 | - $app['alchemy_rest.transform_request_accepted_listener'] = $app->share(function () { |
|
212 | + $app['alchemy_rest.transform_request_accepted_listener'] = $app->share(function() { |
|
213 | 213 | return new RequestAcceptedListener(); |
214 | 214 | }); |
215 | 215 | |
216 | - $app['alchemy_rest.transform_resource_created_listener'] = $app->share(function () use ($app) { |
|
216 | + $app['alchemy_rest.transform_resource_created_listener'] = $app->share(function() use ($app) { |
|
217 | 217 | return new ResourceCreatedListener($app['alchemy_rest.array_transformer']); |
218 | 218 | }); |
219 | 219 | |
220 | - $app['alchemy_rest.transform_success_result_listener'] = $app->share(function () { |
|
220 | + $app['alchemy_rest.transform_success_result_listener'] = $app->share(function() { |
|
221 | 221 | return new SuccessResultListener(); |
222 | 222 | }); |
223 | 223 | |
224 | - $app['alchemy_rest.transform_response_listener'] = $app->share(function () use ($app) { |
|
224 | + $app['alchemy_rest.transform_response_listener'] = $app->share(function() use ($app) { |
|
225 | 225 | return new TransformResponseListener( |
226 | 226 | $app['alchemy_rest.array_transformer'], |
227 | 227 | $app['url_generator'] |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | |
232 | 232 | private function registerContentTypeMatcher(Application $app) |
233 | 233 | { |
234 | - $app['alchemy_rest.negotiator'] = $app->share(function () use ($app) { |
|
234 | + $app['alchemy_rest.negotiator'] = $app->share(function() use ($app) { |
|
235 | 235 | return new Negotiator(); |
236 | 236 | }); |
237 | - $app['alchemy_rest.content_type_matcher'] = $app->share(function () use ($app) { |
|
237 | + $app['alchemy_rest.content_type_matcher'] = $app->share(function() use ($app) { |
|
238 | 238 | return new ContentTypeMatcher($app['alchemy_rest.negotiator']); |
239 | 239 | }); |
240 | 240 | } |