@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | /** |
| 542 | 542 | * @param EventDeleted $eventDeleted |
| 543 | - * @return null |
|
| 543 | + * @return JsonDocument |
|
| 544 | 544 | */ |
| 545 | 545 | protected function applyEventDeleted(EventDeleted $eventDeleted) |
| 546 | 546 | { |
@@ -651,6 +651,9 @@ discard block |
||
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | + /** |
|
| 655 | + * @param string $eventId |
|
| 656 | + */ |
|
| 654 | 657 | private function generateSameAs($eventId, $name) |
| 655 | 658 | { |
| 656 | 659 | $eventSlug = $this->slugger->slug($name); |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | $eventJsonLD->{'@id'} = $this->iriGenerator->iri($eventCopied->getItemId()); |
| 523 | 523 | |
| 524 | 524 | // Set the new calendar. |
| 525 | - $eventJsonLD = (object) array_merge( |
|
| 526 | - (array) $eventJsonLD, |
|
| 525 | + $eventJsonLD = (object)array_merge( |
|
| 526 | + (array)$eventJsonLD, |
|
| 527 | 527 | $eventCopied->getCalendar()->toJsonLd() |
| 528 | 528 | ); |
| 529 | 529 | |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | // Set available to and from. |
| 538 | 538 | $availableTo = AvailableTo::createFromCalendar($eventCopied->getCalendar()); |
| 539 | - $eventJsonLD->availableTo = (string) $availableTo; |
|
| 539 | + $eventJsonLD->availableTo = (string)$availableTo; |
|
| 540 | 540 | unset($eventJsonLD->availableFrom); |
| 541 | 541 | |
| 542 | 542 | $newDocument = new JsonDocument($eventCopied->getItemId()); |
@@ -581,8 +581,8 @@ discard block |
||
| 581 | 581 | $jsonLD->availableTo = (string)$availableTo; |
| 582 | 582 | |
| 583 | 583 | // Remove old theme and event type. |
| 584 | - $jsonLD->terms = array_filter($jsonLD->terms, function ($term) { |
|
| 585 | - return $term->domain !== EventType::DOMAIN && $term->domain !== Theme::DOMAIN; |
|
| 584 | + $jsonLD->terms = array_filter($jsonLD->terms, function($term) { |
|
| 585 | + return $term->domain !== EventType::DOMAIN && $term->domain !== Theme::DOMAIN; |
|
| 586 | 586 | }); |
| 587 | 587 | $jsonLD->terms = array_values($jsonLD->terms); |
| 588 | 588 | |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | |
| 611 | 611 | $jsonLD->location = [ |
| 612 | 612 | '@type' => 'Place', |
| 613 | - ] + (array) $this->placeJSONLD($locationUpdated->getLocationId()->toNative()); |
|
| 613 | + ] + (array)$this->placeJSONLD($locationUpdated->getLocationId()->toNative()); |
|
| 614 | 614 | |
| 615 | 615 | return $document->withBody($jsonLD); |
| 616 | 616 | } |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | |
| 626 | 626 | $eventLd = $document->getBody(); |
| 627 | 627 | |
| 628 | - $eventLd->location->geo = (object) [ |
|
| 628 | + $eventLd->location->geo = (object)[ |
|
| 629 | 629 | 'latitude' => $geoCoordinatesUpdated->getCoordinates()->getLatitude()->toDouble(), |
| 630 | 630 | 'longitude' => $geoCoordinatesUpdated->getCoordinates()->getLongitude()->toDouble(), |
| 631 | 631 | ]; |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | { |
| 680 | 680 | $eventSlug = $this->slugger->slug($name); |
| 681 | 681 | return array( |
| 682 | - 'http://www.uitinvlaanderen.be/agenda/e/' . $eventSlug . '/' . $eventId, |
|
| 682 | + 'http://www.uitinvlaanderen.be/agenda/e/'.$eventSlug.'/'.$eventId, |
|
| 683 | 683 | ); |
| 684 | 684 | } |
| 685 | 685 | |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $jsonLD->name->{$this->getMainLanguage($jsonLD)->getCode()} = $majorInfoUpdated->getTitle(); |
| 445 | 445 | |
| 446 | 446 | $jsonLD->location = array( |
| 447 | - '@type' => 'Place', |
|
| 447 | + '@type' => 'Place', |
|
| 448 | 448 | ) + (array)$this->placeJSONLD($majorInfoUpdated->getLocation()->toNative()); |
| 449 | 449 | |
| 450 | 450 | $availableTo = AvailableTo::createFromCalendar($majorInfoUpdated->getCalendar()); |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | $jsonLD->location = [ |
| 482 | 482 | '@type' => 'Place', |
| 483 | - ] + (array) $this->placeJSONLD($locationUpdated->getLocationId()->toNative()); |
|
| 483 | + ] + (array) $this->placeJSONLD($locationUpdated->getLocationId()->toNative()); |
|
| 484 | 484 | |
| 485 | 485 | return $document->withBody($jsonLD); |
| 486 | 486 | } |
@@ -241,7 +241,7 @@ |
||
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | 243 | * @param PlaceDeleted $placeDeleted |
| 244 | - * @return null |
|
| 244 | + * @return JsonDocument |
|
| 245 | 245 | */ |
| 246 | 246 | protected function applyPlaceDeleted(PlaceDeleted $placeDeleted) |
| 247 | 247 | { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | ); |
| 213 | 213 | |
| 214 | 214 | $calendarJsonLD = $placeCreated->getCalendar()->toJsonLd(); |
| 215 | - $jsonLD = (object) array_merge((array) $jsonLD, $calendarJsonLD); |
|
| 215 | + $jsonLD = (object)array_merge((array)$jsonLD, $calendarJsonLD); |
|
| 216 | 216 | |
| 217 | 217 | $availableTo = AvailableTo::createFromCalendar($placeCreated->getCalendar()); |
| 218 | 218 | $jsonLD->availableTo = (string)$availableTo; |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | $jsonLD->availableTo = (string)$availableTo; |
| 286 | 286 | |
| 287 | 287 | // Remove old theme and event type. |
| 288 | - $jsonLD->terms = array_filter($jsonLD->terms, function ($term) { |
|
| 289 | - return $term->domain !== EventType::DOMAIN && $term->domain !== Theme::DOMAIN; |
|
| 288 | + $jsonLD->terms = array_filter($jsonLD->terms, function($term) { |
|
| 289 | + return $term->domain !== EventType::DOMAIN && $term->domain !== Theme::DOMAIN; |
|
| 290 | 290 | }); |
| 291 | 291 | |
| 292 | 292 | $eventType = $majorInfoUpdated->getEventType(); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | // @replay_i18n |
| 353 | 353 | // @see https://jira.uitdatabank.be/browse/III-2201 |
| 354 | 354 | $mainLanguageCode = $this->getMainLanguage($jsonLd)->getCode(); |
| 355 | - $jsonLd->address = (object) [ |
|
| 355 | + $jsonLd->address = (object)[ |
|
| 356 | 356 | $mainLanguageCode => $jsonLd->address, |
| 357 | 357 | ]; |
| 358 | 358 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | $placeLd = $document->getBody(); |
| 372 | 372 | |
| 373 | - $placeLd->geo = (object) [ |
|
| 373 | + $placeLd->geo = (object)[ |
|
| 374 | 374 | 'latitude' => $geoCoordinatesUpdated->getCoordinates()->getLatitude()->toDouble(), |
| 375 | 375 | 'longitude' => $geoCoordinatesUpdated->getCoordinates()->getLongitude()->toDouble(), |
| 376 | 376 | ]; |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | { |
| 383 | 383 | $document = $this->loadPlaceDocumentFromRepositoryById($markedAsDuplicate->getPlaceId()); |
| 384 | 384 | |
| 385 | - return $document->apply(function ($placeLd) use ($markedAsDuplicate) { |
|
| 385 | + return $document->apply(function($placeLd) use ($markedAsDuplicate) { |
|
| 386 | 386 | $placeLd->duplicateOf = $this->iriGenerator->iri($markedAsDuplicate->getDuplicateOf()); |
| 387 | 387 | return $placeLd; |
| 388 | 388 | }); |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | { |
| 393 | 393 | $document = $this->loadPlaceDocumentFromRepositoryById($markedAsCanonical->getPlaceId()); |
| 394 | 394 | |
| 395 | - return $document->apply(function ($placeLd) use ($markedAsCanonical) { |
|
| 395 | + return $document->apply(function($placeLd) use ($markedAsCanonical) { |
|
| 396 | 396 | $placeLd->duplicatedBy[] = $this->iriGenerator->iri($markedAsCanonical->getDuplicatedBy()); |
| 397 | 397 | foreach ($markedAsCanonical->getDuplicatesOfDuplicate() as $duplicateOfDuplicate) { |
| 398 | 398 | $placeLd->duplicatedBy[] = $this->iriGenerator->iri($duplicateOfDuplicate); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @param array $data |
| 35 | - * @return mixed The object instance |
|
| 35 | + * @return AbstractFacilitiesUpdated The object instance |
|
| 36 | 36 | */ |
| 37 | 37 | public static function deserialize(array $data) |
| 38 | 38 | { |
@@ -159,7 +159,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -9,8 +9,8 @@ |
||
| 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 | } |
@@ -154,7 +154,7 @@ |
||
| 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(), |
@@ -73,8 +73,8 @@ |
||
| 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 | |
@@ -19,7 +19,7 @@ |
||
| 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 | |
@@ -25,11 +25,11 @@ |
||
| 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 | /** |