image-transform/src/DefaultDriver.php

26 lines
No EOL
622 B
PHP

<?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;
public static function get(): DriverInterface
{
return static::$driver
?? static::$driver = new GDDriver();
}
public static function set(DriverInterface $driver): void
{
static::$driver = $driver;
}
}