Completed
Push — master ( bfece9...22f2d6 )
by Kristof
28:03 queued 20:52
created
src/Media/Serialization/MediaObjectSerializer.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -3,12 +3,9 @@
 block discarded – undo
3 3
 namespace CultuurNet\UDB3\Media\Serialization;
4 4
 
5 5
 use CultuurNet\UDB3\Iri\IriGeneratorInterface;
6
-use CultuurNet\UDB3\Media\MediaObject;
7 6
 use CultuurNet\UDB3\Media\Properties\MIMEType;
8
-use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
9 7
 use Symfony\Component\Serializer\Exception\UnsupportedException;
10 8
 use Symfony\Component\Serializer\SerializerInterface;
11
-use ValueObjects\Web\Url;
12 9
 
13 10
 class MediaObjectSerializer implements SerializerInterface
14 11
 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
         $normalizedData = [
37 37
             '@id' => $this->iriGenerator->iri($mediaObject->getMediaObjectId()),
38 38
             '@type' => $this->serializeMimeType($mediaObject->getMimeType()),
39
-            'contentUrl' => (string) $mediaObject->getSourceLocation(),
40
-            'thumbnailUrl' => (string) $mediaObject->getSourceLocation(),
41
-            'description' => (string) $mediaObject->getDescription(),
42
-            'copyrightHolder' => (string) $mediaObject->getCopyrightHolder(),
39
+            'contentUrl' => (string)$mediaObject->getSourceLocation(),
40
+            'thumbnailUrl' => (string)$mediaObject->getSourceLocation(),
41
+            'description' => (string)$mediaObject->getDescription(),
42
+            'copyrightHolder' => (string)$mediaObject->getCopyrightHolder(),
43 43
         ];
44 44
 
45 45
         return $normalizedData;
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function serializeMimeType(MIMEType $mimeType)
49 49
     {
50
-        $typeParts = explode('/', (string) $mimeType);
50
+        $typeParts = explode('/', (string)$mimeType);
51 51
         $type = array_shift($typeParts);
52 52
 
53 53
         if ($type !== 'image') {
Please login to merge, or discard this patch.
src/Media/MediaManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             Url::fromNative($destinationIri)
116 116
         );
117 117
 
118
-        $jobInfo = ['file_id' => (string) $uploadImage->getFileId()];
118
+        $jobInfo = ['file_id' => (string)$uploadImage->getFileId()];
119 119
         $this->logger->info('job_info', $jobInfo);
120 120
     }
121 121
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     public function get(UUID $fileId)
126 126
     {
127 127
         try {
128
-            $mediaObject = $this->repository->load((string) $fileId);
128
+            $mediaObject = $this->repository->load((string)$fileId);
129 129
         } catch (AggregateNotFoundException $e) {
130 130
             throw new MediaObjectNotFoundException(
131 131
                 sprintf("Media object with id '%s' not found", $fileId),
Please login to merge, or discard this patch.
src/Media/Image.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -109,11 +109,11 @@
 block discarded – undo
109 109
     public function serialize()
110 110
     {
111 111
         return [
112
-            'media_object_id' => (string) $this->getMediaObjectId(),
113
-            'mime_type' => (string) $this->getMimeType(),
114
-            'description' => (string) $this->getDescription(),
115
-            'copyright_holder' => (string) $this->getCopyrightHolder(),
116
-            'source_location' => (string) $this->getSourceLocation()
112
+            'media_object_id' => (string)$this->getMediaObjectId(),
113
+            'mime_type' => (string)$this->getMimeType(),
114
+            'description' => (string)$this->getDescription(),
115
+            'copyright_holder' => (string)$this->getCopyrightHolder(),
116
+            'source_location' => (string)$this->getSourceLocation()
117 117
         ];
118 118
     }
119 119
 }
Please login to merge, or discard this patch.
src/Media/Events/MediaObjectCreated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
             'mime_type' => $this->getMimeType()->toNative(),
108 108
             'description' => $this->getDescription()->toNative(),
109 109
             'copyright_holder' => $this->getCopyrightHolder()->toNative(),
110
-            'source_location' => (string) $this->getSourceLocation()
110
+            'source_location' => (string)$this->getSourceLocation()
111 111
         );
112 112
     }
113 113
 
