Completed
Pull Request — master (#255)
by Kristof
03:34
created
src/Offer/ReadModel/JSONLD/OfferLDProjector.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
             if (preg_match('/^apply(.+)$/', $method, $matches)) {
161 161
                 $event = $matches[1];
162
-                $classNameMethod = 'get' . $event . 'ClassName';
162
+                $classNameMethod = 'get'.$event.'ClassName';
163 163
 
164 164
                 if (method_exists($this, $classNameMethod)) {
165 165
                     $eventFullClassName = call_user_func(array($this, $classNameMethod));
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
         $offerLD = $document->getBody();
345 345
 
346 346
         $oldTerms = property_exists($offerLD, 'terms') ? $offerLD->terms : [];
347
-        $newTerm = (object) $category->serialize();
347
+        $newTerm = (object)$category->serialize();
348 348
 
349 349
         $newTerms = array_filter(
350 350
             $oldTerms,
351
-            function ($term) use ($category) {
351
+            function($term) use ($category) {
352 352
                 return !property_exists($term, 'domain') || $term->domain !== $category->getDomain();
353 353
             }
354 354
         );
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         // Remove all old facilities + get numeric keys.
376 376
         $terms = array_values(array_filter(
377 377
             $terms,
378
-            function ($term) {
378
+            function($term) {
379 379
                 return $term->domain !== Facility::DOMAIN;
380 380
             }
381 381
         ));
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
         $labelsProperty = $labelAdded->getLabel()->isVisible() ? 'labels' : 'hiddenLabels';
405 405
 
406 406
         $labels = isset($offerLd->{$labelsProperty}) ? $offerLd->{$labelsProperty} : [];
407
-        $label = (string) $labelAdded->getLabel();
407
+        $label = (string)$labelAdded->getLabel();
408 408
 
409 409
         $labels[] = $label;
410 410
         $offerLd->{$labelsProperty} = array_unique($labels);
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
             if (isset($offerLd->{$labelsProperty}) && is_array($offerLd->{$labelsProperty})) {
431 431
                 $offerLd->{$labelsProperty} = array_filter(
432 432
                     $offerLd->{$labelsProperty},
433
-                    function ($label) use ($labelRemoved) {
433
+                    function($label) use ($labelRemoved) {
434 434
                         return !$labelRemoved->getLabel()->equals(
435 435
                             new Label($label)
436 436
                         );
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
             return;
531 531
         }
532 532
 
533
-        $imageId = (string) $imageRemoved->getImage()->getMediaObjectId();
533
+        $imageId = (string)$imageRemoved->getImage()->getMediaObjectId();
534 534
 
535 535
         /**
536 536
          * Matches any object that is not the removed image.
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
          * @return bool
542 542
          *  Returns true when the media object does not match the image to remove.
543 543
          */
544
-        $shouldNotBeRemoved = function ($mediaObject) use ($imageId) {
544
+        $shouldNotBeRemoved = function($mediaObject) use ($imageId) {
545 545
             $containsId = !!strpos($mediaObject->{'@id'}, $imageId);
546 546
             return !$containsId;
547 547
         };
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
         $document = $this->loadDocumentFromRepository($mainImageSelected);
581 581
         $offerLd = $document->getBody();
582 582
         $imageId = $mainImageSelected->getImage()->getMediaObjectId();
583
-        $mediaObjectMatcher = function ($matchingMediaObject, $currentMediaObject) use ($imageId) {
583
+        $mediaObjectMatcher = function($matchingMediaObject, $currentMediaObject) use ($imageId) {
584 584
             if (!$matchingMediaObject && $this->mediaObjectMatchesId($currentMediaObject, $imageId)) {
585 585
                 $matchingMediaObject = $currentMediaObject;
586 586
             }
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
      */
606 606
     protected function mediaObjectMatchesId($mediaObject, UUID $mediaObjectId)
607 607
     {
608
-        return strpos($mediaObject->{'@id'}, (string) $mediaObjectId) > 0;
608
+        return strpos($mediaObject->{'@id'}, (string)$mediaObjectId) > 0;
609 609
     }
610 610
 
611 611
     /**
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
         $document = $this->loadDocumentFromRepository($typicalAgeRangeUpdated);
803 803
 
804 804
         $offerLd = $document->getBody();
805
-        $offerLd->typicalAgeRange = (string) $typicalAgeRangeUpdated->getTypicalAgeRange();
805
+        $offerLd->typicalAgeRange = (string)$typicalAgeRangeUpdated->getTypicalAgeRange();
806 806
 
807 807
         return $document->withBody($offerLd);
808 808
     }
@@ -930,14 +930,14 @@  discard block
 block discarded – undo
930 930
         $images = $imagesEvent->getImages();
931 931
         $currentMediaObjects = isset($offerLd->mediaObject) ? $offerLd->mediaObject : [];
932 932
         $dutchMediaObjects = array_map(
933
-            function (Image $image) {
933
+            function(Image $image) {
934 934
                 return $this->mediaObjectSerializer->serialize($image, 'json-ld');
935 935
             },
936 936
             $images->toArray()
937 937
         );
938 938
         $translatedMediaObjects = array_filter(
939 939
             $currentMediaObjects,
940
-            function ($image) {
940
+            function($image) {
941 941
                 return $image->inLanguage !== 'nl';
942 942
             }
943 943
         );
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
         }
951 951
 
952 952
         if (isset($mainImage)) {
953
-            $offerLd->image = (string) $mainImage->getSourceLocation();
953
+            $offerLd->image = (string)$mainImage->getSourceLocation();
954 954
         }
955 955
     }
956 956
 
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,6 @@
 block discarded – undo
10 10
 use CultuurNet\UDB3\Event\ReadModel\DocumentRepositoryInterface;
11 11
 use CultuurNet\UDB3\Event\ReadModel\JSONLD\OrganizerServiceInterface;
12 12
 use CultuurNet\UDB3\EventHandling\DelegateEventHandlingToSpecificMethodTrait;
13
-use CultuurNet\UDB3\EventListener\EventSpecification;
14 13
 use CultuurNet\UDB3\Facility;
15 14
 use CultuurNet\UDB3\Iri\IriGeneratorInterface;
16 15
 use CultuurNet\UDB3\Label;
Please login to merge, or discard this patch.
src/Address/LocalityAddressFormatter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
      */
10 10
     public function format(Address $address)
11 11
     {
12
-        return $address->getPostalCode() . ' ' .
13
-            $address->getLocality() . ', ' .
12
+        return $address->getPostalCode().' '.
13
+            $address->getLocality().', '.
14 14
             $address->getCountry()->getCode();
15 15
     }
16 16
 }
Please login to merge, or discard this patch.
src/Place/Events/PlaceCreated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@
 block discarded – undo
154 154
         }
155 155
         return parent::serialize() + array(
156 156
             'main_language' => $this->mainLanguage->getCode(),
157
-            'title' => (string) $this->getTitle(),
157
+            'title' => (string)$this->getTitle(),
158 158
             'event_type' => $this->getEventType()->serialize(),
159 159
             'theme' => $theme,
160 160
             'address' => $this->getAddress()->serialize(),
Please login to merge, or discard this patch.
src/Organizer/Events/OrganizerCreatedWithUniqueWebsite.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,8 +73,8 @@
 block discarded – undo
73 73
     {
74 74
         return parent::serialize() + array(
75 75
             'main_language' => $this->getMainLanguage()->getCode(),
76
-            'website' => (string) $this->getWebsite(),
77
-            'title' => (string) $this->getTitle(),
76
+            'website' => (string)$this->getWebsite(),
77
+            'title' => (string)$this->getTitle(),
78 78
         );
79 79
     }
80 80
 
Please login to merge, or discard this patch.
src/Organizer/OrganizerLDProjector.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
         $this->setMainLanguage($jsonLD, $organizerCreated->getMainLanguage());
219 219
 
220
-        $jsonLD->url = (string) $organizerCreated->getWebsite();
220
+        $jsonLD->url = (string)$organizerCreated->getWebsite();
221 221
 
222 222
         $jsonLD->name = [
223 223
             $this->getMainLanguage($jsonLD)->getCode() => $organizerCreated->getTitle(),
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         $document = $this->repository->get($organizerId);
249 249
 
250 250
         $jsonLD = $document->getBody();
251
-        $jsonLD->url = (string) $websiteUpdated->getWebsite();
251
+        $jsonLD->url = (string)$websiteUpdated->getWebsite();
252 252
 
253 253
         return $document->withBody($jsonLD);
254 254
     }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         $labelsProperty = $labelAdded->getLabel()->isVisible() ? 'labels' : 'hiddenLabels';
357 357
 
358 358
         $labels = isset($jsonLD->{$labelsProperty}) ? $jsonLD->{$labelsProperty} : [];
359
-        $label = (string) $labelAdded->getLabel();
359
+        $label = (string)$labelAdded->getLabel();
360 360
 
361 361
         $labels[] = $label;
362 362
         $jsonLD->{$labelsProperty} = array_unique($labels);
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             if (isset($jsonLD->{$labelsProperty}) && is_array($jsonLD->{$labelsProperty})) {
381 381
                 $jsonLD->{$labelsProperty} = array_filter(
382 382
                     $jsonLD->{$labelsProperty},
383
-                    function ($label) use ($labelRemoved) {
383
+                    function($label) use ($labelRemoved) {
384 384
                         return !$labelRemoved->getLabel()->equals(
385 385
                             new Label($label)
386 386
                         );
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     private function applyOrganizerDeleted(
408 408
         OrganizerDeleted $organizerDeleted
409 409
     ) {
410
-        $document =  $this->repository->get($organizerDeleted->getOrganizerId());
410
+        $document = $this->repository->get($organizerDeleted->getOrganizerId());
411 411
 
412 412
         $jsonLD = $document->getBody();
413 413
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
     /**
198 198
      * @param $jsonLD
199 199
      * @param DomainMessage $domainMessage
200
-     * @return mixed
200
+     * @return \stdClass
201 201
      */
202 202
     private function appendCreator($jsonLD, $domainMessage)
203 203
     {
Please login to merge, or discard this patch.
src/Offer/Commands/AbstractCreateCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     {
20 20
         if (!is_string($itemId)) {
21 21
             throw new \InvalidArgumentException(
22
-                'Expected itemId to be a string, received ' . gettype($itemId)
22
+                'Expected itemId to be a string, received '.gettype($itemId)
23 23
             );
24 24
         }
25 25
 
Please login to merge, or discard this patch.
src/Organizer/DBALWebsiteLookupService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         $tableName
28 28
     ) {
29 29
         $this->connection = $connection;
30
-        $this->tableName = (string) $tableName;
30
+        $this->tableName = (string)$tableName;
31 31
     }
32 32
 
33 33
     /**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             ->select(UniqueDBALEventStoreDecorator::UUID_COLUMN)
42 42
             ->from($this->tableName)
43 43
             ->where($expr->eq(UniqueDBALEventStoreDecorator::UNIQUE_COLUMN, ':url'))
44
-            ->setParameter(':url', (string) $url)
44
+            ->setParameter(':url', (string)$url)
45 45
             ->execute();
46 46
 
47 47
         $uuid = $results->fetchColumn();
Please login to merge, or discard this patch.
src/Offer/OfferFacilityResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
      */
26 26
     public function byId(StringLiteral $facilityId)
27 27
     {
28
-        if (!array_key_exists((string) $facilityId, $this->facilities)) {
28
+        if (!array_key_exists((string)$facilityId, $this->facilities)) {
29 29
             throw new \Exception("Unknown facility id '{$facilityId}'");
30 30
         }
31 31
 
32
-        return $this->facilities[(string) $facilityId];
32
+        return $this->facilities[(string)$facilityId];
33 33
     }
34 34
 
35 35
     /**
Please login to merge, or discard this patch.
src/Organizer/Commands/AbstractLabelCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     public function getNames()
50 50
     {
51 51
         return [
52
-            new StringLiteral((string) $this->label),
52
+            new StringLiteral((string)$this->label),
53 53
         ];
54 54
     }
55 55
 
Please login to merge, or discard this patch.