@@ -27,6 +27,6 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public static function getExtendedTypes(): iterable |
| 29 | 29 | { |
| 30 | - return [ProductType::class]; |
|
| 30 | + return [ ProductType::class ]; |
|
| 31 | 31 | } |
| 32 | 32 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | 'label' => 'odiseo_sylius_vendor_plugin.form.vendor.email', |
| 41 | 41 | ]) |
| 42 | 42 | ->add('logoFile', FileType::class, [ |
| 43 | - 'label' => 'odiseo_sylius_vendor_plugin.form.vendor.logo', |
|
| 43 | + 'label' => 'odiseo_sylius_vendor_plugin.form.vendor.logo', |
|
| 44 | 44 | ]) |
| 45 | 45 | ->add('channels', ChannelChoiceType::class, [ |
| 46 | 46 | 'required' => false, |
@@ -71,12 +71,12 @@ |
||
| 71 | 71 | parent::configureOptions($resolver); |
| 72 | 72 | |
| 73 | 73 | $resolver->setDefaults([ |
| 74 | - 'validation_groups' => function (FormInterface $form): array { |
|
| 74 | + 'validation_groups' => function(FormInterface $form): array { |
|
| 75 | 75 | /** @var VendorInterface|null $vendor */ |
| 76 | 76 | $vendor = $form->getData(); |
| 77 | 77 | |
| 78 | 78 | if (!$vendor instanceof VendorInterface || null === $vendor->getId()) { |
| 79 | - return array_merge($this->validationGroups, ['odiseo_logo_create']); |
|
| 79 | + return array_merge($this->validationGroups, [ 'odiseo_logo_create' ]); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | return $this->validationGroups; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function buildForm(FormBuilderInterface $builder, array $options): void |
| 30 | 30 | { |
| 31 | - if ($options['multiple']) { |
|
| 31 | + if ($options[ 'multiple' ]) { |
|
| 32 | 32 | $builder->addModelTransformer(new CollectionToArrayTransformer()); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function configureOptions(OptionsResolver $resolver): void |
| 40 | 40 | { |
| 41 | - $criteria = []; |
|
| 42 | - $orderBy = ['name' => 'ASC']; |
|
| 41 | + $criteria = [ ]; |
|
| 42 | + $orderBy = [ 'name' => 'ASC' ]; |
|
| 43 | 43 | |
| 44 | 44 | $resolver->setDefaults([ |
| 45 | - 'choices' => function (Options $options) use ($criteria, $orderBy): array { |
|
| 45 | + 'choices' => function(Options $options) use ($criteria, $orderBy): array { |
|
| 46 | 46 | $vendors = $this->vendorRepository->findBy($criteria, $orderBy); |
| 47 | 47 | |
| 48 | - $choices = []; |
|
| 48 | + $choices = [ ]; |
|
| 49 | 49 | /** @var VendorInterface $vendor */ |
| 50 | 50 | foreach ($vendors as $vendor) { |
| 51 | - $choices[$vendor->getName()] = $vendor; |
|
| 51 | + $choices[ $vendor->getName() ] = $vendor; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | return $choices; |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | $this->setEmail('[email protected]'); |
| 94 | 94 | $this->getEmail()->shouldReturn('[email protected]'); |
| 95 | 95 | |
| 96 | - $file = new File(__DIR__ . '/VendorSpec.php'); |
|
| 96 | + $file = new File(__DIR__.'/VendorSpec.php'); |
|
| 97 | 97 | $this->setLogoFile($file); |
| 98 | 98 | $this->getLogoFile()->shouldReturn($file); |
| 99 | 99 | |
@@ -49,6 +49,6 @@ |
||
| 49 | 49 | function it_allows_access_via_properties(): void |
| 50 | 50 | { |
| 51 | 51 | $this->setDescription('Vendor description'); |
| 52 | - $this->getDescription()->shouldReturn('Vendor description');; |
|
| 52 | + $this->getDescription()->shouldReturn('Vendor description'); ; |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -132,14 +132,14 @@ |
||
| 132 | 132 | 'inversedBy' => $inversedBy, |
| 133 | 133 | 'joinTable' => [ |
| 134 | 134 | 'name' => 'odiseo_vendor_'.$inversedBy, |
| 135 | - 'joinColumns' => [[ |
|
| 135 | + 'joinColumns' => [ [ |
|
| 136 | 136 | 'name' => $joinColumn, |
| 137 | 137 | 'referencedColumnName' => 'id' |
| 138 | - ]], |
|
| 139 | - 'inverseJoinColumns' => [[ |
|
| 138 | + ] ], |
|
| 139 | + 'inverseJoinColumns' => [ [ |
|
| 140 | 140 | 'name' => 'vendor_id', |
| 141 | 141 | 'referencedColumnName' => 'id' |
| 142 | - ]], |
|
| 142 | + ] ], |
|
| 143 | 143 | ] |
| 144 | 144 | ]); |
| 145 | 145 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $item = $menu; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - $item->addChild('vendors', ['route' => 'odiseo_sylius_vendor_plugin_admin_vendor_index']) |
|
| 25 | + $item->addChild('vendors', [ 'route' => 'odiseo_sylius_vendor_plugin_admin_vendor_index' ]) |
|
| 26 | 26 | ->setLabel('odiseo_sylius_vendor_plugin.menu.admin.vendors') |
| 27 | 27 | ->setLabelAttribute('icon', 'trademark') |
| 28 | 28 | ; |
@@ -64,33 +64,33 @@ discard block |
||
| 64 | 64 | /** |
| 65 | 65 | * {@inheritdoc} |
| 66 | 66 | */ |
| 67 | - public function create(array $options = []): VendorInterface |
|
| 67 | + public function create(array $options = [ ]): VendorInterface |
|
| 68 | 68 | { |
| 69 | 69 | $options = $this->optionsResolver->resolve($options); |
| 70 | 70 | |
| 71 | 71 | /** @var VendorInterface $vendor */ |
| 72 | 72 | $vendor = $this->vendorFactory->createNew(); |
| 73 | - $vendor->setName($options['name']); |
|
| 74 | - $vendor->setEmail($options['email']); |
|
| 73 | + $vendor->setName($options[ 'name' ]); |
|
| 74 | + $vendor->setEmail($options[ 'email' ]); |
|
| 75 | 75 | |
| 76 | 76 | /** @var string $localeCode */ |
| 77 | 77 | foreach ($this->getLocales() as $localeCode) { |
| 78 | 78 | $vendor->setCurrentLocale($localeCode); |
| 79 | 79 | $vendor->setFallbackLocale($localeCode); |
| 80 | 80 | |
| 81 | - $vendor->setDescription($options['description']); |
|
| 82 | - $vendor->setSlug($options['slug']); |
|
| 81 | + $vendor->setDescription($options[ 'description' ]); |
|
| 82 | + $vendor->setSlug($options[ 'slug' ]); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - foreach ($options['channels'] as $channel) { |
|
| 85 | + foreach ($options[ 'channels' ] as $channel) { |
|
| 86 | 86 | $vendor->addChannel($channel); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - foreach ($options['products'] as $product) { |
|
| 89 | + foreach ($options[ 'products' ] as $product) { |
|
| 90 | 90 | $vendor->addProduct($product); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $vendor->setLogoFile($this->createImage($options['logo'])); |
|
| 93 | + $vendor->setLogoFile($this->createImage($options[ 'logo' ])); |
|
| 94 | 94 | |
| 95 | 95 | return $vendor; |
| 96 | 96 | } |
@@ -129,27 +129,27 @@ discard block |
||
| 129 | 129 | ->setNormalizer('products', LazyOption::findBy($this->productRepository, 'code')) |
| 130 | 130 | ->setRequired('name') |
| 131 | 131 | ->setAllowedTypes('name', 'string') |
| 132 | - ->setDefault('name', function (Options $options): string { |
|
| 132 | + ->setDefault('name', function(Options $options): string { |
|
| 133 | 133 | return $this->faker->company; |
| 134 | 134 | }) |
| 135 | 135 | ->setRequired('slug') |
| 136 | 136 | ->setAllowedTypes('slug', 'string') |
| 137 | - ->setDefault('slug', function (Options $options): string { |
|
| 138 | - return StringInflector::nameToCode((string) $options['name']); |
|
| 137 | + ->setDefault('slug', function(Options $options): string { |
|
| 138 | + return StringInflector::nameToCode((string) $options[ 'name' ]); |
|
| 139 | 139 | }) |
| 140 | 140 | ->setRequired('email') |
| 141 | 141 | ->setAllowedTypes('email', 'string') |
| 142 | - ->setDefault('email', function (Options $options): string { |
|
| 142 | + ->setDefault('email', function(Options $options): string { |
|
| 143 | 143 | return $this->faker->companyEmail; |
| 144 | 144 | }) |
| 145 | 145 | ->setRequired('logo') |
| 146 | 146 | ->setAllowedTypes('logo', 'string') |
| 147 | - ->setDefault('logo', function (Options $options): string { |
|
| 147 | + ->setDefault('logo', function(Options $options): string { |
|
| 148 | 148 | return __DIR__.'/../../Resources/fixtures/vendor/images/0'.rand(1, 3).'.png'; |
| 149 | 149 | }) |
| 150 | 150 | ->setRequired('description') |
| 151 | 151 | ->setAllowedTypes('description', 'string') |
| 152 | - ->setDefault('description', function (Options $options): string { |
|
| 152 | + ->setDefault('description', function(Options $options): string { |
|
| 153 | 153 | return $this->faker->text; |
| 154 | 154 | }) |
| 155 | 155 | ; |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | $this->eventDispatcher = $eventDispatcher; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function createMenu(array $options = []): ItemInterface |
|
| 27 | + public function createMenu(array $options = [ ]): ItemInterface |
|
| 28 | 28 | { |
| 29 | 29 | $menu = $this->factory->createItem('root'); |
| 30 | 30 | |
| 31 | - if (!array_key_exists('vendor', $options) || !$options['vendor'] instanceof VendorInterface) { |
|
| 31 | + if (!array_key_exists('vendor', $options) || !$options[ 'vendor' ] instanceof VendorInterface) { |
|
| 32 | 32 | return $menu; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | ; |
| 53 | 53 | |
| 54 | 54 | $this->eventDispatcher->dispatch( |
| 55 | - new VendorFormMenuBuilderEvent($this->factory, $menu, $options['vendor']) |
|
| 55 | + new VendorFormMenuBuilderEvent($this->factory, $menu, $options[ 'vendor' ]) |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | return $menu; |