mirror of
https://github.com/Intervention/image.git
synced 2025-09-02 02:12:37 +02:00
Add doc blocks
This commit is contained in:
@@ -11,6 +11,11 @@ class Core extends Collection implements CoreInterface
|
|||||||
{
|
{
|
||||||
protected int $loops = 0;
|
protected int $loops = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::add()
|
||||||
|
*/
|
||||||
public function add(FrameInterface $frame): CoreInterface
|
public function add(FrameInterface $frame): CoreInterface
|
||||||
{
|
{
|
||||||
$this->push($frame);
|
$this->push($frame);
|
||||||
@@ -18,11 +23,21 @@ class Core extends Collection implements CoreInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::native()
|
||||||
|
*/
|
||||||
public function native(): mixed
|
public function native(): mixed
|
||||||
{
|
{
|
||||||
return $this->first()->native();
|
return $this->first()->native();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::setNative()
|
||||||
|
*/
|
||||||
public function setNative(mixed $native): self
|
public function setNative(mixed $native): self
|
||||||
{
|
{
|
||||||
$this->empty()->push(new Frame($native));
|
$this->empty()->push(new Frame($native));
|
||||||
@@ -30,6 +45,11 @@ class Core extends Collection implements CoreInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::frame()
|
||||||
|
*/
|
||||||
public function frame(int $position): FrameInterface
|
public function frame(int $position): FrameInterface
|
||||||
{
|
{
|
||||||
$frame = $this->getAtPosition($position);
|
$frame = $this->getAtPosition($position);
|
||||||
@@ -41,11 +61,21 @@ class Core extends Collection implements CoreInterface
|
|||||||
return $frame;
|
return $frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::loops()
|
||||||
|
*/
|
||||||
public function loops(): int
|
public function loops(): int
|
||||||
{
|
{
|
||||||
return $this->loops;
|
return $this->loops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::setLoops()
|
||||||
|
*/
|
||||||
public function setLoops(int $loops): self
|
public function setLoops(int $loops): self
|
||||||
{
|
{
|
||||||
$this->loops = $loops;
|
$this->loops = $loops;
|
||||||
@@ -53,16 +83,31 @@ class Core extends Collection implements CoreInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CollectionInterface::first()
|
||||||
|
*/
|
||||||
public function first(): FrameInterface
|
public function first(): FrameInterface
|
||||||
{
|
{
|
||||||
return parent::first();
|
return parent::first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CollectionInterface::last()
|
||||||
|
*/
|
||||||
public function last(): FrameInterface
|
public function last(): FrameInterface
|
||||||
{
|
{
|
||||||
return parent::last();
|
return parent::last();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone instance
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function __clone(): void
|
public function __clone(): void
|
||||||
{
|
{
|
||||||
foreach ($this->items as $key => $frame) {
|
foreach ($this->items as $key => $frame) {
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick;
|
namespace Intervention\Image\Drivers\Imagick;
|
||||||
|
|
||||||
use Collectable;
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use ImagickException;
|
use ImagickException;
|
||||||
use Iterator;
|
use Iterator;
|
||||||
@@ -16,6 +15,12 @@ class Core implements CoreInterface, Iterator
|
|||||||
{
|
{
|
||||||
protected int $iteratorIndex = 0;
|
protected int $iteratorIndex = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create new core instance
|
||||||
|
*
|
||||||
|
* @param Imagick $imagick
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function __construct(protected Imagick $imagick)
|
public function __construct(protected Imagick $imagick)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -116,6 +121,11 @@ class Core implements CoreInterface, Iterator
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::add()
|
||||||
|
*/
|
||||||
public function add(FrameInterface $frame): CoreInterface
|
public function add(FrameInterface $frame): CoreInterface
|
||||||
{
|
{
|
||||||
$imagick = $frame->native();
|
$imagick = $frame->native();
|
||||||
@@ -136,11 +146,21 @@ class Core implements CoreInterface, Iterator
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::count()
|
||||||
|
*/
|
||||||
public function count(): int
|
public function count(): int
|
||||||
{
|
{
|
||||||
return $this->imagick->getNumberImages();
|
return $this->imagick->getNumberImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see Interator::rewind()
|
||||||
|
*/
|
||||||
public function current(): mixed
|
public function current(): mixed
|
||||||
{
|
{
|
||||||
$this->imagick->setIteratorIndex($this->iteratorIndex);
|
$this->imagick->setIteratorIndex($this->iteratorIndex);
|
||||||
@@ -148,16 +168,31 @@ class Core implements CoreInterface, Iterator
|
|||||||
return new Frame($this->imagick->current());
|
return new Frame($this->imagick->current());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see Interator::rewind()
|
||||||
|
*/
|
||||||
public function next(): void
|
public function next(): void
|
||||||
{
|
{
|
||||||
$this->iteratorIndex = $this->iteratorIndex + 1;
|
$this->iteratorIndex = $this->iteratorIndex + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see Interator::rewind()
|
||||||
|
*/
|
||||||
public function key(): mixed
|
public function key(): mixed
|
||||||
{
|
{
|
||||||
return $this->iteratorIndex;
|
return $this->iteratorIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see Interator::rewind()
|
||||||
|
*/
|
||||||
public function valid(): bool
|
public function valid(): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -169,16 +204,31 @@ class Core implements CoreInterface, Iterator
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see Interator::rewind()
|
||||||
|
*/
|
||||||
public function rewind(): void
|
public function rewind(): void
|
||||||
{
|
{
|
||||||
$this->iteratorIndex = 0;
|
$this->iteratorIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::native()
|
||||||
|
*/
|
||||||
public function native(): mixed
|
public function native(): mixed
|
||||||
{
|
{
|
||||||
return $this->imagick;
|
return $this->imagick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::setNative()
|
||||||
|
*/
|
||||||
public function setNative(mixed $native): CoreInterface
|
public function setNative(mixed $native): CoreInterface
|
||||||
{
|
{
|
||||||
$this->imagick = $native;
|
$this->imagick = $native;
|
||||||
@@ -186,6 +236,11 @@ class Core implements CoreInterface, Iterator
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::frame()
|
||||||
|
*/
|
||||||
public function frame(int $position): FrameInterface
|
public function frame(int $position): FrameInterface
|
||||||
{
|
{
|
||||||
foreach ($this->imagick as $core) {
|
foreach ($this->imagick as $core) {
|
||||||
@@ -197,11 +252,21 @@ class Core implements CoreInterface, Iterator
|
|||||||
throw new AnimationException('Frame #' . $position . ' could not be found in the image.');
|
throw new AnimationException('Frame #' . $position . ' could not be found in the image.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::loops()
|
||||||
|
*/
|
||||||
public function loops(): int
|
public function loops(): int
|
||||||
{
|
{
|
||||||
return $this->imagick->getImageIterations();
|
return $this->imagick->getImageIterations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see CoreInterface::setLoops()
|
||||||
|
*/
|
||||||
public function setLoops(int $loops): CoreInterface
|
public function setLoops(int $loops): CoreInterface
|
||||||
{
|
{
|
||||||
$this->imagick = $this->imagick->coalesceImages();
|
$this->imagick = $this->imagick->coalesceImages();
|
||||||
@@ -246,6 +311,11 @@ class Core implements CoreInterface, Iterator
|
|||||||
return $frames;
|
return $frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone instance
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function __clone(): void
|
public function __clone(): void
|
||||||
{
|
{
|
||||||
$this->imagick = clone $this->imagick;
|
$this->imagick = clone $this->imagick;
|
||||||
|
Reference in New Issue
Block a user