Completed
Pull Request — master (#328)
by Luc
04:54
created
src/Offer/ReadModel/JSONLD/OfferLDProjector.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
             if (preg_match('/^apply(.+)$/', $method, $matches)) {
159 159
                 $event = $matches[1];
160
-                $classNameMethod = 'get' . $event . 'ClassName';
160
+                $classNameMethod = 'get'.$event.'ClassName';
161 161
 
162 162
                 if (method_exists($this, $classNameMethod)) {
163 163
                     $eventFullClassName = call_user_func(array($this, $classNameMethod));
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
         $offerLD = $document->getBody();
338 338
 
339 339
         $oldTerms = property_exists($offerLD, 'terms') ? $offerLD->terms : [];
340
-        $newTerm = (object) $category->serialize();
340
+        $newTerm = (object)$category->serialize();
341 341
 
342 342
         $newTerms = array_filter(
343 343
             $oldTerms,
344
-            function ($term) use ($category) {
344
+            function($term) use ($category) {
345 345
                 return !property_exists($term, 'domain') || $term->domain !== $category->getDomain();
346 346
             }
347 347
         );
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         $labelsProperty = $labelAdded->getLabel()->isVisible() ? 'labels' : 'hiddenLabels';
368 368
 
369 369
         $labels = isset($offerLd->{$labelsProperty}) ? $offerLd->{$labelsProperty} : [];
370
-        $label = (string) $labelAdded->getLabel();
370
+        $label = (string)$labelAdded->getLabel();
371 371
 
372 372
         $labels[] = $label;
373 373
         $offerLd->{$labelsProperty} = array_unique($labels);
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
             if (isset($offerLd->{$labelsProperty}) && is_array($offerLd->{$labelsProperty})) {
394 394
                 $offerLd->{$labelsProperty} = array_filter(
395 395
                     $offerLd->{$labelsProperty},
396
-                    function ($label) use ($labelRemoved) {
396
+                    function($label) use ($labelRemoved) {
397 397
                         return !$labelRemoved->getLabel()->equals(
398 398
                             new Label($label)
399 399
                         );
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
             return;
494 494
         }
495 495
 
496
-        $imageId = (string) $imageRemoved->getImage()->getMediaObjectId();
496
+        $imageId = (string)$imageRemoved->getImage()->getMediaObjectId();
497 497
 
498 498
         /**
499 499
          * Matches any object that is not the removed image.
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
          * @return bool
505 505
          *  Returns true when the media object does not match the image to remove.
506 506
          */
507
-        $shouldNotBeRemoved = function ($mediaObject) use ($imageId) {
507
+        $shouldNotBeRemoved = function($mediaObject) use ($imageId) {
508 508
             $containsId = !!strpos($mediaObject->{'@id'}, $imageId);
509 509
             return !$containsId;
510 510
         };
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
         $document = $this->loadDocumentFromRepository($mainImageSelected);
544 544
         $offerLd = $document->getBody();
545 545
         $imageId = $mainImageSelected->getImage()->getMediaObjectId();
546
-        $mediaObjectMatcher = function ($matchingMediaObject, $currentMediaObject) use ($imageId) {
546
+        $mediaObjectMatcher = function($matchingMediaObject, $currentMediaObject) use ($imageId) {
547 547
             if (!$matchingMediaObject && $this->mediaObjectMatchesId($currentMediaObject, $imageId)) {
548 548
                 $matchingMediaObject = $currentMediaObject;
549 549
             }
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
      */
569 569
     protected function mediaObjectMatchesId($mediaObject, UUID $mediaObjectId)
570 570
     {
571
-        return strpos($mediaObject->{'@id'}, (string) $mediaObjectId) > 0;
571
+        return strpos($mediaObject->{'@id'}, (string)$mediaObjectId) > 0;
572 572
     }
573 573
 
574 574
     /**
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         $document = $this->loadDocumentFromRepository($typicalAgeRangeUpdated);
766 766
 
767 767
         $offerLd = $document->getBody();
768
-        $offerLd->typicalAgeRange = (string) $typicalAgeRangeUpdated->getTypicalAgeRange();
768
+        $offerLd->typicalAgeRange = (string)$typicalAgeRangeUpdated->getTypicalAgeRange();
769 769
 
770 770
         return $document->withBody($offerLd);
771 771
     }
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
         $images = $imagesEvent->getImages();
894 894
         $currentMediaObjects = isset($offerLd->mediaObject) ? $offerLd->mediaObject : [];
895 895
         $dutchMediaObjects = array_map(
896
-            function (Image $image) {
896
+            function(Image $image) {
897 897
                 return $this->mediaObjectSerializer->serialize($image, 'json-ld');
898 898
             },
899 899
             $images->toArray()
900 900
         );
901 901
         $translatedMediaObjects = array_filter(
902 902
             $currentMediaObjects,
903
-            function ($image) {
903
+            function($image) {
904 904
                 return $image->inLanguage !== 'nl';
905 905
             }
906 906
         );
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
         }
914 914
 
915 915
         if (isset($mainImage)) {
916
-            $offerLd->image = (string) $mainImage->getSourceLocation();
916
+            $offerLd->image = (string)$mainImage->getSourceLocation();
917 917
         }
918 918
     }
919 919
 
Please login to merge, or discard this patch.
src/Event/EventThemeResolver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
         $this->themes = array_reduce(
592 592
             $themePerType,
593
-            function ($themes, array $type) {
593
+            function($themes, array $type) {
594 594
                 if (array_key_exists('themes', $type)) {
595 595
                     foreach ($type['themes'] as $themeData) {
596 596
                         $themes[$themeData['id']] = new Theme($themeData['id'], $themeData['label']);
@@ -608,9 +608,9 @@  discard block
 block discarded – undo
608 608
      */
609 609
     public function byId(StringLiteral $themeId)
610 610
     {
611
-        if (!array_key_exists((string) $themeId, $this->themes)) {
612
-            throw new \Exception("Unknown event theme id: " . $themeId);
611
+        if (!array_key_exists((string)$themeId, $this->themes)) {
612
+            throw new \Exception("Unknown event theme id: ".$themeId);
613 613
         }
614
-        return $this->themes[(string) $themeId];
614
+        return $this->themes[(string)$themeId];
615 615
     }
616 616
 }
Please login to merge, or discard this patch.
src/Event/EventTypeResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@
 block discarded – undo
43 43
      */
44 44
     public function byId(StringLiteral $typeId)
45 45
     {
46
-        if (!array_key_exists((string) $typeId, $this->types)) {
47
-            throw new \Exception("Unknown event type id: " . $typeId);
46
+        if (!array_key_exists((string)$typeId, $this->types)) {
47
+            throw new \Exception("Unknown event type id: ".$typeId);
48 48
         }
49
-        return $this->types[(string) $typeId];
49
+        return $this->types[(string)$typeId];
50 50
     }
51 51
 }
Please login to merge, or discard this patch.
src/Place/PlaceTypeResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
      */
42 42
     public function byId(StringLiteral $typeId)
43 43
     {
44
-        if (!array_key_exists((string) $typeId, $this->types)) {
45
-            throw new \Exception("Unknown place type id: " . $typeId);
44
+        if (!array_key_exists((string)$typeId, $this->types)) {
45
+            throw new \Exception("Unknown place type id: ".$typeId);
46 46
         }
47
-        return $this->types[(string) $typeId];
47
+        return $this->types[(string)$typeId];
48 48
     }
49 49
 }
Please login to merge, or discard this patch.
src/Place/PlaceThemeResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@
 block discarded – undo
23 23
      */
24 24
     public function byId(StringLiteral $themeId)
25 25
     {
26
-        if (!array_key_exists((string) $themeId, $this->themes)) {
27
-            throw new \Exception("Unknown place theme id: " . $themeId);
26
+        if (!array_key_exists((string)$themeId, $this->themes)) {
27
+            throw new \Exception("Unknown place theme id: ".$themeId);
28 28
         }
29
-        return $this->themes[(string) $themeId];
29
+        return $this->themes[(string)$themeId];
30 30
     }
31 31
 }
Please login to merge, or discard this patch.