@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $data = new Data(); |
| 41 | 41 | |
| 42 | 42 | /** @var DateTime $endDate */ |
| 43 | - $endDate = $configuration['timePeriod']['end']?:null; |
|
| 43 | + $endDate = $configuration['timePeriod']['end'] ?: null; |
|
| 44 | 44 | |
| 45 | 45 | //There is added 23 hours 59 minutes 59 seconds to the end date to provide records for whole end date |
| 46 | 46 | $configuration['timePeriod']['end'] = $endDate !== null ? $endDate->add(new DateInterval('PT23H59M59S')) : null; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $labels = []; |
| 98 | 98 | foreach ($labelsAux as $label) { |
| 99 | 99 | if (!in_array($label, ['MonthDate', 'YearDate', 'DateDate'])) { |
| 100 | - $labels[] = preg_replace('/(?!^)[A-Z]{2,}(?=[A-Z][a-z])|[A-Z][a-z]/', ' $0', (string)$label); |
|
| 100 | + $labels[] = preg_replace('/(?!^)[A-Z]{2,}(?=[A-Z][a-z])|[A-Z][a-z]/', ' $0', (string) $label); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | $data->setLabels($labels); |
@@ -172,16 +172,16 @@ discard block |
||
| 172 | 172 | foreach ($datas as $data) { |
| 173 | 173 | $date = new DateTime($data[$labels[0]]); |
| 174 | 174 | $dateFormated = $date->format($configuration['timePeriod']['presentationFormat']); |
| 175 | - $currentDateMedia = isset($datesMedia[$dateFormated])?$datesMedia[$dateFormated]:array('quantity' => 0, 'media' => 0); |
|
| 176 | - $currentDateMedia['quantity'] = $currentDateMedia['quantity']+1; |
|
| 177 | - $currentDateMedia['media'] = $currentDateMedia['media']+$data[$labels[1]]; |
|
| 175 | + $currentDateMedia = isset($datesMedia[$dateFormated]) ? $datesMedia[$dateFormated] : array('quantity' => 0, 'media' => 0); |
|
| 176 | + $currentDateMedia['quantity'] = $currentDateMedia['quantity'] + 1; |
|
| 177 | + $currentDateMedia['media'] = $currentDateMedia['media'] + $data[$labels[1]]; |
|
| 178 | 178 | $datesMedia[$dateFormated] = $currentDateMedia; |
| 179 | 179 | } |
| 180 | 180 | $fetched = []; |
| 181 | 181 | foreach ($datesMedia as $date => $dateMedia) { |
| 182 | 182 | $fetched[] = [ |
| 183 | 183 | $labels[0] => $date, |
| 184 | - $labels[1] => round($dateMedia['media']/$dateMedia['quantity'], 1) |
|
| 184 | + $labels[1] => round($dateMedia['media'] / $dateMedia['quantity'], 1) |
|
| 185 | 185 | ]; |
| 186 | 186 | } |
| 187 | 187 | return $fetched; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | /** @var DateTime $startDateTime */ |
| 126 | 126 | $startDateTime = $configuration['timePeriod']['start']; |
| 127 | 127 | /** @var DateTime $endDateTime */ |
| 128 | - $endDateTime = $configuration['timePeriod']['end']?:new DateTime(); |
|
| 128 | + $endDateTime = $configuration['timePeriod']['end'] ?: new DateTime(); |
|
| 129 | 129 | |
| 130 | 130 | $this->qb |
| 131 | 131 | ->addSelect($groupByParts[0]) |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $type = 'user'.ucfirst($addressType).'Province'; |
| 219 | 219 | |
| 220 | 220 | if (isset($configuration[$type]) && count($configuration[$type]) > 0) { |
| 221 | - $provinces = $configuration[$type]->map(function (AddressInterface $address) { |
|
| 221 | + $provinces = $configuration[$type]->map(function(AddressInterface $address) { |
|
| 222 | 222 | return $address->getProvinceCode() ?: $address->getProvinceName(); |
| 223 | 223 | })->toArray(); |
| 224 | 224 | $rootAlias = $cAlias = $this->qb->getRootAliases()[0]; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $type = 'user'.ucfirst($addressType).'City'; |
| 248 | 248 | |
| 249 | 249 | if (isset($configuration[$type]) && count($configuration[$type]) > 0) { |
| 250 | - $cities = $configuration[$type]->map(function (AddressInterface $address) { |
|
| 250 | + $cities = $configuration[$type]->map(function(AddressInterface $address) { |
|
| 251 | 251 | return $address->getCity(); |
| 252 | 252 | })->toArray(); |
| 253 | 253 | $rootAlias = $cAlias = $this->qb->getRootAliases()[0]; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $type = 'user'.ucfirst($addressType).'Postcode'; |
| 274 | 274 | |
| 275 | 275 | if (isset($configuration[$type]) && count($configuration[$type]) > 0) { |
| 276 | - $codes = $configuration[$type]->map(function (AddressInterface $address) { |
|
| 276 | + $codes = $configuration[$type]->map(function(AddressInterface $address) { |
|
| 277 | 277 | return $address->getPostcode(); |
| 278 | 278 | })->toArray(); |
| 279 | 279 | $rootAlias = $cAlias = $this->qb->getRootAliases()[0]; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | public function addProduct(array $configuration = [], string $field = 'p.id'): void |
| 298 | 298 | { |
| 299 | 299 | if (isset($configuration['product']) && count($configuration['product']) > 0) { |
| 300 | - $products = $configuration['product']->map(function (ProductInterface $product) { |
|
| 300 | + $products = $configuration['product']->map(function(ProductInterface $product) { |
|
| 301 | 301 | return $product->getId(); |
| 302 | 302 | })->toArray(); |
| 303 | 303 | |