@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | private function getFieldsNormalizer() |
| 160 | 160 | { |
| 161 | - return function (Options $options, $fields) { |
|
| 161 | + return function(Options $options, $fields) { |
|
| 162 | 162 | $normalizedFields = []; |
| 163 | 163 | |
| 164 | 164 | foreach ($fields as $name => $field) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | private function getOrderNormalizer() |
| 182 | 182 | { |
| 183 | - return function (Options $options, $order) { |
|
| 183 | + return function(Options $options, $order) { |
|
| 184 | 184 | foreach ($order as $field => $sort) { |
| 185 | 185 | if (!is_string($sort) || !is_string($field) || !in_array(strtolower($sort), ['asc', 'desc'])) { |
| 186 | 186 | throw new Exception( |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | private function getLoadStrategyNormalizer() |
| 205 | 205 | { |
| 206 | - return function (Options $options, $value) { |
|
| 206 | + return function(Options $options, $value) { |
|
| 207 | 207 | if (!$value) { |
| 208 | 208 | if ('create' == $this->actionName) { |
| 209 | 209 | $value = LAGAdminBundle::LOAD_STRATEGY_NONE; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | private function getMenuNormalizer() |
| 228 | 228 | { |
| 229 | - return function (Options $options, $menus) { |
|
| 229 | + return function(Options $options, $menus) { |
|
| 230 | 230 | // set default to an array |
| 231 | 231 | if (false === $menus) { |
| 232 | 232 | $menus = []; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | private function getCriteriaNormalizer() |
| 246 | 246 | { |
| 247 | - return function (Options $options, $value) { |
|
| 247 | + return function(Options $options, $value) { |
|
| 248 | 248 | if (!$value) { |
| 249 | 249 | $idActions = [ |
| 250 | 250 | 'edit', |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | private function getFiltersNormalizer(): Closure |
| 295 | 295 | { |
| 296 | - return function (Options $options, $data) { |
|
| 296 | + return function(Options $options, $data) { |
|
| 297 | 297 | $normalizedData = []; |
| 298 | 298 | |
| 299 | 299 | foreach ($data as $name => $field) { |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | private function getRouteDefaultNormalizer(): Closure |
| 321 | 321 | { |
| 322 | - return function (Options $options, $value) { |
|
| 322 | + return function(Options $options, $value) { |
|
| 323 | 323 | if (!is_array($value)) { |
| 324 | 324 | $value = []; |
| 325 | 325 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | private function getFormNormalizer(): Closure |
| 334 | 334 | { |
| 335 | - return function (Options $options, $value) { |
|
| 335 | + return function(Options $options, $value) { |
|
| 336 | 336 | if (null === $value) { |
| 337 | 337 | $mapping = [ |
| 338 | 338 | 'create' => $this->adminConfiguration->get('form'), |
@@ -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( |
| 92 | 92 | 'Admin routing configuration pattern name should contains the {admin} placeholder' |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | return $value; |
| 102 | 102 | }) |
| 103 | - ->setNormalizer('routing_url_pattern', function (Options $options, $value) { |
|
| 103 | + ->setNormalizer('routing_url_pattern', function(Options $options, $value) { |
|
| 104 | 104 | if (false === strstr($value, '{admin}')) { |
| 105 | 105 | throw new InvalidOptionsException('Admin routing configuration url pattern should contains {admin} placeholder'); |
| 106 | 106 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | 'pattern' => 'lag.admin.{key}', |
| 127 | 127 | ]); |
| 128 | 128 | $resolver->setAllowedTypes('translation', 'array'); |
| 129 | - $resolver->setNormalizer('translation', function (Options $options, $value) { |
|
| 129 | + $resolver->setNormalizer('translation', function(Options $options, $value) { |
|
| 130 | 130 | if (!array_key_exists('enabled', $value)) { |
| 131 | 131 | throw new InvalidOptionsException('Admin translation enabled parameter should be defined'); |
| 132 | 132 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | $resolver->setDefault('fields_mapping', $defaultMapping); |
| 170 | 170 | $resolver->setAllowedTypes('fields_mapping', 'array'); |
| 171 | - $resolver->setNormalizer('fields_mapping', function (Options $options, $value) use ($defaultMapping) { |
|
| 171 | + $resolver->setNormalizer('fields_mapping', function(Options $options, $value) use ($defaultMapping) { |
|
| 172 | 172 | // Merge with default mapping to allow override |
| 173 | 173 | $value = array_merge($defaultMapping, $value); |
| 174 | 174 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $resolver->setDefault('fields_template_mapping', $defaultMapping); |
| 184 | 184 | $resolver->setAllowedTypes('fields_template_mapping', 'array'); |
| 185 | - $resolver->setNormalizer('fields_template_mapping', function (Options $options, $value) use ($defaultMapping) { |
|
| 185 | + $resolver->setNormalizer('fields_template_mapping', function(Options $options, $value) use ($defaultMapping) { |
|
| 186 | 186 | // Merge with default mapping to allow override |
| 187 | 187 | $value = array_merge($defaultMapping, $value); |
| 188 | 188 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | ->setDefault('items', []) |
| 56 | 56 | ->setDefault('icon', null) |
| 57 | 57 | ->setDefault('link_css_class', 'nav-link') |
| 58 | - ->setNormalizer('admin', function (Options $options, $adminName) { |
|
| 58 | + ->setNormalizer('admin', function(Options $options, $adminName) { |
|
| 59 | 59 | // user has to defined either an admin name and an action name, or a route name with optional |
| 60 | 60 | // parameters, or an url |
| 61 | 61 | if (null === $adminName |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return $adminName; |
| 71 | 71 | }) |
| 72 | 72 | // if an admin name is set, an action name can provided. This action will be the menu link |
| 73 | - ->setNormalizer('action', function (Options $options, $action) { |
|
| 73 | + ->setNormalizer('action', function(Options $options, $action) { |
|
| 74 | 74 | // if an action name is provided, an admin name should be defined too |
| 75 | 75 | if (null !== $action && null === $options->offsetGet('admin')) { |
| 76 | 76 | throw new InvalidOptionsException( |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | return $action; |
| 87 | 87 | }) |
| 88 | 88 | ->setAllowedTypes('parameters', 'array') |
| 89 | - ->setNormalizer('attr', function (Options $options, $attr) { |
|
| 89 | + ->setNormalizer('attr', function(Options $options, $attr) { |
|
| 90 | 90 | if (!is_array($attr)) { |
| 91 | 91 | $attr = []; |
| 92 | 92 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | return $attr; |
| 103 | 103 | }) |
| 104 | - ->setNormalizer('link_attr', function (Options $options, $value) { |
|
| 104 | + ->setNormalizer('link_attr', function(Options $options, $value) { |
|
| 105 | 105 | if (!is_array($value)) { |
| 106 | 106 | $value = []; |
| 107 | 107 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | return $value; |
| 114 | 114 | }) |
| 115 | - ->setNormalizer('items', function (Options $options, $items) { |
|
| 115 | + ->setNormalizer('items', function(Options $options, $items) { |
|
| 116 | 116 | if (!is_array($items)) { |
| 117 | 117 | $items = []; |
| 118 | 118 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | return $resolvedItems; |
| 131 | 131 | }) |
| 132 | - ->setNormalizer('text', function (Options $options, $text) { |
|
| 132 | + ->setNormalizer('text', function(Options $options, $text) { |
|
| 133 | 133 | if (!$text) { |
| 134 | 134 | // TODO use translation pattern key instead |
| 135 | 135 | $text = ucfirst($this->name); |