Please login to merge, or discard this patch.
src/Event/Event.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -462,7 +462,7 @@
 block discarded – undo
462 462
     {
463 463
         $duplicateMediaObject = array_filter(
464 464
             $this->getMediaObjects(),
465
-            function ($existingMediaObjectId) use ($image) {
465
+            function($existingMediaObjectId) use ($image) {
466 466
                 return $image
467 467
                     ->getMediaObjectId()
468 468
                     ->sameValueAs($existingMediaObjectId);
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,6 +86,7 @@  discard block
 block discarded – undo
86 86
      * @param Location $location
87 87
      * @param CalendarInterface $calendar
88 88
      * @param Theme/null $theme
89
+     * @param string $eventId
89 90
      *
90 91
      * @return Event
91 92
      */
@@ -195,9 +196,9 @@  discard block
 block discarded – undo
195 196
 
196 197
     /**
197 198
      * @param Language $language
198
-     * @param String|null $title
199
-     * @param String|null $shortDescription
200
-     * @param String|null $longDescription
199
+     * @param null|string $title
200
+     * @param null|string $shortDescription
201
+     * @param null|string $longDescription
201 202
      */
202 203
     public function applyTranslation(
203 204
         Language $language,
@@ -394,9 +395,6 @@  discard block
 block discarded – undo
394 395
     /**
395 396
      * Updated the contact info.
396 397
      *
397
-     * @param array $phones
398
-     * @param array $emails
399
-     * @param array $urls
400 398
      */
401 399
     public function updateContactPoint(ContactPoint $contactPoint)
402 400
     {
Please login to merge, or discard this patch.
Unused Use Statements   -8 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace CultuurNet\UDB3\Event;
4 4
 
5
-use Broadway\EventSourcing\EventSourcedAggregateRoot;
6 5
 use CultuurNet\UDB3\BookingInfo;
7 6
 use CultuurNet\UDB3\CalendarInterface;
8 7
 use CultuurNet\UDB3\Cdb\EventItemFactory;
@@ -42,18 +41,11 @@  discard block
 block discarded – undo
42 41
 use CultuurNet\UDB3\Language;
43 42
 use CultuurNet\UDB3\Location;
44 43
 use CultuurNet\UDB3\Media\Image;
45
-use CultuurNet\UDB3\Media\MediaObject;
46
-use CultuurNet\UDB3\Media\Properties\MIMEType;
47
-use CultuurNet\UDB3\Offer\Events\AbstractDescriptionTranslated;
48
-use CultuurNet\UDB3\Offer\Events\AbstractLabelAdded;
49
-use CultuurNet\UDB3\Offer\Events\AbstractLabelDeleted;
50
-use CultuurNet\UDB3\Offer\Events\AbstractTitleTranslated;
51 44
 use CultuurNet\UDB3\Offer\Offer;
52 45
 use CultuurNet\UDB3\Title;
53 46
 use CultuurNet\UDB3\Translation;
54 47
 use ValueObjects\Identity\UUID;
55 48
 use ValueObjects\String\String;
56
-use ValueObjects\Web\Url;
57 49
 
58 50
 class Event extends Offer
59 51
 {
Please login to merge, or discard this patch.
src/Offer/ImageUpdateTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,9 +89,9 @@
 block discarded – undo
89 89
     {
90 90
         return array(
91 91
             'item_id' => $this->itemId,
92
-            'media_object_id' => (string) $this->mediaObjectId,
93
-            'description' => (string) $this->description,
94
-            'copyright_holder' => (string) $this->copyrightHolder
92
+            'media_object_id' => (string)$this->mediaObjectId,
93
+            'description' => (string)$this->description,
94
+            'copyright_holder' => (string)$this->copyrightHolder
95 95
         );
96 96
     }
97 97
 
Please login to merge, or discard this patch.
src/Event/EventCommandHandler.php 1 patch
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@  discard block
 block discarded – undo
4 4
 namespace CultuurNet\UDB3\Event;
5 5
 
6 6
 use Broadway\Repository\RepositoryInterface;
7
-use CultuurNet\UDB3\CommandHandling\Udb3CommandHandler;
8 7
 use CultuurNet\UDB3\Event\Commands\AddImage;
9 8
 use CultuurNet\UDB3\Event\Commands\AddLabel;
10 9
 use CultuurNet\UDB3\Event\Commands\DeleteEvent;
@@ -23,9 +22,7 @@  discard block
 block discarded – undo
23 22
 use CultuurNet\UDB3\Event\Commands\UpdateTypicalAgeRange;
24 23
 use CultuurNet\UDB3\Label as Label;
25 24
 use CultuurNet\UDB3\Offer\OfferCommandHandler;
26
-use CultuurNet\UDB3\Search\Results;
27 25
 use CultuurNet\UDB3\Search\SearchServiceInterface;
28
-use Guzzle\Http\Exception\ClientErrorResponseException;
29 26
 use Psr\Log\LoggerAwareInterface;
30 27
 use Psr\Log\LoggerAwareTrait;
31 28
 
Please login to merge, or discard this patch.
src/Event/ReadModel/JSONLD/EventLDProjector.php 4 patches
Unused Use Statements   -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@  discard block
 block discarded – undo
13 13
 use CultuurNet\UDB3\CulturefeedSlugger;
14 14
 use CultuurNet\UDB3\EntityNotFoundException;
15 15
 use CultuurNet\UDB3\Event\DescriptionTranslated;
16
-use CultuurNet\UDB3\Event\EventEvent;
17 16
 use CultuurNet\UDB3\Event\Events\BookingInfoUpdated;
18 17
 use CultuurNet\UDB3\Event\Events\ContactPointUpdated;
19 18
 use CultuurNet\UDB3\Event\Events\DescriptionUpdated;
@@ -42,20 +41,15 @@  discard block
 block discarded – undo
42 41
 use CultuurNet\UDB3\Event\ReadModel\JSONLD\OrganizerServiceInterface;
43 42
 use CultuurNet\UDB3\Event\ReadModel\JSONLD\PlaceServiceInterface;
44 43
 use CultuurNet\UDB3\Event\TitleTranslated;
45
-use CultuurNet\UDB3\EventHandling\DelegateEventHandlingToSpecificMethodTrait;
46 44
 use CultuurNet\UDB3\EventServiceInterface;
47 45
 use CultuurNet\UDB3\Iri\IriGeneratorInterface;
48
-use CultuurNet\UDB3\Label;
49 46
 use CultuurNet\UDB3\LabelCollection;
50 47
 use CultuurNet\UDB3\Offer\ReadModel\JSONLD\CdbXMLItemBaseImporter;
51 48
 use CultuurNet\UDB3\Offer\ReadModel\JSONLD\OfferLDProjector;
52
-use CultuurNet\UDB3\Media\Serialization\MediaObjectSerializer;
53 49
 use CultuurNet\UDB3\Organizer\OrganizerProjectedToJSONLD;
54 50
 use CultuurNet\UDB3\OrganizerService;
55 51
 use CultuurNet\UDB3\Place\PlaceProjectedToJSONLD;
56 52
 use CultuurNet\UDB3\PlaceService;
57
-use CultuurNet\UDB3\ReadModel\JsonDocument;
58
-use CultuurNet\UDB3\SluggerInterface;
59 53
 use CultuurNet\UDB3\StringFilter\StringFilterInterface;
60 54
 use CultuurNet\UDB3\Theme;
61 55
 use Symfony\Component\Serializer\SerializerInterface;
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     /**
370 370
      * Return the media of an event if it already exists.
371 371
      *
372
-     * @param $eventId
372
+     * @param string $eventId
373 373
      *  The id of the event.
374 374
      *
375 375
      * @return array
@@ -867,6 +867,9 @@  discard block
 block discarded – undo
867 867
         return $document;
868 868
     }
869 869
 
870
+    /**
871
+     * @param string $eventId
872
+     */
870 873
     private function generateSameAs($eventId, $name)
871 874
     {
872 875
         $eventSlug = $this->slugger->slug($name);
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 
478 478
         $jsonLD->name->nl = $majorInfoUpdated->getTitle();
479 479
         $jsonLD->location = array(
480
-          '@type' => 'Place',
480
+            '@type' => 'Place',
481 481
         ) + (array)$this->placeJSONLD($majorInfoUpdated->getLocation()->getCdbid());
482 482
 
483 483
         $calendarJsonLD = $majorInfoUpdated->getCalendar()->toJsonLd();
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
         $eventLd = $document->getBody();
684 684
 
685 685
         $eventLd->organizer = array(
686
-          '@type' => 'Organizer',
686
+            '@type' => 'Organizer',
687 687
         ) + (array)$this->organizerJSONLD($organizerUpdated->getOrganizerId());
688 688
 
689 689
         $this->repository->save($document->withBody($eventLd));
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     ) {
271 271
         $this->saveNewDocument(
272 272
             $eventId,
273
-            function (\stdClass $eventLd) use ($eventId, $cdbXmlNamespaceUri, $cdbXml, $domainMessage) {
273
+            function(\stdClass $eventLd) use ($eventId, $cdbXmlNamespaceUri, $cdbXml, $domainMessage) {
274 274
                 $eventLd = $this->projectEventCdbXmlToObject(
275 275
                     $eventLd,
276 276
                     $eventId,
@@ -327,13 +327,13 @@  discard block
 block discarded – undo
327 327
     ) {
328 328
         $this->saveNewDocument(
329 329
             $eventId,
330
-            function (\stdClass $eventLd) use ($cdbXmlNamespaceUri, $eventId, $cdbXml) {
330
+            function(\stdClass $eventLd) use ($cdbXmlNamespaceUri, $eventId, $cdbXml) {
331 331
                 return $this->projectEventCdbXmlToObject(
332 332
                     $eventLd,
333 333
                     $eventId,
334 334
                     $cdbXmlNamespaceUri,
335 335
                     $cdbXml
336
-                ) ;
336
+                );
337 337
             }
338 338
         );
339 339
     }
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     ) {
410 410
         $this->saveNewDocument(
411 411
             $eventCreated->getEventId(),
412
-            function (\stdClass $jsonLD) use ($eventCreated, $domainMessage) {
412
+            function(\stdClass $jsonLD) use ($eventCreated, $domainMessage) {
413 413
                 $jsonLD->{'@id'} = $this->iriGenerator->iri(
414 414
                     $eventCreated->getEventId()
415 415
                 );
@@ -481,11 +481,11 @@  discard block
 block discarded – undo
481 481
         ) + (array)$this->placeJSONLD($majorInfoUpdated->getLocation()->getCdbid());
482 482
 
483 483
         $calendarJsonLD = $majorInfoUpdated->getCalendar()->toJsonLd();
484
-        $jsonLD = (object) array_merge((array) $jsonLD, $calendarJsonLD);
484
+        $jsonLD = (object)array_merge((array)$jsonLD, $calendarJsonLD);
485 485
 
486 486
         // Remove old theme and event type.
487
-        $jsonLD->terms = array_filter($jsonLD->terms, function ($term) {
488
-            return $term->domain !== EventType::DOMAIN &&  $term->domain !== Theme::DOMAIN;
487
+        $jsonLD->terms = array_filter($jsonLD->terms, function($term) {
488
+            return $term->domain !== EventType::DOMAIN && $term->domain !== Theme::DOMAIN;
489 489
         });
490 490
 
491 491
         $eventType = $majorInfoUpdated->getEventType();
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
             return;
812 812
         }
813 813
 
814
-        $imageId = (string) $imageRemoved->getImage()->getMediaObjectId();
814
+        $imageId = (string)$imageRemoved->getImage()->getMediaObjectId();
815 815
 
816 816
         /**
817 817
          * Matches any object that is not the removed image.
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
          * @return bool
823 823
          *  Returns true when the media object does not match the image to remove.
824 824
          */
825
-        $shouldNotBeRemoved = function ($mediaObject) use ($imageId) {
825
+        $shouldNotBeRemoved = function($mediaObject) use ($imageId) {
826 826
             $containsId = !!strpos($mediaObject->{'@id'}, $imageId);
827 827
             return !$containsId;
828 828
         };
Please login to merge, or discard this patch.
src/LocalEntityService.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -78,6 +78,9 @@
 block discarded – undo
78 78
         return $document->getRawBody();
79 79
     }
80 80
 
81
+    /**
82
+     * @param string $id
83
+     */
81 84
     public function iri($id)
82 85
     {
83 86
         return $this->iriGenerator->iri($id);
Please login to merge, or discard this patch.