@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function getFunctions(): array |
| 25 | 25 | { |
| 26 | 26 | return [ |
| 27 | - new TwigFunction('banner_slider_name', [$this, 'getBannerSliderName']) |
|
| 27 | + new TwigFunction('banner_slider_name', [ $this, 'getBannerSliderName' ]) |
|
| 28 | 28 | ]; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function load(array $config, ContainerBuilder $container): void |
| 18 | 18 | { |
| 19 | - $config = $this->processConfiguration($this->getConfiguration([], $container), $config); |
|
| 19 | + $config = $this->processConfiguration($this->getConfiguration([ ], $container), $config); |
|
| 20 | 20 | |
| 21 | - $container->setParameter('odiseo_sylius_banner_plugin.slider', $config['slider']); |
|
| 21 | + $container->setParameter('odiseo_sylius_banner_plugin.slider', $config[ 'slider' ]); |
|
| 22 | 22 | |
| 23 | 23 | $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
| 24 | 24 | |
@@ -43,11 +43,11 @@ |
||
| 43 | 43 | parent::configureOptions($resolver); |
| 44 | 44 | |
| 45 | 45 | $resolver->setDefaults([ |
| 46 | - 'validation_groups' => function (FormInterface $form) { |
|
| 46 | + 'validation_groups' => function(FormInterface $form) { |
|
| 47 | 47 | $bannerTranslation = $form->getData(); |
| 48 | 48 | |
| 49 | 49 | if (!$bannerTranslation || null === $bannerTranslation->getId()) { |
| 50 | - return array_merge($this->validationGroups, ['odiseo_image_create']); |
|
| 50 | + return array_merge($this->validationGroups, [ 'odiseo_image_create' ]); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | return $this->validationGroups; |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $item |
| 26 | - ->addChild('banners', ['route' => 'odiseo_sylius_banner_plugin_admin_banner_index']) |
|
| 26 | + ->addChild('banners', [ 'route' => 'odiseo_sylius_banner_plugin_admin_banner_index' ]) |
|
| 27 | 27 | ->setLabel('odiseo_sylius_banner_plugin.menu.admin.banners') |
| 28 | 28 | ->setLabelAttribute('icon', 'image') |
| 29 | 29 | ; |
@@ -113,8 +113,9 @@ |
||
| 113 | 113 | private function createImage(string $imagePath): UploadedFile |
| 114 | 114 | { |
| 115 | 115 | $imagePath = $this->fileLocator === null ? $imagePath : $this->fileLocator->locate($imagePath); |
| 116 | - if(is_array($imagePath) && count($imagePath) > 0) |
|
| 117 | - $imagePath = $imagePath[0]; |
|
| 116 | + if(is_array($imagePath) && count($imagePath) > 0) { |
|
| 117 | + $imagePath = $imagePath[0]; |
|
| 118 | + } |
|
| 118 | 119 | |
| 119 | 120 | return new UploadedFile($imagePath, basename($imagePath)); |
| 120 | 121 | } |
@@ -65,22 +65,22 @@ discard block |
||
| 65 | 65 | ->setAllowedTypes('channels', 'array') |
| 66 | 66 | ->setNormalizer('channels', LazyOption::findBy($this->channelRepository, 'code')) |
| 67 | 67 | |
| 68 | - ->setDefault('image', function (Options $options): string { |
|
| 68 | + ->setDefault('image', function(Options $options): string { |
|
| 69 | 69 | return __DIR__.'/../../Resources/fixtures/banner/images/0'.rand(1, 4).'.png'; |
| 70 | 70 | }) |
| 71 | - ->setAllowedTypes('image', ['string']) |
|
| 71 | + ->setAllowedTypes('image', [ 'string' ]) |
|
| 72 | 72 | |
| 73 | - ->setDefault('mobile_image', function (Options $options): string { |
|
| 73 | + ->setDefault('mobile_image', function(Options $options): string { |
|
| 74 | 74 | return __DIR__.'/../../Resources/fixtures/banner/mobile-images/0'.rand(1, 4).'.png'; |
| 75 | 75 | }) |
| 76 | - ->setAllowedTypes('mobile_image', ['string']) |
|
| 76 | + ->setAllowedTypes('mobile_image', [ 'string' ]) |
|
| 77 | 77 | ; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * {@inheritdoc} |
| 82 | 82 | */ |
| 83 | - public function create(array $options = []): BannerInterface |
|
| 83 | + public function create(array $options = [ ]): BannerInterface |
|
| 84 | 84 | { |
| 85 | 85 | $options = $this->optionsResolver->resolve($options); |
| 86 | 86 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $banner = $this->bannerFactory->createNew(); |
| 89 | 89 | $banner->setCode($this->faker->slug); |
| 90 | 90 | |
| 91 | - foreach ($options['channels'] as $channel) { |
|
| 91 | + foreach ($options[ 'channels' ] as $channel) { |
|
| 92 | 92 | $banner->addChannel($channel); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | $banner->setMainText($this->faker->sentence(4)); |
| 102 | 102 | $banner->setSecondaryText($this->faker->sentence(9)); |
| 103 | 103 | |
| 104 | - $banner->setImageFile($this->createImage($options['image'])); |
|
| 105 | - $banner->setMobileImageFile($this->createImage($options['mobile_image'])); |
|
| 104 | + $banner->setImageFile($this->createImage($options[ 'image' ])); |
|
| 105 | + $banner->setMobileImageFile($this->createImage($options[ 'mobile_image' ])); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $banner; |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | private function createImage(string $imagePath): UploadedFile |
| 116 | 116 | { |
| 117 | 117 | $imagePath = $this->fileLocator === null ? $imagePath : $this->fileLocator->locate($imagePath); |
| 118 | - if(is_array($imagePath) && count($imagePath) > 0) |
|
| 119 | - $imagePath = $imagePath[0]; |
|
| 118 | + if (is_array($imagePath) && count($imagePath) > 0) |
|
| 119 | + $imagePath = $imagePath[ 0 ]; |
|
| 120 | 120 | |
| 121 | 121 | return new UploadedFile($imagePath, basename($imagePath)); |
| 122 | 122 | } |