@@ -157,7 +157,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -590,7 +590,7 @@ discard block |
||
| 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']); |
@@ -605,9 +605,9 @@ discard block |
||
| 605 | 605 | |
| 606 | 606 | public function byId(StringLiteral $themeId) |
| 607 | 607 | { |
| 608 | - if (!array_key_exists((string) $themeId, $this->themes)) { |
|
| 609 | - throw new \Exception("Unknown event theme id: " . $themeId); |
|
| 608 | + if (!array_key_exists((string)$themeId, $this->themes)) { |
|
| 609 | + throw new \Exception("Unknown event theme id: ".$themeId); |
|
| 610 | 610 | } |
| 611 | - return $this->themes[(string) $themeId]; |
|
| 611 | + return $this->themes[(string)$themeId]; |
|
| 612 | 612 | } |
| 613 | 613 | } |
@@ -40,9 +40,9 @@ |
||
| 40 | 40 | |
| 41 | 41 | public function byId(StringLiteral $typeId) |
| 42 | 42 | { |
| 43 | - if (!array_key_exists((string) $typeId, $this->types)) { |
|
| 44 | - throw new \Exception("Unknown event type id: " . $typeId); |
|
| 43 | + if (!array_key_exists((string)$typeId, $this->types)) { |
|
| 44 | + throw new \Exception("Unknown event type id: ".$typeId); |
|
| 45 | 45 | } |
| 46 | - return $this->types[(string) $typeId]; |
|
| 46 | + return $this->types[(string)$typeId]; |
|
| 47 | 47 | } |
| 48 | 48 | } |