Skip to content

Commit

Permalink
Use mimeType instead of mime. Fixed in imbo/imbo#637
Browse files Browse the repository at this point in the history
  • Loading branch information
christeredvartsen committed May 26, 2022
1 parent d94c271 commit 676a9ff
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/Response/ImageProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected function getArrayOffsets(): array
'size' => fn (): int => $this->getOriginalSize(),
'width' => fn (): int => $this->getOriginalWidth(),
'height' => fn (): int => $this->getOriginalHeight(),
'mimetype' => fn (): string => $this->getOriginalMimeType(),
'mimeType' => fn (): string => $this->getOriginalMimeType(),
'extension' => fn (): string => $this->getOriginalExtension(),
];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Response/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(array $images, PageInfo $page, ?ImagesQuery $nextQue
*/
public static function fromHttpResponse(ResponseInterface $response, ImagesQuery $query): self
{
/** @var array{search:array<string,int>,images:array<array{imageIdentifier:string,checksum:string,originalChecksum:string,user:string,added:string,updated:string,size:int,width:int,height:int,mime:string,extension:string,metadata:array}>} */
/** @var array{search:array<string,int>,images:array<array{imageIdentifier:string,checksum:string,originalChecksum:string,user:string,added:string,updated:string,size:int,width:int,height:int,mimeType:string,extension:string,metadata:array}>} */
$body = Utils::convertResponseToArray($response);

$images = array_map(
Expand All @@ -47,7 +47,7 @@ public static function fromHttpResponse(ResponseInterface $response, ImagesQuery
$image['size'],
$image['width'],
$image['height'],
$image['mime'],
$image['mimeType'],
$image['extension'],
$image['metadata'],
))->withResponse($response),
Expand Down
12 changes: 6 additions & 6 deletions src/Response/Images/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class Image extends ApiResponse
private int $size;
private int $width;
private int $height;
private string $mime;
private string $mimeType;
private string $extension;
private array $metadata;

public function __construct(string $imageIdentifier, string $checksum, string $originalChecksum, string $user, DateTime $added, DateTime $updated, int $size, int $width, int $height, string $mime, string $extension, array $metadata)
public function __construct(string $imageIdentifier, string $checksum, string $originalChecksum, string $user, DateTime $added, DateTime $updated, int $size, int $width, int $height, string $mimeType, string $extension, array $metadata)
{
$this->imageIdentifier = $imageIdentifier;
$this->checksum = $checksum;
Expand All @@ -30,7 +30,7 @@ public function __construct(string $imageIdentifier, string $checksum, string $o
$this->size = $size;
$this->width = $width;
$this->height = $height;
$this->mime = $mime;
$this->mimeType = $mimeType;
$this->extension = $extension;
$this->metadata = $metadata;
}
Expand Down Expand Up @@ -80,9 +80,9 @@ public function getHeight(): int
return $this->height;
}

public function getMime(): string
public function getMimeType(): string
{
return $this->mime;
return $this->mimeType;
}

public function getExtension(): string
Expand All @@ -107,7 +107,7 @@ protected function getArrayOffsets(): array
'size' => fn (): int => $this->getSize(),
'width' => fn (): int => $this->getWidth(),
'height' => fn (): int => $this->getHeight(),
'mime' => fn (): string => $this->getMime(),
'mimeType' => fn (): string => $this->getMimeType(),
'extension' => fn (): string => $this->getExtension(),
'metadata' => fn (): array => $this->getMetadata(),
];
Expand Down
2 changes: 1 addition & 1 deletion tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public function testImageExists(): void
"size": 41423,
"width": 665,
"height": 463,
"mime": "image/png",
"mimeType": "image/png",
"extension": "png",
"metadata":{}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Response/ImagePropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public function testArrayAccess(): void
$this->assertArrayHasKey('size', $imageProperties);
$this->assertArrayHasKey('width', $imageProperties);
$this->assertArrayHasKey('height', $imageProperties);
$this->assertArrayHasKey('mimetype', $imageProperties);
$this->assertArrayHasKey('mimeType', $imageProperties);
$this->assertArrayHasKey('extension', $imageProperties);
$this->assertArrayNotHasKey('foobar', $imageProperties);

$this->assertSame('image-id', $imageProperties['imageIdentifier']);
$this->assertSame(123, $imageProperties['size']);
$this->assertSame(456, $imageProperties['width']);
$this->assertSame(789, $imageProperties['height']);
$this->assertSame('image/png', $imageProperties['mimetype']);
$this->assertSame('image/png', $imageProperties['mimeType']);
$this->assertSame('png', $imageProperties['extension']);
}
}
8 changes: 4 additions & 4 deletions tests/Response/Images/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ImageTest extends TestCase
* @covers ::getSize
* @covers ::getWidth
* @covers ::getHeight
* @covers ::getMime
* @covers ::getMimeType
* @covers ::getExtension
* @covers ::getMetadata
*/
Expand All @@ -37,7 +37,7 @@ public function testImageAccessors(): void
$this->assertSame(1, $image->getSize());
$this->assertSame(2, $image->getWidth());
$this->assertSame(3, $image->getHeight());
$this->assertSame('image/png', $image->getMime());
$this->assertSame('image/png', $image->getMimeType());
$this->assertSame('png', $image->getExtension());
$this->assertSame(['some' => 'data'], $image->getMetadata());
}
Expand All @@ -59,7 +59,7 @@ public function testArrayAccess(): void
$this->assertArrayHasKey('size', $image);
$this->assertArrayHasKey('width', $image);
$this->assertArrayHasKey('height', $image);
$this->assertArrayHasKey('mime', $image);
$this->assertArrayHasKey('mimeType', $image);
$this->assertArrayHasKey('extension', $image);
$this->assertArrayHasKey('metadata', $image);
$this->assertArrayNotHasKey('foobar', $image);
Expand All @@ -79,7 +79,7 @@ public function testArrayAccess(): void
$this->assertSame(1, $image['size']);
$this->assertSame(2, $image['width']);
$this->assertSame(3, $image['height']);
$this->assertSame('image/png', $image['mime']);
$this->assertSame('image/png', $image['mimeType']);
$this->assertSame('png', $image['extension']);
$this->assertSame(['some' => 'data'], $image['metadata']);
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Response/ImagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testCanCreateFromResponse(): void
'size' => 123,
'width' => 456,
'height' => 789,
'mime' => 'image/png',
'mimeType' => 'image/png',
'extension' => 'png',
'metadata' => [],
],
Expand All @@ -58,7 +58,7 @@ public function testCanCreateFromResponse(): void
'size' => 123,
'width' => 456,
'height' => 789,
'mime' => 'image/png',
'mimeType' => 'image/png',
'extension' => 'png',
'metadata' => [],
],
Expand All @@ -72,7 +72,7 @@ public function testCanCreateFromResponse(): void
'size' => 123,
'width' => 456,
'height' => 789,
'mime' => 'image/png',
'mimeType' => 'image/png',
'extension' => 'png',
'metadata' => [],
],
Expand Down Expand Up @@ -124,7 +124,7 @@ public function testArrayAccess(): void
'size' => 123,
'width' => 456,
'height' => 789,
'mime' => 'image/png',
'mimeType' => 'image/png',
'extension' => 'png',
'metadata' => [],
],
Expand All @@ -138,7 +138,7 @@ public function testArrayAccess(): void
'size' => 123,
'width' => 456,
'height' => 789,
'mime' => 'image/png',
'mimeType' => 'image/png',
'extension' => 'png',
'metadata' => [],
],
Expand All @@ -152,7 +152,7 @@ public function testArrayAccess(): void
'size' => 123,
'width' => 456,
'height' => 789,
'mime' => 'image/png',
'mimeType' => 'image/png',
'extension' => 'png',
'metadata' => [],
],
Expand Down

0 comments on commit 676a9ff

Please sign in to comment.