diff --git a/src/Config.php b/src/Config.php index 26cedc6b..4954fdff 100644 --- a/src/Config.php +++ b/src/Config.php @@ -5,9 +5,8 @@ declare(strict_types=1); namespace Intervention\Image; use Intervention\Image\Exceptions\InputException; -use Intervention\Image\Interfaces\ConfigInterface; -class Config implements ConfigInterface +class Config { /** * Create config object instance @@ -25,30 +24,20 @@ class Config implements ConfigInterface } /** - * {@inheritdoc} + * Set values of given config options * - * @see ConfigInterface::setOption() - */ - public function setOption(string $name, mixed $value): self - { - if (!property_exists($this, $name)) { - throw new InputException('Property ' . $name . ' does not exists for ' . $this::class . '.'); - } - - $this->{$name} = $value; - - return $this; - } - - /** - * {@inheritdoc} - * - * @see COnfigInterface::setOptions() + * @param mixed $options + * @throws InputException + * @return Config */ public function setOptions(mixed ...$options): self { foreach ($options as $name => $value) { - $this->setOption($name, $value); + if (!property_exists($this, $name)) { + throw new InputException('Property ' . $name . ' does not exists for ' . $this::class . '.'); + } + + $this->{$name} = $value; } return $this; diff --git a/src/Drivers/AbstractDriver.php b/src/Drivers/AbstractDriver.php index 1ccd79fd..9741bea6 100644 --- a/src/Drivers/AbstractDriver.php +++ b/src/Drivers/AbstractDriver.php @@ -10,7 +10,6 @@ use Intervention\Image\Exceptions\NotSupportedException; use Intervention\Image\InputHandler; use Intervention\Image\Interfaces\AnalyzerInterface; use Intervention\Image\Interfaces\ColorInterface; -use Intervention\Image\Interfaces\ConfigInterface; use Intervention\Image\Interfaces\DecoderInterface; use Intervention\Image\Interfaces\DriverInterface; use Intervention\Image\Interfaces\EncoderInterface; @@ -25,7 +24,7 @@ abstract class AbstractDriver implements DriverInterface /** * Driver options */ - protected ConfigInterface $config; + protected Config $config; /** * @throws DriverException @@ -42,7 +41,7 @@ abstract class AbstractDriver implements DriverInterface * * @see DriverInterface::config() */ - public function config(): ConfigInterface + public function config(): Config { return $this->config; } diff --git a/src/Interfaces/ConfigInterface.php b/src/Interfaces/ConfigInterface.php deleted file mode 100644 index 5b312edf..00000000 --- a/src/Interfaces/ConfigInterface.php +++ /dev/null @@ -1,29 +0,0 @@ -assertFalse($result->decodeAnimation); $this->assertEquals('f00', $result->blendingColor); - $result = $config->setOption('blendingColor', '000'); + $result = $config->setOptions(blendingColor: '000'); $this->assertFalse($config->autoOrientation); $this->assertFalse($config->decodeAnimation); $this->assertEquals('000', $config->blendingColor); - - $this->assertFalse($result->autoOrientation); - $this->assertFalse($result->decodeAnimation); - $this->assertEquals('000', $result->blendingColor); } }