for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace LauLamanApps\ApplePassbook\MetaData\Image;
use LauLamanApps\ApplePassbook\MetaData\Image;
use LogicException;
class LocalImage implements Image
{
private string $path;
private string $filename;
public function __construct(string $path, ?string $filename = null)
if (!file_exists($path)) {
throw new LogicException(sprintf('Image %s does not exist.', $path));
}
if (exif_imagetype($path) !== IMAGETYPE_PNG) {
throw new LogicException('Image should be of type PNG.');
$this->path = $path;
$this->filename = $filename ?? basename($path);
public function setFilename(string $filename): void
$this->filename = $filename;
public function getContents(): string
return (string) file_get_contents($this->path);
public function getPath(): string
return $this->path;
public function getFilename(): string
return $this->filename;