@@ -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; |
@@ -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 | } |
@@ -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) { |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | $value = $this->options['map'][$value]; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - return (string)$value; |
|
| 29 | + return (string) $value; |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -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( |
@@ -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); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $eventDispatcher |
| 35 | 35 | ->expects($this->once()) |
| 36 | 36 | ->method('dispatch') |
| 37 | - ->willReturnCallback(function ($eventName, $event) { |
|
| 37 | + ->willReturnCallback(function($eventName, $event) { |
|
| 38 | 38 | $this->assertEquals(AdminEvents::MENU, $eventName); |
| 39 | 39 | $this->assertInstanceOf(MenuEvent::class, $event); |
| 40 | 40 | }) |