1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-20 04:31:24 +02:00

Edit doc blocks

This commit is contained in:
Oliver Vogel
2024-01-28 12:29:45 +01:00
parent 34e665b7e0
commit c78838ffe9
4 changed files with 122 additions and 0 deletions

View File

@@ -14,6 +14,16 @@ use Intervention\Image\Interfaces\SizeInterface;
class Frame implements FrameInterface class Frame implements FrameInterface
{ {
/**
* Create new frame instance
*
* @param GdImage $native
* @param float|int $delay
* @param int $dispose
* @param int $offset_left
* @param int $offset_top
* @return void
*/
public function __construct( public function __construct(
protected GdImage $native, protected GdImage $native,
protected float $delay = 0, protected float $delay = 0,
@@ -24,11 +34,21 @@ class Frame implements FrameInterface
// //
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::toImage()
*/
public function toImage(DriverInterface $driver): ImageInterface public function toImage(DriverInterface $driver): ImageInterface
{ {
return new Image($driver, new Core([$this])); return new Image($driver, new Core([$this]));
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::setNative()
*/
public function setNative($native): FrameInterface public function setNative($native): FrameInterface
{ {
$this->native = $native; $this->native = $native;
@@ -36,21 +56,41 @@ class Frame implements FrameInterface
return $this; return $this;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::native()
*/
public function native(): GdImage public function native(): GdImage
{ {
return $this->native; return $this->native;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::size()
*/
public function size(): SizeInterface public function size(): SizeInterface
{ {
return new Rectangle(imagesx($this->native), imagesy($this->native)); return new Rectangle(imagesx($this->native), imagesy($this->native));
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::delay()
*/
public function delay(): float public function delay(): float
{ {
return $this->delay; return $this->delay;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::setDelay()
*/
public function setDelay(float $delay): FrameInterface public function setDelay(float $delay): FrameInterface
{ {
$this->delay = $delay; $this->delay = $delay;
@@ -58,11 +98,21 @@ class Frame implements FrameInterface
return $this; return $this;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::dispose()
*/
public function dispose(): int public function dispose(): int
{ {
return $this->dispose; return $this->dispose;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::setDispose()
*/
public function setDispose(int $dispose): FrameInterface public function setDispose(int $dispose): FrameInterface
{ {
$this->dispose = $dispose; $this->dispose = $dispose;
@@ -70,6 +120,11 @@ class Frame implements FrameInterface
return $this; return $this;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::setOffset()
*/
public function setOffset(int $left, int $top): FrameInterface public function setOffset(int $left, int $top): FrameInterface
{ {
$this->offset_left = $left; $this->offset_left = $left;
@@ -78,11 +133,21 @@ class Frame implements FrameInterface
return $this; return $this;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::offsetLeft()
*/
public function offsetLeft(): int public function offsetLeft(): int
{ {
return $this->offset_left; return $this->offset_left;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::setOffsetLeft()
*/
public function setOffsetLeft(int $offset): FrameInterface public function setOffsetLeft(int $offset): FrameInterface
{ {
$this->offset_left = $offset; $this->offset_left = $offset;
@@ -90,11 +155,21 @@ class Frame implements FrameInterface
return $this; return $this;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::offsetTop()
*/
public function offsetTop(): int public function offsetTop(): int
{ {
return $this->offset_top; return $this->offset_top;
} }
/**
* {@inheritdoc}
*
* @see FrameInterface::setOffsetTop()
*/
public function setOffsetTop(int $offset): FrameInterface public function setOffsetTop(int $offset): FrameInterface
{ {
$this->offset_top = $offset; $this->offset_top = $offset;

View File

@@ -9,11 +9,23 @@ use Intervention\Image\Interfaces\ModifierInterface;
class ModifierStack implements ModifierInterface class ModifierStack implements ModifierInterface
{ {
/**
* Create new modifier stack object with an array of modifier objects
*
* @param array $modifiers
* @return void
*/
public function __construct(protected array $modifiers) public function __construct(protected array $modifiers)
{ {
// //
} }
/**
* Apply all modifiers in stack to the given image
*
* @param ImageInterface $image
* @return ImageInterface
*/
public function apply(ImageInterface $image): ImageInterface public function apply(ImageInterface $image): ImageInterface
{ {
foreach ($this->modifiers as $modifier) { foreach ($this->modifiers as $modifier) {
@@ -23,6 +35,12 @@ class ModifierStack implements ModifierInterface
return $image; return $image;
} }
/**
* Append new modifier to the stack
*
* @param ModifierInterface $modifier
* @return ModifierStack
*/
public function push(ModifierInterface $modifier): self public function push(ModifierInterface $modifier): self
{ {
$this->modifiers[] = $modifier; $this->modifiers[] = $modifier;

View File

@@ -6,6 +6,12 @@ namespace Intervention\Image\Traits;
trait CanBuildFilePointer trait CanBuildFilePointer
{ {
/**
* Transform the provided data into a pointer with the data as its content
*
* @param string $data
* @return resource|false
*/
public function buildFilePointer(string $data) public function buildFilePointer(string $data)
{ {
$pointer = fopen('php://temp', 'rw'); $pointer = fopen('php://temp', 'rw');

View File

@@ -9,17 +9,35 @@ use Intervention\Image\Interfaces\PointInterface;
class Line class Line
{ {
/**
* Create new text line object with given text & position
*
* @param string $text
* @param PointInterface $position
* @return void
*/
public function __construct( public function __construct(
protected string $text, protected string $text,
protected PointInterface $position = new Point() protected PointInterface $position = new Point()
) { ) {
} }
/**
* Get Position of line
*
* @return PointInterface
*/
public function position(): PointInterface public function position(): PointInterface
{ {
return $this->position; return $this->position;
} }
/**
* Set position of current line
*
* @param Point $point
* @return Line
*/
public function setPosition(Point $point): self public function setPosition(Point $point): self
{ {
$this->position = $point; $this->position = $point;
@@ -27,6 +45,11 @@ class Line
return $this; return $this;
} }
/**
* Cast line to string
*
* @return string
*/
public function __toString(): string public function __toString(): string
{ {
return $this->text; return $this->text;