@@ -9,7 +9,6 @@ |
||
| 9 | 9 | use CultuurNet\UDB3\Variations\Model\Properties\Description; |
| 10 | 10 | use CultuurNet\UDB3\Variations\Model\Properties\Id; |
| 11 | 11 | use JsonSchema\Validator; |
| 12 | -use ValueObjects\String\String; |
|
| 13 | 12 | use stdClass; |
| 14 | 13 | |
| 15 | 14 | class EditDescriptionJSONDeserializer extends JSONDeserializer |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | private function generateUrl(MediaObject $mediaObject) |
| 78 | 78 | { |
| 79 | 79 | $extensionGuesser = ExtensionGuesser::getInstance(); |
| 80 | - $fileExtension = $extensionGuesser->guess((string) $mediaObject->getMimeType()); |
|
| 80 | + $fileExtension = $extensionGuesser->guess((string)$mediaObject->getMimeType()); |
|
| 81 | 81 | $fileId = $mediaObject->getFileId(); |
| 82 | 82 | |
| 83 | - return Url::fromNative($this->iriGenerator->iri($fileId.'.'.$fileExtension)); |
|
| 83 | + return Url::fromNative($this->iriGenerator->iri($fileId . '.' . $fileExtension)); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | $fileId = $uploadImage->getFileId(); |
| 92 | 92 | $mimeType = $uploadImage->getMimeType(); |
| 93 | 93 | $extensionGuesser = ExtensionGuesser::getInstance(); |
| 94 | - $extension = $extensionGuesser->guess((string) $mimeType); |
|
| 95 | - $fileName = (string) $uploadImage->getFileId().'.'.$extension; |
|
| 94 | + $extension = $extensionGuesser->guess((string)$mimeType); |
|
| 95 | + $fileName = (string)$uploadImage->getFileId() . '.' . $extension; |
|
| 96 | 96 | |
| 97 | 97 | $this->filesystem->rename( |
| 98 | - $this->uploadDirectory.'/'.$fileName, |
|
| 99 | - $this->mediaDirectory.'/'.$fileName |
|
| 98 | + $this->uploadDirectory . '/' . $fileName, |
|
| 99 | + $this->mediaDirectory . '/' . $fileName |
|
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | $this->create( |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $uploadImage->getCopyrightHolder() |
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | - $jobInfo = ['file_id' => (string) $fileId]; |
|
| 109 | + $jobInfo = ['file_id' => (string)$fileId]; |
|
| 110 | 110 | $this->logger->info('job_info', $jobInfo); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function get(UUID $fileId) |
| 117 | 117 | { |
| 118 | - $mediaObject = $this->repository->load((string) $fileId); |
|
| 118 | + $mediaObject = $this->repository->load((string)$fileId); |
|
| 119 | 119 | $mediaObject->setUrl($this->generateUrl($mediaObject)); |
| 120 | 120 | |
| 121 | 121 | return $mediaObject; |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | - * @return string |
|
| 119 | + * @return UUID |
|
| 120 | 120 | */ |
| 121 | 121 | public function getFileId() |
| 122 | 122 | { |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | use CultuurNet\UDB3\Variations\Model\Properties\Description; |
| 10 | 10 | use CultuurNet\UDB3\Variations\Model\Properties\Id; |
| 11 | 11 | use JsonSchema\Validator; |
| 12 | -use ValueObjects\String\String; |
|
| 13 | 12 | use stdClass; |
| 14 | 13 | |
| 15 | 14 | class EditDescriptionJSONDeserializer extends JSONDeserializer |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | return [ |
| 148 | 148 | 'mime_type' => $this->mimeType, |
| 149 | - 'url' => (string) $this->url, |
|
| 150 | - 'thumbnail_url' => (string) $this->thumbnailUrl, |
|
| 151 | - 'description' => (string) $this->description, |
|
| 152 | - 'copyright_holder' => (string) $this->copyrightHolder, |
|
| 153 | - 'file_id' => (string) $this->fileId, |
|
| 149 | + 'url' => (string)$this->url, |
|
| 150 | + 'thumbnail_url' => (string)$this->thumbnailUrl, |
|
| 151 | + 'description' => (string)$this->description, |
|
| 152 | + 'copyright_holder' => (string)$this->copyrightHolder, |
|
| 153 | + 'file_id' => (string)$this->fileId, |
|
| 154 | 154 | ]; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | $jsonLd = [ |
| 164 | 164 | // TODO: use an iri generator to generate a proper id |
| 165 | - '@id' => (string) $this->getFileId(), |
|
| 165 | + '@id' => (string)$this->getFileId(), |
|
| 166 | 166 | // TODO: base type off of MIME |
| 167 | 167 | '@type' => 'schema:MediaObject', |
| 168 | - 'contentUrl' => (string) $this->url, |
|
| 169 | - 'thumbnailUrl' => (string) $this->thumbnailUrl, |
|
| 170 | - 'description' => (string) $this->description, |
|
| 171 | - 'copyrightHolder' => (string) $this->copyrightHolder, |
|
| 168 | + 'contentUrl' => (string)$this->url, |
|
| 169 | + 'thumbnailUrl' => (string)$this->thumbnailUrl, |
|
| 170 | + 'description' => (string)$this->description, |
|
| 171 | + 'copyrightHolder' => (string)$this->copyrightHolder, |
|
| 172 | 172 | ]; |
| 173 | 173 | |
| 174 | 174 | return $jsonLd; |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * @return mixed The object instance |
|
| 31 | + * @return ImageAdded The object instance |
|
| 32 | 32 | */ |
| 33 | 33 | public static function deserialize(array $data) |
| 34 | 34 | { |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * @return mixed The object instance |
|
| 33 | + * @return ImageUpdated The object instance |
|
| 34 | 34 | */ |
| 35 | 35 | public static function deserialize(array $data) |
| 36 | 36 | { |
@@ -69,8 +69,8 @@ |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $fileId = new UUID($this->uuidGenerator->generate()); |
| 72 | - $fileName = $fileId.'.'.$file->guessExtension(); |
|
| 73 | - $destination = $this->getUploadDirectory().'/'.$fileName; |
|
| 72 | + $fileName = $fileId . '.' . $file->guessExtension(); |
|
| 73 | + $destination = $this->getUploadDirectory() . '/' . $fileName; |
|
| 74 | 74 | $stream = fopen($file->getRealPath(), 'r+'); |
| 75 | 75 | $this->filesystem->writeStream($destination, $stream); |
| 76 | 76 | fclose($stream); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * @return mixed The object instance |
|
| 31 | + * @return ImageAdded The object instance |
|
| 32 | 32 | */ |
| 33 | 33 | public static function deserialize(array $data) |
| 34 | 34 | { |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * @return mixed The object instance |
|
| 33 | + * @return ImageUpdated The object instance |
|
| 34 | 34 | */ |
| 35 | 35 | public static function deserialize(array $data) |
| 36 | 36 | { |