1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-12 08:54:03 +02:00

Move method from trait to AbstractImage

This commit is contained in:
Oliver Vogel
2023-11-03 15:43:44 +01:00
parent 7eb29db7b8
commit 8041ae6329
2 changed files with 9 additions and 17 deletions

View File

@@ -17,16 +17,23 @@ use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SizeInterface; use Intervention\Image\Interfaces\SizeInterface;
use Intervention\Image\Traits\CanHandleInput; use Intervention\Image\Traits\CanHandleInput;
use Intervention\Image\Traits\CanResolveDriverClass; use Intervention\Image\Traits\CanResolveDriverClass;
use Intervention\Image\Traits\CanRunCallback;
abstract class AbstractImage implements ImageInterface abstract class AbstractImage implements ImageInterface
{ {
use CanResolveDriverClass; use CanResolveDriverClass;
use CanHandleInput; use CanHandleInput;
use CanRunCallback;
protected Collection $exif; protected Collection $exif;
protected function runCallback(?callable $callback, object $object): object
{
if (is_callable($callback)) {
$callback($object);
}
return $object;
}
public function mapFrames(callable $callback): ImageInterface public function mapFrames(callable $callback): ImageInterface
{ {
foreach ($this as $frame) { foreach ($this as $frame) {

View File

@@ -1,15 +0,0 @@
<?php
namespace Intervention\Image\Traits;
trait CanRunCallback
{
protected function runCallback(?callable $callback, object $object): object
{
if (is_callable($callback)) {
$callback($object);
}
return $object;
}
}