Version 0.7.0 #1
8
app/Captcha/Contracts/ImageManager.php
Normal file
8
app/Captcha/Contracts/ImageManager.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Captcha\Contracts;
|
||||
|
||||
interface ImageManager
|
||||
{
|
||||
public function createImage(int $width, int $height): Image;
|
||||
}
|
18
app/Captcha/Images/ImageManager.php
Normal file
18
app/Captcha/Images/ImageManager.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Captcha\Images;
|
||||
|
||||
use App\Captcha\Contracts\Image;
|
||||
use App\Captcha\Contracts\ImageManager as ImageManagerContract;
|
||||
|
||||
final class ImageManager implements ImageManagerContract
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $imageClassName
|
||||
) { }
|
||||
public function createImage(int $width, int $height): Image
|
||||
{
|
||||
return new $this->imageClassName($width, $height);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user