@@ -16,10 +16,10 @@ |
||
| 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 | $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
| 21 | 21 | |
| 22 | - $this->registerResources('odiseo_sylius_vendor', $config['driver'], $config['resources'], $container); |
|
| 22 | + $this->registerResources('odiseo_sylius_vendor', $config[ 'driver' ], $config[ 'resources' ], $container); |
|
| 23 | 23 | |
| 24 | 24 | $configFiles = [ |
| 25 | 25 | 'services.yml', |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | private function addVendorsSubMenu(ItemInterface $menu): void |
| 25 | 25 | { |
| 26 | 26 | $menu |
| 27 | - ->addChild('vendors', ['route' => 'odiseo_sylius_vendor_admin_vendor_index']) |
|
| 27 | + ->addChild('vendors', [ 'route' => 'odiseo_sylius_vendor_admin_vendor_index' ]) |
|
| 28 | 28 | ->setLabel('odiseo_sylius_vendor.ui.vendors') |
| 29 | 29 | ->setLabelAttribute('icon', 'trademark') |
| 30 | 30 | ; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | 'label' => 'odiseo_sylius_vendor.form.vendor.email', |
| 36 | 36 | ]) |
| 37 | 37 | ->add('logoFile', FileType::class, [ |
| 38 | - 'label' => 'odiseo_sylius_vendor.form.vendor.logo', |
|
| 38 | + 'label' => 'odiseo_sylius_vendor.form.vendor.logo', |
|
| 39 | 39 | ]) |
| 40 | 40 | ->add('channels', ChannelChoiceType::class, [ |
| 41 | 41 | 'multiple' => true, |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | ->add('name', TextType::class, [ |
| 25 | 25 | 'label' => 'sylius.ui.name', |
| 26 | 26 | ]) |
| 27 | - ->add('enabled', CheckboxType::class , [ |
|
| 27 | + ->add('enabled', CheckboxType::class, [ |
|
| 28 | 28 | 'label' => 'sylius.ui.enabled', |
| 29 | 29 | ]) |
| 30 | 30 | ->add('translations', ResourceTranslationsType::class, [ |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ->add('email', EmailType::class, [ |
| 35 | 35 | 'label' => 'odiseo_sylius_vendor.form.vendor.email', |
| 36 | 36 | ]) |
| 37 | - ->add('logoFile', FileType::class, [ |
|
| 37 | + ->add('logoFile', FileType::class, [ |
|
| 38 | 38 | 'label' => 'odiseo_sylius_vendor.form.vendor.logo', |
| 39 | 39 | ]) |
| 40 | 40 | ->add('channels', ChannelChoiceType::class, [ |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function buildForm(FormBuilderInterface $builder, array $options): void |
| 33 | 33 | { |
| 34 | - if ($options['multiple']) { |
|
| 34 | + if ($options[ 'multiple' ]) { |
|
| 35 | 35 | $builder->addModelTransformer(new CollectionToArrayTransformer()); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -41,18 +41,18 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function configureOptions(OptionsResolver $resolver) |
| 43 | 43 | { |
| 44 | - $criteria = []; |
|
| 45 | - $orderBy = ['name' => 'ASC']; |
|
| 44 | + $criteria = [ ]; |
|
| 45 | + $orderBy = [ 'name' => 'ASC' ]; |
|
| 46 | 46 | |
| 47 | 47 | $resolver->setDefaults([ |
| 48 | - 'choices' => function (Options $options) use ($criteria, $orderBy): array { |
|
| 48 | + 'choices' => function(Options $options) use ($criteria, $orderBy): array { |
|
| 49 | 49 | $vendors = $this->vendorRepository->findBy($criteria, $orderBy); |
| 50 | 50 | |
| 51 | - $choices = []; |
|
| 51 | + $choices = [ ]; |
|
| 52 | 52 | /** @var VendorInterface $vendor */ |
| 53 | 53 | foreach ($vendors as $vendor) |
| 54 | 54 | { |
| 55 | - $choices[$vendor->getName()] = $vendor; |
|
| 55 | + $choices[ $vendor->getName() ] = $vendor; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return $choices; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function addChannel(ChannelInterface $channel) |
| 152 | 152 | { |
| 153 | - if(!$this->channels->contains($channel)) |
|
| 153 | + if (!$this->channels->contains($channel)) |
|
| 154 | 154 | $this->channels->add($channel); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function removeChannel(ChannelInterface $channel) |
| 161 | 161 | { |
| 162 | - if($this->channels->contains($channel)) |
|
| 162 | + if ($this->channels->contains($channel)) |
|
| 163 | 163 | $this->channels->removeElement($channel); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function addProduct(ProductInterface $product) |
| 186 | 186 | { |
| 187 | - if(!$this->products->contains($product)) |
|
| 187 | + if (!$this->products->contains($product)) |
|
| 188 | 188 | $this->products->add($product); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function removeProduct(ProductInterface $product) |
| 195 | 195 | { |
| 196 | - if($this->products->contains($product)) |
|
| 196 | + if ($this->products->contains($product)) |
|
| 197 | 197 | $this->products->removeElement($product); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | { |
| 205 | 205 | $this->logoFile = $file; |
| 206 | 206 | |
| 207 | - if($file) |
|
| 207 | + if ($file) |
|
| 208 | 208 | { |
| 209 | 209 | $this->setUpdatedAt(new \DateTime()); |
| 210 | 210 | } |
@@ -150,8 +150,9 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function addChannel(ChannelInterface $channel) |
| 152 | 152 | { |
| 153 | - if(!$this->channels->contains($channel)) |
|
| 154 | - $this->channels->add($channel); |
|
| 153 | + if(!$this->channels->contains($channel)) { |
|
| 154 | + $this->channels->add($channel); |
|
| 155 | + } |
|
| 155 | 156 | } |
| 156 | 157 | |
| 157 | 158 | /** |
@@ -159,8 +160,9 @@ discard block |
||
| 159 | 160 | */ |
| 160 | 161 | public function removeChannel(ChannelInterface $channel) |
| 161 | 162 | { |
| 162 | - if($this->channels->contains($channel)) |
|
| 163 | - $this->channels->removeElement($channel); |
|
| 163 | + if($this->channels->contains($channel)) { |
|
| 164 | + $this->channels->removeElement($channel); |
|
| 165 | + } |
|
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | /** |
@@ -184,8 +186,9 @@ discard block |
||
| 184 | 186 | */ |
| 185 | 187 | public function addProduct(ProductInterface $product) |
| 186 | 188 | { |
| 187 | - if(!$this->products->contains($product)) |
|
| 188 | - $this->products->add($product); |
|
| 189 | + if(!$this->products->contains($product)) { |
|
| 190 | + $this->products->add($product); |
|
| 191 | + } |
|
| 189 | 192 | } |
| 190 | 193 | |
| 191 | 194 | /** |
@@ -193,8 +196,9 @@ discard block |
||
| 193 | 196 | */ |
| 194 | 197 | public function removeProduct(ProductInterface $product) |
| 195 | 198 | { |
| 196 | - if($this->products->contains($product)) |
|
| 197 | - $this->products->removeElement($product); |
|
| 199 | + if($this->products->contains($product)) { |
|
| 200 | + $this->products->removeElement($product); |
|
| 201 | + } |
|
| 198 | 202 | } |
| 199 | 203 | |
| 200 | 204 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function addVendor(VendorInterface $vendor) |
| 40 | 40 | { |
| 41 | - if(!$this->vendors->contains($vendor)) { |
|
| 41 | + if (!$this->vendors->contains($vendor)) { |
|
| 42 | 42 | $this->vendors->add($vendor); |
| 43 | 43 | $vendor->addProduct($this); |
| 44 | 44 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function removeVendor(VendorInterface $vendor) |
| 51 | 51 | { |
| 52 | - if($this->vendors->contains($vendor)) { |
|
| 52 | + if ($this->vendors->contains($vendor)) { |
|
| 53 | 53 | $this->vendors->removeElement($vendor); |
| 54 | 54 | $vendor->removeProduct($this); |
| 55 | 55 | } |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | $channels = $this->channelRepository->findAll(); |
| 93 | 93 | |
| 94 | 94 | /** @var ChannelInterface $channel */ |
| 95 | - foreach($channels as $channel) |
|
| 95 | + foreach ($channels as $channel) |
|
| 96 | 96 | { |
| 97 | 97 | $imageIndex = 1; |
| 98 | - for($i=1; $i <= $options['vendors_per_channel']; $i++) |
|
| 98 | + for ($i = 1; $i <= $options[ 'vendors_per_channel' ]; $i++) |
|
| 99 | 99 | { |
| 100 | 100 | /** @var VendorInterface $vendor */ |
| 101 | 101 | $vendor = $this->vendorFactory->createNew(); |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $imageFinder = new Finder(); |
| 115 | - $imagesPath = __DIR__ . '/../Resources/fixtures/vendor'; |
|
| 115 | + $imagesPath = __DIR__.'/../Resources/fixtures/vendor'; |
|
| 116 | 116 | |
| 117 | 117 | foreach ($imageFinder->files()->in($imagesPath)->name('0'.$imageIndex.'.png') as $img) |
| 118 | 118 | { |
| 119 | 119 | $file = new UploadedFile($img->getRealPath(), $img->getFilename()); |
| 120 | 120 | $vendor->setLogoFile($file); |
| 121 | 121 | } |
| 122 | - $imageIndex = $imageIndex>=4?1:$imageIndex+1; |
|
| 122 | + $imageIndex = $imageIndex >= 4 ? 1 : $imageIndex + 1; |
|
| 123 | 123 | |
| 124 | 124 | $this->objectManager->persist($vendor); |
| 125 | 125 | } |