@@ -69,33 +69,33 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * {@inheritdoc} |
71 | 71 | */ |
72 | - public function create(array $options = []): VendorInterface |
|
72 | + public function create(array $options = [ ]): VendorInterface |
|
73 | 73 | { |
74 | 74 | $options = $this->optionsResolver->resolve($options); |
75 | 75 | |
76 | 76 | /** @var VendorInterface $vendor */ |
77 | 77 | $vendor = $this->vendorFactory->createNew(); |
78 | - $vendor->setName($options['name']); |
|
79 | - $vendor->setEmail($options['email']); |
|
78 | + $vendor->setName($options[ 'name' ]); |
|
79 | + $vendor->setEmail($options[ 'email' ]); |
|
80 | 80 | |
81 | 81 | /** @var string $localeCode */ |
82 | 82 | foreach ($this->getLocales() as $localeCode) { |
83 | 83 | $vendor->setCurrentLocale($localeCode); |
84 | 84 | $vendor->setFallbackLocale($localeCode); |
85 | 85 | |
86 | - $vendor->setDescription($options['description']); |
|
87 | - $vendor->setSlug($options['slug']); |
|
86 | + $vendor->setDescription($options[ 'description' ]); |
|
87 | + $vendor->setSlug($options[ 'slug' ]); |
|
88 | 88 | } |
89 | 89 | |
90 | - foreach ($options['channels'] as $channel) { |
|
90 | + foreach ($options[ 'channels' ] as $channel) { |
|
91 | 91 | $vendor->addChannel($channel); |
92 | 92 | } |
93 | 93 | |
94 | - foreach ($options['products'] as $product) { |
|
94 | + foreach ($options[ 'products' ] as $product) { |
|
95 | 95 | $vendor->addProduct($product); |
96 | 96 | } |
97 | 97 | |
98 | - $vendor->setLogoFile($this->createImage($options['logo'])); |
|
98 | + $vendor->setLogoFile($this->createImage($options[ 'logo' ])); |
|
99 | 99 | |
100 | 100 | $this->vendorLogoUploader->upload($vendor); |
101 | 101 | |
@@ -136,27 +136,27 @@ discard block |
||
136 | 136 | ->setNormalizer('products', LazyOption::findBy($this->productRepository, 'code')) |
137 | 137 | ->setRequired('name') |
138 | 138 | ->setAllowedTypes('name', 'string') |
139 | - ->setDefault('name', function (Options $options): string { |
|
139 | + ->setDefault('name', function(Options $options): string { |
|
140 | 140 | return $this->faker->company; |
141 | 141 | }) |
142 | 142 | ->setRequired('slug') |
143 | 143 | ->setAllowedTypes('slug', 'string') |
144 | - ->setDefault('slug', function (Options $options): string { |
|
145 | - return StringInflector::nameToCode((string) $options['name']); |
|
144 | + ->setDefault('slug', function(Options $options): string { |
|
145 | + return StringInflector::nameToCode((string) $options[ 'name' ]); |
|
146 | 146 | }) |
147 | 147 | ->setRequired('email') |
148 | 148 | ->setAllowedTypes('email', 'string') |
149 | - ->setDefault('email', function (Options $options): string { |
|
149 | + ->setDefault('email', function(Options $options): string { |
|
150 | 150 | return $this->faker->companyEmail; |
151 | 151 | }) |
152 | 152 | ->setRequired('logo') |
153 | 153 | ->setAllowedTypes('logo', 'string') |
154 | - ->setDefault('logo', function (Options $options): string { |
|
154 | + ->setDefault('logo', function(Options $options): string { |
|
155 | 155 | return __DIR__.'/../../Resources/fixtures/vendor/images/0'.rand(1, 3).'.png'; |
156 | 156 | }) |
157 | 157 | ->setRequired('description') |
158 | 158 | ->setAllowedTypes('description', 'string') |
159 | - ->setDefault('description', function (Options $options): string { |
|
159 | + ->setDefault('description', function(Options $options): string { |
|
160 | 160 | return $this->faker->text; |
161 | 161 | }) |
162 | 162 | ; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function load(array $configs, ContainerBuilder $container): void |
19 | 19 | { |
20 | - $this->processConfiguration($this->getConfiguration([], $container), $configs); |
|
20 | + $this->processConfiguration($this->getConfiguration([ ], $container), $configs); |
|
21 | 21 | |
22 | 22 | $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
23 | 23 |
@@ -28,19 +28,19 @@ |
||
28 | 28 | throw new HttpException(Response::HTTP_FORBIDDEN, 'Invalid csrf token.'); |
29 | 29 | } |
30 | 30 | |
31 | - if (in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true) && null !== $vendorsToUpdate) { |
|
31 | + if (in_array($request->getMethod(), [ 'POST', 'PUT', 'PATCH' ], true) && null !== $vendorsToUpdate) { |
|
32 | 32 | /** @var array $vendorToUpdate */ |
33 | 33 | foreach ($vendorsToUpdate as $vendorToUpdate) { |
34 | - if (!is_numeric($vendorToUpdate['position'])) { |
|
34 | + if (!is_numeric($vendorToUpdate[ 'position' ])) { |
|
35 | 35 | throw new HttpException( |
36 | 36 | Response::HTTP_NOT_ACCEPTABLE, |
37 | - sprintf('The vendor position "%s" is invalid.', $vendorToUpdate['position']) |
|
37 | + sprintf('The vendor position "%s" is invalid.', $vendorToUpdate[ 'position' ]) |
|
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | /** @var VendorInterface $vendor */ |
42 | - $vendor = $this->repository->findOneBy(['id' => $vendorToUpdate['id']]); |
|
43 | - $vendor->setPosition((int) $vendorToUpdate['position']); |
|
42 | + $vendor = $this->repository->findOneBy([ 'id' => $vendorToUpdate[ 'id' ] ]); |
|
43 | + $vendor->setPosition((int) $vendorToUpdate[ 'position' ]); |
|
44 | 44 | $this->manager->flush(); |
45 | 45 | } |
46 | 46 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | ChannelInterface $channel, |
25 | 25 | VendorInterface $vendor, |
26 | 26 | string $locale, |
27 | - array $sorting = [] |
|
27 | + array $sorting = [ ] |
|
28 | 28 | ): QueryBuilder { |
29 | 29 | $queryBuilder = $this->createQueryBuilder('o') |
30 | 30 | ->distinct() |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ->setParameter('vendor', $vendor) |
43 | 43 | ; |
44 | 44 | |
45 | - if (isset($sorting['price'])) { |
|
45 | + if (isset($sorting[ 'price' ])) { |
|
46 | 46 | $subQuery = $this->createQueryBuilder('m') |
47 | 47 | ->select('min(v.position)') |
48 | 48 | ->innerJoin('m.variants', 'v') |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function createShopListQueryBuilder( |
20 | 20 | ChannelInterface $channel, |
21 | - array $sorting = [] |
|
21 | + array $sorting = [ ] |
|
22 | 22 | ): QueryBuilder; |
23 | 23 | |
24 | 24 | /** |
@@ -22,6 +22,6 @@ |
||
22 | 22 | ChannelInterface $channel, |
23 | 23 | VendorInterface $vendor, |
24 | 24 | string $locale, |
25 | - array $sorting = [] |
|
25 | + array $sorting = [ ] |
|
26 | 26 | ): QueryBuilder; |
27 | 27 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public function createShopListQueryBuilder( |
18 | 18 | ChannelInterface $channel, |
19 | - array $sorting = [] |
|
19 | + array $sorting = [ ] |
|
20 | 20 | ): QueryBuilder { |
21 | 21 | return $this->findByEnabledQueryBuilder($channel); |
22 | 22 | } |