@@ -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]); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $eventDispatcher |
| 48 | 48 | ->expects($this->exactly(5)) |
| 49 | 49 | ->method('dispatch') |
| 50 | - ->willReturnCallback(function ($eventName, $event) use ($action, $form) { |
|
| 50 | + ->willReturnCallback(function($eventName, $event) use ($action, $form) { |
|
| 51 | 51 | if (AdminEvents::HANDLE_REQUEST === $eventName) { |
| 52 | 52 | /** @var AdminEvent $event */ |
| 53 | 53 | $this->assertInstanceOf(AdminEvent::class, $event); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ); |
| 113 | 113 | $request = new Request(); |
| 114 | 114 | |
| 115 | - $this->assertExceptionRaised(Exception::class, function () use ($admin, $request) { |
|
| 115 | + $this->assertExceptionRaised(Exception::class, function() use ($admin, $request) { |
|
| 116 | 116 | $admin->handleRequest($request); |
| 117 | 117 | }); |
| 118 | 118 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $eventDispatcher |
| 128 | 128 | ->expects($this->once()) |
| 129 | 129 | ->method('dispatch') |
| 130 | - ->willReturnCallback(function ($eventName, $event) use ($view) { |
|
| 130 | + ->willReturnCallback(function($eventName, $event) use ($view) { |
|
| 131 | 131 | $this->assertEquals(AdminEvents::VIEW, $eventName); |
| 132 | 132 | /** @var ViewEvent $event */ |
| 133 | 133 | $this->assertInstanceOf(ViewEvent::class, $event); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $eventDispatcher |
| 179 | 179 | ->expects($this->exactly(4)) |
| 180 | 180 | ->method('dispatch') |
| 181 | - ->willReturnCallback(function ($eventName, $event) use ($action, $form) { |
|
| 181 | + ->willReturnCallback(function($eventName, $event) use ($action, $form) { |
|
| 182 | 182 | if (AdminEvents::HANDLE_REQUEST === $eventName) { |
| 183 | 183 | /** @var AdminEvent $event */ |
| 184 | 184 | $this->assertInstanceOf(AdminEvent::class, $event); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $eventDispatcher |
| 209 | 209 | ->expects($this->exactly(4)) |
| 210 | 210 | ->method('dispatch') |
| 211 | - ->willReturnCallback(function ($eventName, $event) use ($action, $form) { |
|
| 211 | + ->willReturnCallback(function($eventName, $event) use ($action, $form) { |
|
| 212 | 212 | if (AdminEvents::HANDLE_REQUEST === $eventName) { |
| 213 | 213 | /** @var AdminEvent $event */ |
| 214 | 214 | $this->assertInstanceOf(AdminEvent::class, $event); |