@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | if ($configuration->isHtmlRequest()) { |
52 | 52 | $view |
53 | - ->setTemplate($configuration->getTemplate(ResourceActions::SHOW . '.html')) |
|
53 | + ->setTemplate($configuration->getTemplate(ResourceActions::SHOW.'.html')) |
|
54 | 54 | ->setTemplateVar($this->metadata->getName()) |
55 | 55 | ->setData([ |
56 | 56 | 'configuration' => $configuration, |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $singleResourceProvider->get($configuration, $repository)->willReturn($resource); |
118 | 118 | |
119 | 119 | $configuration->isHtmlRequest()->willReturn(true); |
120 | - $configuration->getTemplate(ResourceActions::SHOW . '.html')->willReturn('SyliusShopBundle:Product:show.html.twig'); |
|
120 | + $configuration->getTemplate(ResourceActions::SHOW.'.html')->willReturn('SyliusShopBundle:Product:show.html.twig'); |
|
121 | 121 | |
122 | 122 | $eventDispatcher->dispatch(ResourceActions::SHOW, $configuration, $resource)->shouldBeCalled(); |
123 | 123 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | private function getViewComparingCallback(View $expectedView) |
175 | 175 | { |
176 | - return function ($value) use ($expectedView) { |
|
176 | + return function($value) use ($expectedView) { |
|
177 | 177 | if (!$value instanceof View) { |
178 | 178 | return false; |
179 | 179 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | return $this->createQueryBuilder('o') |
21 | 21 | ->andWhere('o.city LIKE :city') |
22 | - ->setParameter('city', '%' . $cityName . '%') |
|
22 | + ->setParameter('city', '%'.$cityName.'%') |
|
23 | 23 | ->getQuery() |
24 | 24 | ->getResult() |
25 | 25 | ; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | ->leftJoin(Province::class, 'p', 'WITH', 'p.code = o.provinceCode') |
35 | 35 | ->where('o.provinceName LIKE :province') |
36 | 36 | ->orWhere('p.name LIKE :province') |
37 | - ->setParameter('province', '%' . $provinceName . '%') |
|
37 | + ->setParameter('province', '%'.$provinceName.'%') |
|
38 | 38 | ->getQuery() |
39 | 39 | ->getResult() |
40 | 40 | ; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | return $this->createQueryBuilder('o') |
49 | 49 | ->andWhere('o.postcode LIKE :postcode') |
50 | - ->setParameter('postcode', '%' . $postcode . '%') |
|
50 | + ->setParameter('postcode', '%'.$postcode.'%') |
|
51 | 51 | ->getQuery() |
52 | 52 | ->getResult() |
53 | 53 | ; |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $countryName = $country !== null ? $country->getName() : $address->getCountryCode(); |
63 | 63 | |
64 | 64 | $postcodeLabel = $address->getPostcode().', '.$countryName; |
65 | - $isNew = count(array_filter($addresses, function ($address) use ($postcodeLabel) { |
|
65 | + $isNew = count(array_filter($addresses, function($address) use ($postcodeLabel) { |
|
66 | 66 | return $address['postcode'] === $postcodeLabel; |
67 | 67 | })) === 0; |
68 | 68 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | |
70 | 70 | $provinceName = $this->getProvinceName($address); |
71 | 71 | $provinceLabel = ucfirst(strtolower($provinceName)).', '.$countryName; |
72 | - $isNew = count(array_filter($addresses, function ($address) use ($provinceLabel) { |
|
72 | + $isNew = count(array_filter($addresses, function($address) use ($provinceLabel) { |
|
73 | 73 | return $address['province'] === $provinceLabel; |
74 | 74 | })) === 0; |
75 | 75 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $countryName = $country !== null ? $country->getName() : $address->getCountryCode(); |
63 | 63 | |
64 | 64 | $cityLabel = ucfirst(strtolower($address->getCity())).', '.$countryName; |
65 | - $isNew = count(array_filter($addresses, function ($address) use ($cityLabel) { |
|
65 | + $isNew = count(array_filter($addresses, function($address) use ($cityLabel) { |
|
66 | 66 | return $address['city'] === $cityLabel; |
67 | 67 | })) === 0; |
68 | 68 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | /** @var ProductInterface $product */ |
57 | 57 | foreach ($searchProducts as $product) { |
58 | 58 | $productLabel = ucfirst(strtolower($product->getName())); |
59 | - $isNew = count(array_filter($products, function ($product) use ($productLabel) { |
|
59 | + $isNew = count(array_filter($products, function($product) use ($productLabel) { |
|
60 | 60 | return $product['name'] === $productLabel; |
61 | 61 | })) === 0; |
62 | 62 |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** @var \DateTime $startDateTime */ |
120 | 120 | $startDateTime = $configuration['timePeriod']['start']; |
121 | 121 | /** @var \DateTime $endDateTime */ |
122 | - $endDateTime = $configuration['timePeriod']['end']?:new \DateTime(); |
|
122 | + $endDateTime = $configuration['timePeriod']['end'] ?: new \DateTime(); |
|
123 | 123 | |
124 | 124 | $this->qb |
125 | 125 | ->addSelect($groupByParts[0]) |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $type = 'user'.ucfirst($addressType).'Province'; |
213 | 213 | |
214 | 214 | if (isset($configuration[$type]) && count($configuration[$type]) > 0) { |
215 | - $provinces = $configuration[$type]->map(function (AddressInterface $address) { |
|
215 | + $provinces = $configuration[$type]->map(function(AddressInterface $address) { |
|
216 | 216 | return $address->getProvinceCode() ?: $address->getProvinceName(); |
217 | 217 | })->toArray(); |
218 | 218 | $rootAlias = $cAlias = $this->qb->getRootAliases()[0]; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $type = 'user'.ucfirst($addressType).'City'; |
242 | 242 | |
243 | 243 | if (isset($configuration[$type]) && count($configuration[$type]) > 0) { |
244 | - $cities = $configuration[$type]->map(function (AddressInterface $address) { |
|
244 | + $cities = $configuration[$type]->map(function(AddressInterface $address) { |
|
245 | 245 | return $address->getCity(); |
246 | 246 | })->toArray(); |
247 | 247 | $rootAlias = $cAlias = $this->qb->getRootAliases()[0]; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $type = 'user'.ucfirst($addressType).'Postcode'; |
268 | 268 | |
269 | 269 | if (isset($configuration[$type]) && count($configuration[$type]) > 0) { |
270 | - $codes = $configuration[$type]->map(function (AddressInterface $address) { |
|
270 | + $codes = $configuration[$type]->map(function(AddressInterface $address) { |
|
271 | 271 | return $address->getPostcode(); |
272 | 272 | })->toArray(); |
273 | 273 | $rootAlias = $cAlias = $this->qb->getRootAliases()[0]; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | public function addProduct(array $configuration = [], string $field = 'p.id'): void |
292 | 292 | { |
293 | 293 | if (isset($configuration['product']) && count($configuration['product']) > 0) { |
294 | - $products = $configuration['product']->map(function (ProductInterface $product) { |
|
294 | + $products = $configuration['product']->map(function(ProductInterface $product) { |
|
295 | 295 | return $product->getId(); |
296 | 296 | })->toArray(); |
297 | 297 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $data = new Data(); |
35 | 35 | |
36 | 36 | /** @var \DateTime $endDate */ |
37 | - $endDate = $configuration['timePeriod']['end']?:null; |
|
37 | + $endDate = $configuration['timePeriod']['end'] ?: null; |
|
38 | 38 | |
39 | 39 | //There is added 23 hours 59 minutes 59 seconds to the end date to provide records for whole end date |
40 | 40 | $configuration['timePeriod']['end'] = $endDate !== null ? $endDate->add(new \DateInterval('PT23H59M59S')) : null; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $labels = []; |
92 | 92 | foreach ($labelsAux as $label) { |
93 | 93 | if (!in_array($label, ['MonthDate', 'YearDate', 'DateDate'])) { |
94 | - $labels[] = preg_replace('/(?!^)[A-Z]{2,}(?=[A-Z][a-z])|[A-Z][a-z]/', ' $0', (string)$label); |
|
94 | + $labels[] = preg_replace('/(?!^)[A-Z]{2,}(?=[A-Z][a-z])|[A-Z][a-z]/', ' $0', (string) $label); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | $data->setLabels($labels); |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | foreach ($datas as $data) { |
166 | 166 | $date = new \DateTime($data[$labels[0]]); |
167 | 167 | $dateFormated = $date->format($configuration['timePeriod']['presentationFormat']); |
168 | - $currentDateMedia = isset($datesMedia[$dateFormated])?$datesMedia[$dateFormated]:array('quantity' => 0, 'media' => 0); |
|
169 | - $currentDateMedia['quantity'] = $currentDateMedia['quantity']+1; |
|
170 | - $currentDateMedia['media'] = $currentDateMedia['media']+$data[$labels[1]]; |
|
168 | + $currentDateMedia = isset($datesMedia[$dateFormated]) ? $datesMedia[$dateFormated] : array('quantity' => 0, 'media' => 0); |
|
169 | + $currentDateMedia['quantity'] = $currentDateMedia['quantity'] + 1; |
|
170 | + $currentDateMedia['media'] = $currentDateMedia['media'] + $data[$labels[1]]; |
|
171 | 171 | $datesMedia[$dateFormated] = $currentDateMedia; |
172 | 172 | } |
173 | 173 | $fetched = []; |
174 | 174 | foreach ($datesMedia as $date => $dateMedia) { |
175 | 175 | $fetched[] = [ |
176 | 176 | $labels[0] => $date, |
177 | - $labels[1] => round($dateMedia['media']/$dateMedia['quantity'], 1) |
|
177 | + $labels[1] => round($dateMedia['media'] / $dateMedia['quantity'], 1) |
|
178 | 178 | ]; |
179 | 179 | } |
180 | 180 | return $fetched; |