@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ->setAllowedTypes('routing_name_pattern', 'string') |
87 | 87 | ->setAllowedTypes('routing_url_pattern', 'string') |
88 | 88 | ->setAllowedTypes('page_parameter', 'string') |
89 | - ->setNormalizer('routing_name_pattern', function (Options $options, $value) { |
|
89 | + ->setNormalizer('routing_name_pattern', function(Options $options, $value) { |
|
90 | 90 | if (false === strstr($value, '{admin}')) { |
91 | 91 | throw new InvalidOptionsException('Admin routing configuration pattern name should contains the {admin} placeholder'); |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | return $value; |
98 | 98 | }) |
99 | - ->setNormalizer('routing_url_pattern', function (Options $options, $value) { |
|
99 | + ->setNormalizer('routing_url_pattern', function(Options $options, $value) { |
|
100 | 100 | if (false === strstr($value, '{admin}')) { |
101 | 101 | throw new InvalidOptionsException('Admin routing configuration url pattern should contains {admin} placeholder'); |
102 | 102 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | 'pattern' => 'lag.admin.{key}', |
120 | 120 | ]); |
121 | 121 | $resolver->setAllowedTypes('translation', 'array'); |
122 | - $resolver->setNormalizer('translation', function (Options $options, $value) { |
|
122 | + $resolver->setNormalizer('translation', function(Options $options, $value) { |
|
123 | 123 | if (!array_key_exists('enabled', $value)) { |
124 | 124 | throw new InvalidOptionsException('Admin translation enabled parameter should be defined'); |
125 | 125 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | $resolver->setDefault('fields_mapping', $defaultMapping); |
163 | 163 | $resolver->setAllowedTypes('fields_mapping', 'array'); |
164 | - $resolver->setNormalizer('fields_mapping', function (Options $options, $value) use ($defaultMapping) { |
|
164 | + $resolver->setNormalizer('fields_mapping', function(Options $options, $value) use ($defaultMapping) { |
|
165 | 165 | // Merge with default mapping to allow override |
166 | 166 | $value = array_merge($defaultMapping, $value); |
167 | 167 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $resolver->setDefault('fields_template_mapping', $defaultMapping); |
177 | 177 | $resolver->setAllowedTypes('fields_template_mapping', 'array'); |
178 | - $resolver->setNormalizer('fields_template_mapping', function (Options $options, $value) use ($defaultMapping) { |
|
178 | + $resolver->setNormalizer('fields_template_mapping', function(Options $options, $value) use ($defaultMapping) { |
|
179 | 179 | // Merge with default mapping to allow override |
180 | 180 | $value = array_merge($defaultMapping, $value); |
181 | 181 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ->setDefault('items', []) |
54 | 54 | ->setDefault('icon', null) |
55 | 55 | ->setDefault('link_css_class', 'nav-link') |
56 | - ->setNormalizer('admin', function (Options $options, $adminName) { |
|
56 | + ->setNormalizer('admin', function(Options $options, $adminName) { |
|
57 | 57 | // user has to defined either an admin name and an action name, or a route name with optional |
58 | 58 | // parameters, or an url |
59 | 59 | if (null === $adminName |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | return $adminName; |
67 | 67 | }) |
68 | 68 | // if an admin name is set, an action name can provided. This action will be the menu link |
69 | - ->setNormalizer('action', function (Options $options, $action) { |
|
69 | + ->setNormalizer('action', function(Options $options, $action) { |
|
70 | 70 | // if an action name is provided, an admin name should be defined too |
71 | 71 | if (null !== $action && null === $options->offsetGet('admin')) { |
72 | 72 | throw new InvalidOptionsException('You should provide an admin name for this action '.$action); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | return $action; |
81 | 81 | }) |
82 | 82 | ->setAllowedTypes('parameters', 'array') |
83 | - ->setNormalizer('attr', function (Options $options, $attr) { |
|
83 | + ->setNormalizer('attr', function(Options $options, $attr) { |
|
84 | 84 | if (!is_array($attr)) { |
85 | 85 | $attr = []; |
86 | 86 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | return $attr; |
97 | 97 | }) |
98 | - ->setNormalizer('link_attr', function (Options $options, $value) { |
|
98 | + ->setNormalizer('link_attr', function(Options $options, $value) { |
|
99 | 99 | if (!is_array($value)) { |
100 | 100 | $value = []; |
101 | 101 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | return $value; |
108 | 108 | }) |
109 | - ->setNormalizer('items', function (Options $options, $items) { |
|
109 | + ->setNormalizer('items', function(Options $options, $items) { |
|
110 | 110 | if (!is_array($items)) { |
111 | 111 | $items = []; |
112 | 112 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | return $resolvedItems; |
125 | 125 | }) |
126 | - ->setNormalizer('text', function (Options $options, $text) { |
|
126 | + ->setNormalizer('text', function(Options $options, $text) { |
|
127 | 127 | if ($text) { |
128 | 128 | return $text; |
129 | 129 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | private function getFieldsNormalizer() |
151 | 151 | { |
152 | - return function (Options $options, $fields) { |
|
152 | + return function(Options $options, $fields) { |
|
153 | 153 | $normalizedFields = []; |
154 | 154 | |
155 | 155 | foreach ($fields as $name => $field) { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | private function getOrderNormalizer() |
173 | 173 | { |
174 | - return function (Options $options, $order) { |
|
174 | + return function(Options $options, $order) { |
|
175 | 175 | foreach ($order as $field => $sort) { |
176 | 176 | if (!is_string($sort) || !is_string($field) || !in_array(strtolower($sort), ['asc', 'desc'])) { |
177 | 177 | throw new Exception('Order value should be an array of string (["field" => $key]), got '.gettype($sort)); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | private function getLoadStrategyNormalizer() |
192 | 192 | { |
193 | - return function (Options $options, $value) { |
|
193 | + return function(Options $options, $value) { |
|
194 | 194 | if (!$value) { |
195 | 195 | if ('create' == $this->actionName) { |
196 | 196 | $value = LAGAdminBundle::LOAD_STRATEGY_NONE; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | private function getMenuNormalizer() |
215 | 215 | { |
216 | - return function (Options $options, $menus) { |
|
216 | + return function(Options $options, $menus) { |
|
217 | 217 | // set default to an array |
218 | 218 | if (false === $menus) { |
219 | 219 | $menus = []; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | private function getCriteriaNormalizer() |
233 | 233 | { |
234 | - return function (Options $options, $value) { |
|
234 | + return function(Options $options, $value) { |
|
235 | 235 | if (!$value) { |
236 | 236 | $idActions = [ |
237 | 237 | 'edit', |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | private function getFiltersNormalizer(): Closure |
271 | 271 | { |
272 | - return function (Options $options, $data) { |
|
272 | + return function(Options $options, $data) { |
|
273 | 273 | $normalizedData = []; |
274 | 274 | |
275 | 275 | foreach ($data as $name => $field) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | private function getRouteDefaultNormalizer(): Closure |
297 | 297 | { |
298 | - return function (Options $options, $value) { |
|
298 | + return function(Options $options, $value) { |
|
299 | 299 | if (!is_array($value)) { |
300 | 300 | $value = []; |
301 | 301 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | |
309 | 309 | private function getFormNormalizer(): Closure |
310 | 310 | { |
311 | - return function (Options $options, $value) { |
|
311 | + return function(Options $options, $value) { |
|
312 | 312 | if (null !== $value) { |
313 | 313 | return $value; |
314 | 314 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | ->get('translation_pattern') |
338 | 338 | ; |
339 | 339 | |
340 | - return function (Options $options, $value) use ($translationPattern, $translation) { |
|
340 | + return function(Options $options, $value) use ($translationPattern, $translation) { |
|
341 | 341 | if (null === $value) { |
342 | 342 | $value = Container::camelize($this->actionName); |
343 | 343 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | '_self', |
57 | 57 | '_blank', |
58 | 58 | ]) |
59 | - ->setNormalizer('route', function (Options $options, $value) use ($actionConfiguration) { |
|
59 | + ->setNormalizer('route', function(Options $options, $value) use ($actionConfiguration) { |
|
60 | 60 | // route or url should be defined |
61 | 61 | if (!$value && !$options->offsetGet('url') && !$options->offsetGet('admin')) { |
62 | 62 | throw new InvalidOptionsException('Either an url or a route should be defined'); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | return $value; |
74 | 74 | }) |
75 | - ->setNormalizer('admin', function (Options $options, $value) { |
|
75 | + ->setNormalizer('admin', function(Options $options, $value) { |
|
76 | 76 | // if a Admin is defined, an Action should be defined too |
77 | 77 | if ($value && !$options->offsetGet('action')) { |
78 | 78 | throw new InvalidOptionsException('An Action should be provided if an Admin is provided'); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | return $value; |
82 | 82 | }) |
83 | - ->setNormalizer('parameters', function (Options $options, $values) { |
|
83 | + ->setNormalizer('parameters', function(Options $options, $values) { |
|
84 | 84 | $cleanedValues = []; |
85 | 85 | |
86 | 86 | foreach ($values as $name => $method) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | return $cleanedValues; |
94 | 94 | }) |
95 | - ->setNormalizer('text', function (Options $options, $value) use ($actionConfiguration) { |
|
95 | + ->setNormalizer('text', function(Options $options, $value) use ($actionConfiguration) { |
|
96 | 96 | if ($value) { |
97 | 97 | return $value; |
98 | 98 | } |