image-transform/src/DefaultDriver.php

26 lines
622 B
PHP
Raw Normal View History

2023-09-11 03:28:59 +00:00
<?php
/* image-transform | https://github.com/jobyone/image-transform | MIT License */
namespace ByJoby\ImageTransform;
use ByJoby\ImageTransform\Drivers\GDDriver;
/**
* Stores a default driver to be used when a driver is not set for an Image.
* Defaults to a GD driver.
*/
class DefaultDriver
{
/** @var DriverInterface|null */
protected static $driver;
2023-09-11 03:28:59 +00:00
public static function get(): DriverInterface
{
return static::$driver
?? static::$driver = new GDDriver();
}
public static function set(DriverInterface $driver): void
{
static::$driver = $driver;
}
}