Completed
Pull Request — master (#311)
by
unknown
05:40
created
src/Offer/ReadModel/JSONLD/OfferLDProjector.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
             if (preg_match('/^apply(.+)$/', $method, $matches)) {
127 127
                 $event = $matches[1];
128
-                $classNameMethod = 'get' . $event . 'ClassName';
128
+                $classNameMethod = 'get'.$event.'ClassName';
129 129
 
130 130
                 if (method_exists($this, $classNameMethod)) {
131 131
                     $eventFullClassName = call_user_func(array($this, $classNameMethod));
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $labelsProperty = $labelAdded->getLabel()->isVisible() ? 'labels' : 'hiddenLabels';
266 266
 
267 267
         $labels = isset($offerLd->{$labelsProperty}) ? $offerLd->{$labelsProperty} : [];
268
-        $label = (string) $labelAdded->getLabel();
268
+        $label = (string)$labelAdded->getLabel();
269 269
 
270 270
         $labels[] = $label;
271 271
         $offerLd->{$labelsProperty} = array_unique($labels);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
             if (isset($offerLd->{$labelsProperty}) && is_array($offerLd->{$labelsProperty})) {
291 291
                 $offerLd->{$labelsProperty} = array_filter(
292 292
                     $offerLd->{$labelsProperty},
293
-                    function ($label) use ($labelRemoved) {
293
+                    function($label) use ($labelRemoved) {
294 294
                         return !$labelRemoved->getLabel()->equals(
295 295
                             new Label($label)
296 296
                         );
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             return;
388 388
         }
389 389
 
390
-        $imageId = (string) $imageRemoved->getImage()->getMediaObjectId();
390
+        $imageId = (string)$imageRemoved->getImage()->getMediaObjectId();
391 391
 
392 392
         /**
393 393
          * Matches any object that is not the removed image.
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
          * @return bool
399 399
          *  Returns true when the media object does not match the image to remove.
400 400
          */
401
-        $shouldNotBeRemoved = function ($mediaObject) use ($imageId) {
401
+        $shouldNotBeRemoved = function($mediaObject) use ($imageId) {
402 402
             $containsId = !!strpos($mediaObject->{'@id'}, $imageId);
403 403
             return !$containsId;
404 404
         };
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
         $document = $this->loadDocumentFromRepository($mainImageSelected);
437 437
         $offerLd = $document->getBody();
438 438
         $imageId = $mainImageSelected->getImage()->getMediaObjectId();
439
-        $mediaObjectMatcher = function ($matchingMediaObject, $currentMediaObject) use ($imageId) {
439
+        $mediaObjectMatcher = function($matchingMediaObject, $currentMediaObject) use ($imageId) {
440 440
             if (!$matchingMediaObject && $this->mediaObjectMatchesId($currentMediaObject, $imageId)) {
441 441
                 $matchingMediaObject = $currentMediaObject;
442 442
             }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
      */
462 462
     protected function mediaObjectMatchesId($mediaObject, UUID $mediaObjectId)
463 463
     {
464
-        return strpos($mediaObject->{'@id'}, (string) $mediaObjectId) > 0;
464
+        return strpos($mediaObject->{'@id'}, (string)$mediaObjectId) > 0;
465 465
     }
466 466
 
467 467
     /**
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         $document = $this->loadDocumentFromRepository($typicalAgeRangeUpdated);
617 617
 
618 618
         $offerLd = $document->getBody();
619
-        $offerLd->typicalAgeRange = (string) $typicalAgeRangeUpdated->getTypicalAgeRange();
619
+        $offerLd->typicalAgeRange = (string)$typicalAgeRangeUpdated->getTypicalAgeRange();
620 620
 
621 621
         $this->repository->save($document->withBody($offerLd));
622 622
     }
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
      */
643 643
     protected function applyPublished(AbstractPublished $published)
644 644
     {
645
-        $this->applyEventTransformation($published, function ($offerLd) use ($published) {
645
+        $this->applyEventTransformation($published, function($offerLd) use ($published) {
646 646
             $offerLd->workflowStatus = WorkflowStatus::READY_FOR_VALIDATION()->getName();
647 647
 
648 648
             $publicationDate = $published->getPublicationDate();
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
      */
656 656
     protected function applyApproved(AbstractApproved $approved)
657 657
     {
658
-        $this->applyEventTransformation($approved, function ($offerLd) {
658
+        $this->applyEventTransformation($approved, function($offerLd) {
659 659
             $offerLd->workflowStatus = WorkflowStatus::APPROVED()->getName();
660 660
         });
661 661
     }
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
      */
692 692
     private function reject()
693 693
     {
694
-        return function ($offerLd) {
694
+        return function($offerLd) {
695 695
             $offerLd->workflowStatus = WorkflowStatus::REJECTED()->getName();
696 696
         };
697 697
     }
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
     {
739 739
         $images = $imagesEvent->getImages();
740 740
         $jsonMediaObjects = array_map(
741
-            function (Image $image) {
741
+            function(Image $image) {
742 742
                 return $this->mediaObjectSerializer->serialize($image, 'json-ld');
743 743
             },
744 744
             $images->toArray()
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
         }
753 753
 
754 754
         if (isset($mainImage)) {
755
-            $offerLd->image = (string) $mainImage->getSourceLocation();
755
+            $offerLd->image = (string)$mainImage->getSourceLocation();
756 756
         }
757 757
     }
758 758
 
Please login to merge, or discard this patch.
src/Offer/AgeRange.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,10 +63,10 @@
 block discarded – undo
63 63
      */
64 64
     public function __toString()
65 65
     {
66
-        $from = $this->from ? (string) $this->from : '';
67
-        $to = $this->to ? (string) $this->to : '';
66
+        $from = $this->from ? (string)$this->from : '';
67
+        $to = $this->to ? (string)$this->to : '';
68 68
 
69
-        return $from . '-' . $to;
69
+        return $from.'-'.$to;
70 70
     }
71 71
 
72 72
     /**
Please login to merge, or discard this patch.
src/Label/ReadModels/Relations/Repository/LabelRelation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $this->labelName = $labelName;
46 46
         $this->relationType = $relationType;
47 47
         $this->relationId = $relationId;
48
-        $this->imported = (bool) $imported;
48
+        $this->imported = (bool)$imported;
49 49
     }
50 50
 
51 51
     /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             new LabelName($relation[SchemaConfigurator::LABEL_NAME]),
104 104
             RelationType::fromNative($relation[SchemaConfigurator::RELATION_TYPE]),
105 105
             new StringLiteral($relation[SchemaConfigurator::RELATION_ID]),
106
-            (bool) $relation[SchemaConfigurator::IMPORTED]
106
+            (bool)$relation[SchemaConfigurator::IMPORTED]
107 107
         );
108 108
     }
109 109
 }
Please login to merge, or discard this patch.
src/Label/ReadModels/Relations/Projector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
         foreach ($labelCollection->asArray() as $label) {
187 187
             $this->writeRepository->save(
188
-                new LabelName((string) $label),
188
+                new LabelName((string)$label),
189 189
                 $relationType,
190 190
                 $relationId,
191 191
                 true
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     {
202 202
         $labelRelation = null;
203 203
 
204
-        $labelName = new LabelName((string) $labelEvent->getLabel());
204
+        $labelName = new LabelName((string)$labelEvent->getLabel());
205 205
         $relationType = $this->offerTypeResolver->getRelationType($labelEvent);
206 206
         $relationId = new StringLiteral($labelEvent->getItemId());
207 207
 
Please login to merge, or discard this patch.
src/Label/ReadModels/Relations/Repository/Doctrine/DBALReadRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function getLabelRelations(LabelName $labelName)
17 17
     {
18 18
         $aliases = $this->getAliases();
19
-        $whereLabelName = SchemaConfigurator::LABEL_NAME . ' = ?';
19
+        $whereLabelName = SchemaConfigurator::LABEL_NAME.' = ?';
20 20
 
21 21
         $queryBuilder = $this->createQueryBuilder()->select($aliases)
22 22
             ->from($this->getTableName()->toNative())
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function getLabelRelationsForItem(StringLiteral $relationId)
38 38
     {
39 39
         $aliases = $this->getAliases();
40
-        $whereRelationId = SchemaConfigurator::RELATION_ID . ' = ?';
40
+        $whereRelationId = SchemaConfigurator::RELATION_ID.' = ?';
41 41
 
42 42
         $queryBuilder = $this->createQueryBuilder()->select($aliases)
43 43
             ->from($this->getTableName()->toNative())
Please login to merge, or discard this patch.
src/Calendar/OpeningTime.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
      */
60 60
     public function toNativeString()
61 61
     {
62
-        return (string) $this;
62
+        return (string)$this;
63 63
     }
64 64
 
65 65
     /**
Please login to merge, or discard this patch.
src/Calendar.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         array $openingHours = array()
56 56
     ) {
57 57
         if (($type->is(CalendarType::MULTIPLE()) || $type->is(CalendarType::SINGLE())) && empty($startDate)) {
58
-            throw new \UnexpectedValueException('Start date can not be empty for calendar type: ' . $type . '.');
58
+            throw new \UnexpectedValueException('Start date can not be empty for calendar type: '.$type.'.');
59 59
         }
60 60
 
61 61
         if ($type->is(CalendarType::PERIODIC()) && (empty($startDate) || empty($endDate))) {
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
     public function serialize()
84 84
     {
85 85
         $serializedTimestamps = array_map(
86
-            function (Timestamp $timestamp) {
86
+            function(Timestamp $timestamp) {
87 87
                 return $timestamp->serialize();
88 88
             },
89 89
             $this->timestamps
90 90
         );
91 91
 
92 92
         $serializedOpeningHours = array_map(
93
-            function (OpeningHour $openingHour) {
93
+            function(OpeningHour $openingHour) {
94 94
                 return $openingHour->serialize();
95 95
             },
96 96
             $this->openingHours
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
             !empty($data['startDate']) ? self::deserializeDateTime($data['startDate']) : null,
119 119
             !empty($data['endDate']) ? self::deserializeDateTime($data['endDate']) : null,
120 120
             !empty($data['timestamps']) ? array_map(
121
-                function ($timestamp) {
121
+                function($timestamp) {
122 122
                     return Timestamp::deserialize($timestamp);
123 123
                 },
124 124
                 $data['timestamps']
125 125
             ) : [],
126 126
             !empty($data['openingHours']) ? array_map(
127
-                function ($openingHour) {
127
+                function($openingHour) {
128 128
                     return OpeningHour::deserialize($openingHour);
129 129
                 },
130 130
                 $data['openingHours']
Please login to merge, or discard this patch.
src/Calendar/DayOfWeekCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public function getDaysOfWeek()
48 48
     {
49 49
         return array_map(
50
-            function ($dayOfWeek) {
50
+            function($dayOfWeek) {
51 51
                 return DayOfWeek::fromNative($dayOfWeek);
52 52
             },
53 53
             $this->daysOfWeek
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         return array_reduce(
63 63
             $data,
64
-            function (DayOfWeekCollection $collection, $dayOfWeek) {
64
+            function(DayOfWeekCollection $collection, $dayOfWeek) {
65 65
                  return $collection->addDayOfWeek(DayOfWeek::fromNative($dayOfWeek));
66 66
             },
67 67
             new DayOfWeekCollection()
Please login to merge, or discard this patch.
src/CalendarFactory.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
         if ($cdbCalendar instanceof \CultureFeed_Cdb_Data_Calendar_PeriodList) {
41 41
             /** @var \CultureFeed_Cdb_Data_Calendar_Period $period */
42 42
             $period = $cdbCalendar->current();
43
-            $startDateString = $period->getDateFrom() . 'T00:00:00';
43
+            $startDateString = $period->getDateFrom().'T00:00:00';
44 44
         } else if ($cdbCalendar instanceof \CultureFeed_Cdb_Data_Calendar_TimestampList) {
45 45
             /** @var \CultureFeed_Cdb_Data_Calendar_Timestamp $timestamp */
46 46
             $timestamp = $cdbCalendar->current();
47 47
             if ($timestamp->getStartTime()) {
48
-                $startDateString = $timestamp->getDate() . 'T' . substr($timestamp->getStartTime(), 0, 5) . ':00';
48
+                $startDateString = $timestamp->getDate().'T'.substr($timestamp->getStartTime(), 0, 5).':00';
49 49
             } else {
50
-                $startDateString = $timestamp->getDate() . 'T00:00:00';
50
+                $startDateString = $timestamp->getDate().'T00:00:00';
51 51
             }
52 52
         }
53 53
         $startDate = !empty($startDateString) ? DateTimeFactory::dateTimeFromDateString($startDateString) : null;
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
         if ($cdbCalendar instanceof \CultureFeed_Cdb_Data_Calendar_PeriodList) {
61 61
             /** @var \CultureFeed_Cdb_Data_Calendar_Period $period */
62 62
             $period = $cdbCalendar->current();
63
-            $endDateString = $period->getDateTo() . 'T00:00:00';
63
+            $endDateString = $period->getDateTo().'T00:00:00';
64 64
         } else if ($cdbCalendar instanceof \CultureFeed_Cdb_Data_Calendar_TimestampList) {
65 65
             $firstTimestamp = $cdbCalendar->current();
66 66
             /** @var \CultureFeed_Cdb_Data_Calendar_Timestamp $timestamp */
67 67
             $cdbCalendarAsArray = iterator_to_array($cdbCalendar);
68 68
             $timestamp = iterator_count($cdbCalendar) > 1 ? end($cdbCalendarAsArray) : $firstTimestamp;
69 69
             if ($timestamp->getEndTime()) {
70
-                $endDateString = $timestamp->getDate() . 'T' . $timestamp->getEndTime();
70
+                $endDateString = $timestamp->getDate().'T'.$timestamp->getEndTime();
71 71
             } else {
72 72
                 $endTime = $timestamp->getStartTime() ? $timestamp->getStartTime() : '00:00:00';
73
-                $endDateString = $timestamp->getDate() . 'T' . $endTime;
73
+                $endDateString = $timestamp->getDate().'T'.$endTime;
74 74
             }
75 75
         }
76 76
         $endDate = !empty($endDateString) ? DateTimeFactory::dateTimeFromDateString($endDateString) : null;
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
                 $cdbCalendar->next();
89 89
 
90 90
                 $startTime = $timestamp->getStartTime() ? $timestamp->getStartTime() : '00:00:00';
91
-                $startDateString = $timestamp->getDate() . 'T' . $startTime;
91
+                $startDateString = $timestamp->getDate().'T'.$startTime;
92 92
 
93 93
                 if ($timestamp->getEndTime()) {
94
-                    $endDateString = $timestamp->getDate() . 'T' . $timestamp->getEndTime();
94
+                    $endDateString = $timestamp->getDate().'T'.$timestamp->getEndTime();
95 95
                 } else {
96
-                    $endDateString = $timestamp->getDate() . 'T' . $startTime;
96
+                    $endDateString = $timestamp->getDate().'T'.$startTime;
97 97
                 }
98 98
 
99 99
                 $timestamp = $this->createTimestamp(
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             }
111 111
 
112 112
             $periods = array_map(
113
-                function (array $periodParts) {
113
+                function(array $periodParts) {
114 114
                     $firstPart = array_shift($periodParts);
115 115
                     $lastPart = array_pop($periodParts);
116 116
                     return new Timestamp(
Please login to merge, or discard this patch.