Completed
Pull Request — master (#353)
by
unknown
06:11
created
src/Offer/ReadModel/JSONLD/OfferLDProjector.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
             if (preg_match('/^apply(.+)$/', $method, $matches)) {
177 177
                 $event = $matches[1];
178
-                $classNameMethod = 'get' . $event . 'ClassName';
178
+                $classNameMethod = 'get'.$event.'ClassName';
179 179
 
180 180
                 if (method_exists($this, $classNameMethod)) {
181 181
                     $eventFullClassName = call_user_func(array($this, $classNameMethod));
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
         $offerLD = $document->getBody();
361 361
 
362 362
         $oldTerms = property_exists($offerLD, 'terms') ? $offerLD->terms : [];
363
-        $newTerm = (object) $category->serialize();
363
+        $newTerm = (object)$category->serialize();
364 364
 
365 365
         $newTerms = array_filter(
366 366
             $oldTerms,
367
-            function ($term) use ($category) {
367
+            function($term) use ($category) {
368 368
                 return !property_exists($term, 'domain') || $term->domain !== $category->getDomain();
369 369
             }
370 370
         );
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         // Remove all old facilities + get numeric keys.
392 392
         $terms = array_values(array_filter(
393 393
             $terms,
394
-            function ($term) {
394
+            function($term) {
395 395
                 return $term->domain !== Facility::DOMAIN;
396 396
             }
397 397
         ));
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
         $labelsProperty = $labelAdded->getLabel()->isVisible() ? 'labels' : 'hiddenLabels';
421 421
 
422 422
         $labels = isset($offerLd->{$labelsProperty}) ? $offerLd->{$labelsProperty} : [];
423
-        $label = (string) $labelAdded->getLabel();
423
+        $label = (string)$labelAdded->getLabel();
424 424
 
425 425
         $labels[] = $label;
426 426
         $offerLd->{$labelsProperty} = array_unique($labels);
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
             if (isset($offerLd->{$labelsProperty}) && is_array($offerLd->{$labelsProperty})) {
447 447
                 $offerLd->{$labelsProperty} = array_filter(
448 448
                     $offerLd->{$labelsProperty},
449
-                    function ($label) use ($labelRemoved) {
449
+                    function($label) use ($labelRemoved) {
450 450
                         return !$labelRemoved->getLabel()->equals(
451 451
                             new Label($label)
452 452
                         );
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
             return;
547 547
         }
548 548
 
549
-        $imageId = (string) $imageRemoved->getImage()->getMediaObjectId();
549
+        $imageId = (string)$imageRemoved->getImage()->getMediaObjectId();
550 550
 
551 551
         /**
552 552
          * Matches any object that is not the removed image.
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
          * @return bool
558 558
          *  Returns true when the media object does not match the image to remove.
559 559
          */
560
-        $shouldNotBeRemoved = function ($mediaObject) use ($imageId) {
560
+        $shouldNotBeRemoved = function($mediaObject) use ($imageId) {
561 561
             $containsId = !!strpos($mediaObject->{'@id'}, $imageId);
562 562
             return !$containsId;
563 563
         };
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
         $document = $this->loadDocumentFromRepository($mainImageSelected);
597 597
         $offerLd = $document->getBody();
598 598
         $imageId = $mainImageSelected->getImage()->getMediaObjectId();
599
-        $mediaObjectMatcher = function ($matchingMediaObject, $currentMediaObject) use ($imageId) {
599
+        $mediaObjectMatcher = function($matchingMediaObject, $currentMediaObject) use ($imageId) {
600 600
             if (!$matchingMediaObject && $this->mediaObjectMatchesId($currentMediaObject, $imageId)) {
601 601
                 $matchingMediaObject = $currentMediaObject;
602 602
             }
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
      */
622 622
     protected function mediaObjectMatchesId($mediaObject, UUID $mediaObjectId)
623 623
     {
624
-        return strpos($mediaObject->{'@id'}, (string) $mediaObjectId) > 0;
624
+        return strpos($mediaObject->{'@id'}, (string)$mediaObjectId) > 0;
625 625
     }
626 626
 
627 627
     /**
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
         $document = $this->loadDocumentFromRepository($typicalAgeRangeUpdated);
821 821
 
822 822
         $offerLd = $document->getBody();
823
-        $offerLd->typicalAgeRange = (string) $typicalAgeRangeUpdated->getTypicalAgeRange();
823
+        $offerLd->typicalAgeRange = (string)$typicalAgeRangeUpdated->getTypicalAgeRange();
824 824
 
825 825
         return $document->withBody($offerLd);
826 826
     }
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
         $images = $imagesEvent->getImages();
949 949
         $currentMediaObjects = isset($offerLd->mediaObject) ? $offerLd->mediaObject : [];
950 950
         $dutchMediaObjects = array_map(
951
-            function (Image $image) {
951
+            function(Image $image) {
952 952
                 // The mediaObject serializer violates the return statement of the serializer interface and returns an
953 953
                 // array instead of a serialized string.
954 954
                 /* @var array $serialized */
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
         );
967 967
         $translatedMediaObjects = array_filter(
968 968
             $currentMediaObjects,
969
-            function ($image) {
969
+            function($image) {
970 970
                 return $image->inLanguage !== 'nl';
971 971
             }
972 972
         );
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
         }
980 980
 
981 981
         if (isset($mainImage)) {
982
-            $offerLd->image = (string) $mainImage->getSourceLocation();
982
+            $offerLd->image = (string)$mainImage->getSourceLocation();
983 983
         }
984 984
     }
985 985
 
Please login to merge, or discard this patch.