mirror of
https://github.com/Intervention/image.git
synced 2025-08-12 08:54:03 +02:00
Rename classes ImageFactory
This commit is contained in:
@@ -9,7 +9,7 @@ use Intervention\Image\Interfaces\FactoryInterface;
|
|||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Traits\CanHandleInput;
|
use Intervention\Image\Traits\CanHandleInput;
|
||||||
|
|
||||||
class ImageFactory implements FactoryInterface
|
class Factory implements FactoryInterface
|
||||||
{
|
{
|
||||||
use CanHandleInput;
|
use CanHandleInput;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ class ImageFactory implements FactoryInterface
|
|||||||
{
|
{
|
||||||
$frames = new Collection();
|
$frames = new Collection();
|
||||||
|
|
||||||
$animation = new class ($frames) extends ImageFactory
|
$animation = new class ($frames) extends Factory
|
||||||
{
|
{
|
||||||
public function __construct(public Collection $frames)
|
public function __construct(public Collection $frames)
|
||||||
{
|
{
|
@@ -10,7 +10,7 @@ use Intervention\Image\Interfaces\ImageInterface;
|
|||||||
use Intervention\Image\Traits\CanCheckType;
|
use Intervention\Image\Traits\CanCheckType;
|
||||||
use Intervention\Image\Traits\CanHandleInput;
|
use Intervention\Image\Traits\CanHandleInput;
|
||||||
|
|
||||||
class ImageFactory implements FactoryInterface
|
class Factory implements FactoryInterface
|
||||||
{
|
{
|
||||||
use CanHandleInput;
|
use CanHandleInput;
|
||||||
use CanCheckType;
|
use CanCheckType;
|
||||||
@@ -35,7 +35,7 @@ class ImageFactory implements FactoryInterface
|
|||||||
$imagick = new Imagick();
|
$imagick = new Imagick();
|
||||||
$imagick->setFormat('gif');
|
$imagick->setFormat('gif');
|
||||||
|
|
||||||
$animation = new class ($imagick) extends ImageFactory
|
$animation = new class ($imagick) extends Factory
|
||||||
{
|
{
|
||||||
public function __construct(public Imagick $imagick)
|
public function __construct(public Imagick $imagick)
|
||||||
{
|
{
|
@@ -68,7 +68,7 @@ class ImageManager
|
|||||||
*/
|
*/
|
||||||
public function create(int $width, int $height): ImageInterface
|
public function create(int $width, int $height): ImageInterface
|
||||||
{
|
{
|
||||||
return $this->resolveDriverClass('ImageFactory')->newImage($width, $height);
|
return $this->resolveDriverClass('Factory')->newImage($width, $height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,7 +79,7 @@ class ImageManager
|
|||||||
*/
|
*/
|
||||||
public function animate(callable $callback): ImageInterface
|
public function animate(callable $callback): ImageInterface
|
||||||
{
|
{
|
||||||
return $this->resolveDriverClass('ImageFactory')->newAnimation($callback);
|
return $this->resolveDriverClass('Factory')->newAnimation($callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -10,6 +10,6 @@ trait CanBuildNewImage
|
|||||||
|
|
||||||
public function imageFactory(): FactoryInterface
|
public function imageFactory(): FactoryInterface
|
||||||
{
|
{
|
||||||
return $this->resolveDriverClass('ImageFactory');
|
return $this->resolveDriverClass('Factory');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Tests\Drivers\Abstract\Modifiers;
|
namespace Intervention\Image\Tests\Drivers\Abstract\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\Abstract\Modifiers\AbstractFitModifier;
|
use Intervention\Image\Drivers\Abstract\Modifiers\AbstractFitModifier;
|
||||||
use Intervention\Image\Drivers\Imagick\ImageFactory;
|
use Intervention\Image\Drivers\Imagick\Factory;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
use Intervention\Image\Tests\TestCase;
|
use Intervention\Image\Tests\TestCase;
|
||||||
@@ -26,7 +26,7 @@ class AbstractFitModifierTest extends TestCase
|
|||||||
{
|
{
|
||||||
$modifier = $this->getModifier(100, 200, 'center');
|
$modifier = $this->getModifier(100, 200, 'center');
|
||||||
|
|
||||||
$image = (new ImageFactory())->newImage($width, $height);
|
$image = (new Factory())->newImage($width, $height);
|
||||||
$size = $modifier->getCropSize($image);
|
$size = $modifier->getCropSize($image);
|
||||||
|
|
||||||
static::assertSame($expectedWidth, $size->width());
|
static::assertSame($expectedWidth, $size->width());
|
||||||
@@ -39,7 +39,7 @@ class AbstractFitModifierTest extends TestCase
|
|||||||
{
|
{
|
||||||
$modifier = $this->getModifier(200, 100, 'center');
|
$modifier = $this->getModifier(200, 100, 'center');
|
||||||
|
|
||||||
$image = (new ImageFactory())->newImage(300, 200);
|
$image = (new Factory())->newImage(300, 200);
|
||||||
$size = $modifier->getCropSize($image);
|
$size = $modifier->getCropSize($image);
|
||||||
$resize = $modifier->getResizeSize($size);
|
$resize = $modifier->getResizeSize($size);
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Tests\Drivers\Abstract\Modifiers;
|
namespace Intervention\Image\Tests\Drivers\Abstract\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\Abstract\Modifiers\AbstractPadModifier;
|
use Intervention\Image\Drivers\Abstract\Modifiers\AbstractPadModifier;
|
||||||
use Intervention\Image\Drivers\Imagick\ImageFactory;
|
use Intervention\Image\Drivers\Imagick\Factory;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
use Intervention\Image\Tests\TestCase;
|
use Intervention\Image\Tests\TestCase;
|
||||||
@@ -28,7 +28,7 @@ final class AbstractPadModifierTest extends TestCase
|
|||||||
{
|
{
|
||||||
$modifier = $this->getModifier(100, 200, 'ffffff', 'center');
|
$modifier = $this->getModifier(100, 200, 'ffffff', 'center');
|
||||||
|
|
||||||
$image = (new ImageFactory())->newImage($width, $height);
|
$image = (new Factory())->newImage($width, $height);
|
||||||
$size = $modifier->getCropSize($image);
|
$size = $modifier->getCropSize($image);
|
||||||
|
|
||||||
static::assertSame($expectedWidth, $size->width());
|
static::assertSame($expectedWidth, $size->width());
|
||||||
@@ -41,7 +41,7 @@ final class AbstractPadModifierTest extends TestCase
|
|||||||
{
|
{
|
||||||
$modifier = $this->getModifier(200, 100, 'ffffff', 'center');
|
$modifier = $this->getModifier(200, 100, 'ffffff', 'center');
|
||||||
|
|
||||||
$image = (new ImageFactory())->newImage(300, 200);
|
$image = (new Factory())->newImage(300, 200);
|
||||||
$resize = $modifier->getResizeSize($image);
|
$resize = $modifier->getResizeSize($image);
|
||||||
|
|
||||||
static::assertSame(200, $resize->width());
|
static::assertSame(200, $resize->width());
|
||||||
|
@@ -4,25 +4,25 @@ namespace Intervention\Image\Tests\Drivers\Gd;
|
|||||||
|
|
||||||
use GdImage;
|
use GdImage;
|
||||||
use Intervention\Image\Drivers\Gd\Image;
|
use Intervention\Image\Drivers\Gd\Image;
|
||||||
use Intervention\Image\Drivers\Gd\ImageFactory;
|
use Intervention\Image\Drivers\Gd\Factory;
|
||||||
use Intervention\Image\Tests\TestCase;
|
use Intervention\Image\Tests\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires extension gd
|
* @requires extension gd
|
||||||
* @covers \Intervention\Image\Drivers\Gd\ImageFactory
|
* @covers \Intervention\Image\Drivers\Gd\Factory
|
||||||
*/
|
*/
|
||||||
class ImageFactoryTest extends TestCase
|
class FactoryTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testNewImage(): void
|
public function testNewImage(): void
|
||||||
{
|
{
|
||||||
$factory = new ImageFactory();
|
$factory = new Factory();
|
||||||
$image = $factory->newImage(3, 2);
|
$image = $factory->newImage(3, 2);
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNewAnimation(): void
|
public function testNewAnimation(): void
|
||||||
{
|
{
|
||||||
$factory = new ImageFactory();
|
$factory = new Factory();
|
||||||
$image = $factory->newAnimation(function ($animation) {
|
$image = $factory->newAnimation(function ($animation) {
|
||||||
$animation->add($this->getTestImagePath('blue.gif'), 1.2);
|
$animation->add($this->getTestImagePath('blue.gif'), 1.2);
|
||||||
$animation->add($this->getTestImagePath('red.gif'), 1.2);
|
$animation->add($this->getTestImagePath('red.gif'), 1.2);
|
||||||
@@ -33,7 +33,7 @@ class ImageFactoryTest extends TestCase
|
|||||||
|
|
||||||
public function testNewCore(): void
|
public function testNewCore(): void
|
||||||
{
|
{
|
||||||
$factory = new ImageFactory();
|
$factory = new Factory();
|
||||||
$core = $factory->newCore(3, 2);
|
$core = $factory->newCore(3, 2);
|
||||||
$this->assertInstanceOf(GdImage::class, $core);
|
$this->assertInstanceOf(GdImage::class, $core);
|
||||||
}
|
}
|
@@ -4,25 +4,25 @@ namespace Intervention\Image\Tests\Drivers\Imagick;
|
|||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\Imagick\Image;
|
use Intervention\Image\Drivers\Imagick\Image;
|
||||||
use Intervention\Image\Drivers\Imagick\ImageFactory;
|
use Intervention\Image\Drivers\Imagick\Factory;
|
||||||
use Intervention\Image\Tests\TestCase;
|
use Intervention\Image\Tests\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires extension imagick
|
* @requires extension imagick
|
||||||
* @covers \Intervention\Image\Drivers\Imagick\ImageFactory
|
* @covers \Intervention\Image\Drivers\Imagick\Factory
|
||||||
*/
|
*/
|
||||||
class ImageFactoryTest extends TestCase
|
class FactoryTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testNewImage(): void
|
public function testNewImage(): void
|
||||||
{
|
{
|
||||||
$factory = new ImageFactory();
|
$factory = new Factory();
|
||||||
$image = $factory->newImage(3, 2);
|
$image = $factory->newImage(3, 2);
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNewAnimation(): void
|
public function testNewAnimation(): void
|
||||||
{
|
{
|
||||||
$factory = new ImageFactory();
|
$factory = new Factory();
|
||||||
$image = $factory->newAnimation(function ($animation) {
|
$image = $factory->newAnimation(function ($animation) {
|
||||||
$animation->add($this->getTestImagePath('blue.gif'), 1.2);
|
$animation->add($this->getTestImagePath('blue.gif'), 1.2);
|
||||||
$animation->add($this->getTestImagePath('red.gif'), 1.2);
|
$animation->add($this->getTestImagePath('red.gif'), 1.2);
|
||||||
@@ -33,7 +33,7 @@ class ImageFactoryTest extends TestCase
|
|||||||
|
|
||||||
protected function testNewCore(): void
|
protected function testNewCore(): void
|
||||||
{
|
{
|
||||||
$factory = new ImageFactory();
|
$factory = new Factory();
|
||||||
$core = $factory->newCore(3, 2);
|
$core = $factory->newCore(3, 2);
|
||||||
$this->assertInstanceOf(Imagick::class, $core);
|
$this->assertInstanceOf(Imagick::class, $core);
|
||||||
}
|
}
|
Reference in New Issue
Block a user