@@ -143,7 +143,7 @@ |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
146 | - * @param $name |
|
146 | + * @param string $name |
|
147 | 147 | * @param $type |
148 | 148 | * |
149 | 149 | * @return FieldInterface |
@@ -3,13 +3,11 @@ |
||
3 | 3 | namespace LAG\AdminBundle\Factory; |
4 | 4 | |
5 | 5 | use Exception; |
6 | -use LAG\AdminBundle\Admin\Exception\AdminException; |
|
7 | 6 | use LAG\AdminBundle\Configuration\ActionConfiguration; |
8 | 7 | use LAG\AdminBundle\Configuration\ApplicationConfiguration; |
9 | 8 | use LAG\AdminBundle\Configuration\ApplicationConfigurationStorage; |
10 | 9 | use LAG\AdminBundle\Field\FieldInterface; |
11 | 10 | use LAG\AdminBundle\Field\TwigAwareFieldInterface; |
12 | -use LAG\AdminBundle\Field\TwigAwareInterface; |
|
13 | 11 | use LAG\AdminBundle\Field\TranslatorAwareFieldInterface; |
14 | 12 | use Symfony\Component\OptionsResolver\OptionsResolver; |
15 | 13 | use Symfony\Component\Translation\TranslatorInterface; |
@@ -64,8 +64,8 @@ |
||
64 | 64 | /** |
65 | 65 | * View constructor. |
66 | 66 | * |
67 | - * @param $actionName |
|
68 | - * @param $adminName |
|
67 | + * @param string $actionName |
|
68 | + * @param string $adminName |
|
69 | 69 | * @param ActionConfiguration $configuration |
70 | 70 | * @param AdminConfiguration $adminConfiguration |
71 | 71 | * @param FieldInterface[] $fields |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | ->setAllowedTypes('routing_name_pattern', 'string') |
80 | 80 | ->setAllowedTypes('routing_url_pattern', 'string') |
81 | 81 | ->setAllowedTypes('page_parameter', 'string') |
82 | - ->setNormalizer('routing_name_pattern', function (Options $options, $value) { |
|
82 | + ->setNormalizer('routing_name_pattern', function(Options $options, $value) { |
|
83 | 83 | if (strstr($value, '{admin}') === false) { |
84 | 84 | throw new InvalidOptionsException( |
85 | 85 | 'Admin routing configuration pattern name should contains the {admin} placeholder' |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | return $value; |
95 | 95 | }) |
96 | - ->setNormalizer('routing_url_pattern', function (Options $options, $value) { |
|
96 | + ->setNormalizer('routing_url_pattern', function(Options $options, $value) { |
|
97 | 97 | if (strstr($value, '{admin}') === false) { |
98 | 98 | throw new InvalidOptionsException('Admin routing configuration url pattern should contains {admin} placeholder'); |
99 | 99 | } |
@@ -15,11 +15,11 @@ |
||
15 | 15 | |
16 | 16 | class ActionConfiguration extends Configuration |
17 | 17 | { |
18 | - /** |
|
19 | - * Related Action name. |
|
20 | - * |
|
21 | - * @var string |
|
22 | - */ |
|
18 | + /** |
|
19 | + * Related Action name. |
|
20 | + * |
|
21 | + * @var string |
|
22 | + */ |
|
23 | 23 | private $actionName; |
24 | 24 | |
25 | 25 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function getFieldsNormalizer() |
166 | 166 | { |
167 | - return function (Options $options, $fields) { |
|
167 | + return function(Options $options, $fields) { |
|
168 | 168 | $normalizedFields = []; |
169 | 169 | |
170 | 170 | foreach ($fields as $name => $field) { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | private function getOrderNormalizer() |
189 | 189 | { |
190 | - return function (Options $options, $order) { |
|
190 | + return function(Options $options, $order) { |
|
191 | 191 | foreach ($order as $field => $sort) { |
192 | 192 | |
193 | 193 | if (!is_string($sort) || !is_string($field) || !in_array(strtolower($sort), ['asc', 'desc'])) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | private function getLoadStrategyNormalizer() |
213 | 213 | { |
214 | - return function (Options $options, $value) { |
|
214 | + return function(Options $options, $value) { |
|
215 | 215 | if (!$value) { |
216 | 216 | if ($this->actionName == 'create') { |
217 | 217 | $value = LAGAdminBundle::LOAD_STRATEGY_NONE; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | private function getMenuNormalizer() |
236 | 236 | { |
237 | - return function (Options $options, $menus) { |
|
237 | + return function(Options $options, $menus) { |
|
238 | 238 | // set default to an array |
239 | 239 | if ($menus === false) { |
240 | 240 | $menus = []; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | private function getCriteriaNormalizer() |
254 | 254 | { |
255 | - return function (Options $options, $value) { |
|
255 | + return function(Options $options, $value) { |
|
256 | 256 | if (!$value) { |
257 | 257 | $idActions = [ |
258 | 258 | 'edit', |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | */ |
302 | 302 | private function getFiltersNormalizer() |
303 | 303 | { |
304 | - return function (Options $options, $data) { |
|
304 | + return function(Options $options, $data) { |
|
305 | 305 | $normalizedData = []; |
306 | 306 | |
307 | 307 | foreach ($data as $name => $field) { |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | private function getRouteDefaultNormalizer() |
329 | 329 | { |
330 | - return function (Options $options, $value) { |
|
330 | + return function(Options $options, $value) { |
|
331 | 331 | if (!is_array($value)) { |
332 | 332 | $value = []; |
333 | 333 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | null, |
77 | 77 | 'pagerfanta', |
78 | 78 | ]) |
79 | - ->setNormalizer('actions', function (Options $options, $actions) { |
|
79 | + ->setNormalizer('actions', function(Options $options, $actions) { |
|
80 | 80 | $normalizedActions = []; |
81 | 81 | $addBatchAction = false; |
82 | 82 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | '_self', |
47 | 47 | '_blank', |
48 | 48 | ]) |
49 | - ->setNormalizer('route', function (Options $options, $value) use ($actionConfiguration) { |
|
49 | + ->setNormalizer('route', function(Options $options, $value) use ($actionConfiguration) { |
|
50 | 50 | // route or url should be defined |
51 | 51 | if (!$value && !$options->offsetGet('url') && !$options->offsetGet('admin')) { |
52 | 52 | throw new InvalidOptionsException( |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | return $value; |
66 | 66 | }) |
67 | - ->setNormalizer('admin', function (Options $options, $value) { |
|
67 | + ->setNormalizer('admin', function(Options $options, $value) { |
|
68 | 68 | // if a Admin is defined, an Action should be defined too |
69 | 69 | if ($value && !$options->offsetGet('action')) { |
70 | 70 | throw new InvalidOptionsException( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | return $value; |
76 | 76 | }) |
77 | - ->setNormalizer('parameters', function (Options $options, $values) { |
|
77 | + ->setNormalizer('parameters', function(Options $options, $values) { |
|
78 | 78 | $cleanedValues = []; |
79 | 79 | |
80 | 80 | foreach ($values as $name => $method) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | 'copy' => [], |
19 | 19 | ]; |
20 | 20 | $eventDispatcher = new EventDispatcher(); |
21 | -$eventDispatcher->addListener(NotificationEvent::NAME, function (NotificationEvent $event) { |
|
21 | +$eventDispatcher->addListener(NotificationEvent::NAME, function(NotificationEvent $event) { |
|
22 | 22 | echo $event->getMessage()."\n"; |
23 | 23 | }); |
24 | 24 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $builder = new TaskBuilder(); |
69 | 69 | $tasks = $builder->build($tasks); |
70 | 70 | |
71 | -$normalizer = new Normalizer(realpath(__DIR__ . '/AdminBundle')); |
|
71 | +$normalizer = new Normalizer(realpath(__DIR__.'/AdminBundle')); |
|
72 | 72 | $locator = new Locator($normalizer); |
73 | 73 | |
74 | 74 | $runner = new TaskRunner( |
@@ -135,12 +135,10 @@ |
||
135 | 135 | |
136 | 136 | if (LAGAdminBundle::LOAD_STRATEGY_NONE === $strategy) { |
137 | 137 | return; |
138 | - } |
|
139 | - else if (LAGAdminBundle::LOAD_STRATEGY_MULTIPLE === $strategy) { |
|
138 | + } else if (LAGAdminBundle::LOAD_STRATEGY_MULTIPLE === $strategy) { |
|
140 | 139 | $entities = $dataProvider->getCollection($admin, $event->getFilters()); |
141 | 140 | $event->setEntities($entities); |
142 | - } |
|
143 | - else if (LAGAdminBundle::LOAD_STRATEGY_UNIQUE === $strategy) { |
|
141 | + } else if (LAGAdminBundle::LOAD_STRATEGY_UNIQUE === $strategy) { |
|
144 | 142 | $requirements = $actionConfiguration->getParameter('route_requirements'); |
145 | 143 | $identifier = null; |
146 | 144 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | $resourceCollection |
17 | 17 | ->expects($this->once()) |
18 | 18 | ->method('addMethodCall') |
19 | - ->willReturnCallback(function ($name, $parameters) { |
|
19 | + ->willReturnCallback(function($name, $parameters) { |
|
20 | 20 | $this->assertEquals('add', $name); |
21 | 21 | $this->assertCount(1, $parameters); |
22 | 22 | $this->assertInstanceOf(Reference::class, $parameters[0]); |