From c78838ffe9bf553fa5bd5dca570d792c6e3a73f1 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 28 Jan 2024 12:29:45 +0100 Subject: [PATCH] Edit doc blocks --- src/Drivers/Gd/Frame.php | 75 ++++++++++++++++++++++++++++++ src/ModifierStack.php | 18 +++++++ src/Traits/CanBuildFilePointer.php | 6 +++ src/Typography/Line.php | 23 +++++++++ 4 files changed, 122 insertions(+) diff --git a/src/Drivers/Gd/Frame.php b/src/Drivers/Gd/Frame.php index 4212ad41..90b35253 100644 --- a/src/Drivers/Gd/Frame.php +++ b/src/Drivers/Gd/Frame.php @@ -14,6 +14,16 @@ use Intervention\Image\Interfaces\SizeInterface; 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( protected GdImage $native, protected float $delay = 0, @@ -24,11 +34,21 @@ class Frame implements FrameInterface // } + /** + * {@inheritdoc} + * + * @see FrameInterface::toImage() + */ public function toImage(DriverInterface $driver): ImageInterface { return new Image($driver, new Core([$this])); } + /** + * {@inheritdoc} + * + * @see FrameInterface::setNative() + */ public function setNative($native): FrameInterface { $this->native = $native; @@ -36,21 +56,41 @@ class Frame implements FrameInterface return $this; } + /** + * {@inheritdoc} + * + * @see FrameInterface::native() + */ public function native(): GdImage { return $this->native; } + /** + * {@inheritdoc} + * + * @see FrameInterface::size() + */ public function size(): SizeInterface { return new Rectangle(imagesx($this->native), imagesy($this->native)); } + /** + * {@inheritdoc} + * + * @see FrameInterface::delay() + */ public function delay(): float { return $this->delay; } + /** + * {@inheritdoc} + * + * @see FrameInterface::setDelay() + */ public function setDelay(float $delay): FrameInterface { $this->delay = $delay; @@ -58,11 +98,21 @@ class Frame implements FrameInterface return $this; } + /** + * {@inheritdoc} + * + * @see FrameInterface::dispose() + */ public function dispose(): int { return $this->dispose; } + /** + * {@inheritdoc} + * + * @see FrameInterface::setDispose() + */ public function setDispose(int $dispose): FrameInterface { $this->dispose = $dispose; @@ -70,6 +120,11 @@ class Frame implements FrameInterface return $this; } + /** + * {@inheritdoc} + * + * @see FrameInterface::setOffset() + */ public function setOffset(int $left, int $top): FrameInterface { $this->offset_left = $left; @@ -78,11 +133,21 @@ class Frame implements FrameInterface return $this; } + /** + * {@inheritdoc} + * + * @see FrameInterface::offsetLeft() + */ public function offsetLeft(): int { return $this->offset_left; } + /** + * {@inheritdoc} + * + * @see FrameInterface::setOffsetLeft() + */ public function setOffsetLeft(int $offset): FrameInterface { $this->offset_left = $offset; @@ -90,11 +155,21 @@ class Frame implements FrameInterface return $this; } + /** + * {@inheritdoc} + * + * @see FrameInterface::offsetTop() + */ public function offsetTop(): int { return $this->offset_top; } + /** + * {@inheritdoc} + * + * @see FrameInterface::setOffsetTop() + */ public function setOffsetTop(int $offset): FrameInterface { $this->offset_top = $offset; diff --git a/src/ModifierStack.php b/src/ModifierStack.php index a55719e9..a69bc009 100644 --- a/src/ModifierStack.php +++ b/src/ModifierStack.php @@ -9,11 +9,23 @@ use Intervention\Image\Interfaces\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) { // } + /** + * Apply all modifiers in stack to the given image + * + * @param ImageInterface $image + * @return ImageInterface + */ public function apply(ImageInterface $image): ImageInterface { foreach ($this->modifiers as $modifier) { @@ -23,6 +35,12 @@ class ModifierStack implements ModifierInterface return $image; } + /** + * Append new modifier to the stack + * + * @param ModifierInterface $modifier + * @return ModifierStack + */ public function push(ModifierInterface $modifier): self { $this->modifiers[] = $modifier; diff --git a/src/Traits/CanBuildFilePointer.php b/src/Traits/CanBuildFilePointer.php index 258ef7ec..8d9d3dd0 100644 --- a/src/Traits/CanBuildFilePointer.php +++ b/src/Traits/CanBuildFilePointer.php @@ -6,6 +6,12 @@ namespace Intervention\Image\Traits; 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) { $pointer = fopen('php://temp', 'rw'); diff --git a/src/Typography/Line.php b/src/Typography/Line.php index f136175f..9d07f681 100644 --- a/src/Typography/Line.php +++ b/src/Typography/Line.php @@ -9,17 +9,35 @@ use Intervention\Image\Interfaces\PointInterface; class Line { + /** + * Create new text line object with given text & position + * + * @param string $text + * @param PointInterface $position + * @return void + */ public function __construct( protected string $text, protected PointInterface $position = new Point() ) { } + /** + * Get Position of line + * + * @return PointInterface + */ public function position(): PointInterface { return $this->position; } + /** + * Set position of current line + * + * @param Point $point + * @return Line + */ public function setPosition(Point $point): self { $this->position = $point; @@ -27,6 +45,11 @@ class Line return $this; } + /** + * Cast line to string + * + * @return string + */ public function __toString(): string { return $this->text;