@@ -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; |
@@ -155,8 +155,9 @@ discard block |
||
| 155 | 155 | if (!$this->channels->contains($channel)) { |
| 156 | 156 | $this->channels->add($channel); |
| 157 | 157 | |
| 158 | - if ($channel instanceof VendorsAwareInterface) |
|
| 159 | - $channel->addVendor($this); |
|
| 158 | + if ($channel instanceof VendorsAwareInterface) { |
|
| 159 | + $channel->addVendor($this); |
|
| 160 | + } |
|
| 160 | 161 | } |
| 161 | 162 | } |
| 162 | 163 | |
@@ -168,8 +169,9 @@ discard block |
||
| 168 | 169 | if ($this->channels->contains($channel)) { |
| 169 | 170 | $this->channels->removeElement($channel); |
| 170 | 171 | |
| 171 | - if ($channel instanceof VendorsAwareInterface) |
|
| 172 | - $channel->removeVendor($this); |
|
| 172 | + if ($channel instanceof VendorsAwareInterface) { |
|
| 173 | + $channel->removeVendor($this); |
|
| 174 | + } |
|
| 173 | 175 | } |
| 174 | 176 | } |
| 175 | 177 | |
@@ -197,8 +199,9 @@ discard block |
||
| 197 | 199 | if (!$this->products->contains($product)) { |
| 198 | 200 | $this->products->add($product); |
| 199 | 201 | |
| 200 | - if ($product instanceof VendorsAwareInterface) |
|
| 201 | - $product->addVendor($this); |
|
| 202 | + if ($product instanceof VendorsAwareInterface) { |
|
| 203 | + $product->addVendor($this); |
|
| 204 | + } |
|
| 202 | 205 | } |
| 203 | 206 | } |
| 204 | 207 | |
@@ -210,8 +213,9 @@ discard block |
||
| 210 | 213 | if ($this->products->contains($product)) { |
| 211 | 214 | $this->products->removeElement($product); |
| 212 | 215 | |
| 213 | - if ($product instanceof VendorsAwareInterface) |
|
| 214 | - $product->removeVendor($this); |
|
| 216 | + if ($product instanceof VendorsAwareInterface) { |
|
| 217 | + $product->removeVendor($this); |
|
| 218 | + } |
|
| 215 | 219 | } |
| 216 | 220 | } |
| 217 | 221 | |
@@ -228,7 +228,7 @@ |
||
| 228 | 228 | { |
| 229 | 229 | $this->logoFile = $file; |
| 230 | 230 | |
| 231 | - if(null !== $file) |
|
| 231 | + if (null !== $file) |
|
| 232 | 232 | { |
| 233 | 233 | $this->setUpdatedAt(new \DateTime()); |
| 234 | 234 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function addVendor(VendorInterface $vendor) |
| 32 | 32 | { |
| 33 | - if(!$this->vendors->contains($vendor)) { |
|
| 33 | + if (!$this->vendors->contains($vendor)) { |
|
| 34 | 34 | $this->vendors->add($vendor); |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function removeVendor(VendorInterface $vendor) |
| 42 | 42 | { |
| 43 | - if($this->vendors->contains($vendor)) { |
|
| 43 | + if ($this->vendors->contains($vendor)) { |
|
| 44 | 44 | $this->vendors->removeElement($vendor); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -114,14 +114,14 @@ |
||
| 114 | 114 | 'inversedBy' => $inversedBy, |
| 115 | 115 | 'joinTable' => [ |
| 116 | 116 | 'name' => 'odiseo_vendors_'.$inversedBy, |
| 117 | - 'joinColumns' => [[ |
|
| 117 | + 'joinColumns' => [ [ |
|
| 118 | 118 | 'name' => $joinColumn, |
| 119 | 119 | 'referencedColumnName' => 'id' |
| 120 | - ]], |
|
| 121 | - 'inverseJoinColumns' => [[ |
|
| 120 | + ] ], |
|
| 121 | + 'inverseJoinColumns' => [ [ |
|
| 122 | 122 | 'name' => 'vendor_id', |
| 123 | 123 | 'referencedColumnName' => 'id' |
| 124 | - ]], |
|
| 124 | + ] ], |
|
| 125 | 125 | ] |
| 126 | 126 | ]); |
| 127 | 127 | } |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function generate(): iterable |
| 59 | 59 | { |
| 60 | - $urls = []; |
|
| 60 | + $urls = [ ]; |
|
| 61 | 61 | |
| 62 | 62 | foreach ($this->getVendors() as $vendor) { |
| 63 | - $urls[] = $this->createVendorUrl($vendor); |
|
| 63 | + $urls[ ] = $this->createVendorUrl($vendor); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return $urls; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | private function getTranslations(VendorInterface $vendor): Collection |
| 70 | 70 | { |
| 71 | - return $vendor->getTranslations()->filter(function (TranslationInterface $translation) { |
|
| 71 | + return $vendor->getTranslations()->filter(function(TranslationInterface $translation) { |
|
| 72 | 72 | return $this->localeInLocaleCodes($translation); |
| 73 | 73 | }); |
| 74 | 74 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /** @var ChannelInterface $channel */ |
| 92 | 92 | $channel = $this->channelContext->getChannel(); |
| 93 | 93 | |
| 94 | - return $channel->getLocales()->map(function (LocaleInterface $locale) { |
|
| 94 | + return $channel->getLocales()->map(function(LocaleInterface $locale) { |
|
| 95 | 95 | return $locale->getCode(); |
| 96 | 96 | })->toArray(); |
| 97 | 97 | } |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | $channels = $this->channelRepository->findAll(); |
| 94 | 94 | |
| 95 | 95 | /** @var ChannelInterface $channel */ |
| 96 | - foreach($channels as $channel) |
|
| 96 | + foreach ($channels as $channel) |
|
| 97 | 97 | { |
| 98 | 98 | $imageIndex = 1; |
| 99 | - for($i=1; $i <= $options['vendors_per_channel']; $i++) |
|
| 99 | + for ($i = 1; $i <= $options[ 'vendors_per_channel' ]; $i++) |
|
| 100 | 100 | { |
| 101 | 101 | /** @var VendorInterface $vendor */ |
| 102 | 102 | $vendor = $this->vendorFactory->createNew(); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $imageFinder = new Finder(); |
| 116 | - $imagesPath = __DIR__ . '/../Resources/fixtures/vendor'; |
|
| 116 | + $imagesPath = __DIR__.'/../Resources/fixtures/vendor'; |
|
| 117 | 117 | |
| 118 | 118 | /** @var File $img */ |
| 119 | 119 | foreach ($imageFinder->files()->in($imagesPath)->name('0'.$imageIndex.'.png') as $img) |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $vendor->setLogoFile($file); |
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | - $imageIndex = $imageIndex>=4?1:$imageIndex+1; |
|
| 126 | + $imageIndex = $imageIndex >= 4 ? 1 : $imageIndex + 1; |
|
| 127 | 127 | |
| 128 | 128 | $this->objectManager->persist($vendor); |
| 129 | 129 | } |