| @@ -6,10 +6,11 @@ use Meema\MeemaClient\Client; |
| 6 | 6 | use Meema\MeemaClient\Exceptions\InvalidFormatException; |
| 7 | 7 | use Meema\MeemaClient\Response\Response; |
| 8 | 8 | use Meema\MeemaClient\Traits\CollectionsResponse; |
| 9 | +use Meema\MeemaClient\Traits\ValidsUuid; |
| 9 | 10 | |
| 10 | 11 | class Media |
| 11 | 12 | { |
| 12 | | - use CollectionsResponse; |
| 13 | + use CollectionsResponse, ValidsUuid; |
| 13 | 14 | |
| 14 | 15 | |
| 15 | 16 | |
| @@ -68,8 +69,8 @@ class Media |
| 68 | 69 | |
| 69 | 70 | |
| 70 | 71 | |
| 71 | | - |
| 72 | | - |
| 72 | + |
| 73 | + |
| 73 | 74 | |
| 74 | 75 | |
| 75 | 76 | |
| @@ -103,8 +104,8 @@ class Media |
| 103 | 104 | |
| 104 | 105 | public function find($id) |
| 105 | 106 | { |
| 106 | | - if (! is_int($id)) { |
| 107 | | - throw new InvalidFormatException(); |
| 107 | + if (! $this->isValidUuid($id)) { |
| 108 | + throw new InvalidFormatException('ID is not a valid UUID'); |
| 108 | 109 | } |
| 109 | 110 | |
| 110 | 111 | $response = $this->client->request('GET', "media/${id}"); |
| @@ -138,8 +139,8 @@ class Media |
| 138 | 139 | */ |
| 139 | 140 | public function update($id, $name) |
| 140 | 141 | { |
| 141 | | - if (! is_int($id)) { |
| 142 | | - throw new InvalidFormatException(); |
| 142 | + if (! $this->isValidUuid($id)) { |
| 143 | + throw new InvalidFormatException('ID is not a valid UUID'); |
| 143 | 144 | } |
| 144 | 145 | |
| 145 | 146 | $name = is_array($name) ? $name : compact('name'); |
| @@ -161,8 +162,8 @@ class Media |
| 161 | 162 | $ids = is_array($ids) ? $ids : func_get_args(); |
| 162 | 163 | |
| 163 | 164 | foreach ($ids as $id) { |
| 164 | | - if (! is_int($id)) { |
| 165 | | - throw new InvalidFormatException(); |
| 165 | + if (! $this->isValidUuid($id)) { |
| 166 | + throw new InvalidFormatException('ID is not a valid UUID'); |
| 166 | 167 | } |
| 167 | 168 | } |
| 168 | 169 | |
| @@ -190,8 +191,8 @@ class Media |
| 190 | 191 | $ids = is_array($ids) ? $ids : func_get_args(); |
| 191 | 192 | |
| 192 | 193 | foreach ($ids as $id) { |
| 193 | | - if (! is_int($id)) { |
| 194 | | - throw new InvalidFormatException(); |
| 194 | + if (! $this->isValidUuid($id)) { |
| 195 | + throw new InvalidFormatException('ID is not a valid UUID'); |
| 195 | 196 | } |
| 196 | 197 | } |
| 197 | 198 | |
| @@ -219,8 +220,8 @@ class Media |
| 219 | 220 | $ids = is_array($ids) ? $ids : func_get_args(); |
| 220 | 221 | |
| 221 | 222 | foreach ($ids as $id) { |
| 222 | | - if (! is_int($id)) { |
| 223 | | - throw new InvalidFormatException(); |
| 223 | + if (! $this->isValidUuid($id)) { |
| 224 | + throw new InvalidFormatException('ID is not a valid UUID'); |
| 224 | 225 | } |
| 225 | 226 | } |
| 226 | 227 | |
| @@ -248,8 +249,8 @@ class Media |
| 248 | 249 | $ids = is_array($ids) ? $ids : func_get_args(); |
| 249 | 250 | |
| 250 | 251 | foreach ($ids as $id) { |
| 251 | | - if (! is_int($id)) { |
| 252 | | - throw new InvalidFormatException(); |
| 252 | + if (! $this->isValidUuid($id)) { |
| 253 | + throw new InvalidFormatException('ID is not a valid UUID'); |
| 253 | 254 | } |
| 254 | 255 | } |
| 255 | 256 | |
| @@ -277,8 +278,8 @@ class Media |
| 277 | 278 | $ids = is_array($ids) ? $ids : func_get_args(); |
| 278 | 279 | |
| 279 | 280 | foreach ($ids as $id) { |
| 280 | | - if (! is_int($id)) { |
| 281 | | - throw new InvalidFormatException(); |
| 281 | + if (! $this->isValidUuid($id)) { |
| 282 | + throw new InvalidFormatException('ID is not a valid UUID'); |
| 282 | 283 | } |
| 283 | 284 | } |
| 284 | 285 | |
| @@ -306,8 +307,8 @@ class Media |
| 306 | 307 | $ids = is_array($ids) ? $ids : func_get_args(); |
| 307 | 308 | |
| 308 | 309 | foreach ($ids as $id) { |
| 309 | | - if (! is_int($id)) { |
| 310 | | - throw new InvalidFormatException(); |
| 310 | + if (! $this->isValidUuid($id)) { |
| 311 | + throw new InvalidFormatException('ID is not a valid UUID'); |
| 311 | 312 | } |
| 312 | 313 | } |
| 313 | 314 | |