1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-02 18:32:56 +02:00

Add missing methods to SizeInterface

This commit is contained in:
Oliver Vogel
2022-05-22 19:08:22 +02:00
parent a796553b6d
commit 5397914d69
2 changed files with 15 additions and 11 deletions

View File

@@ -50,7 +50,7 @@ class Size implements SizeInterface
return $this->pivot;
}
public function setPivot(PointInterface $pivot): self
public function setPivot(PointInterface $pivot): SizeInterface
{
$this->pivot = $pivot;
@@ -104,7 +104,7 @@ class Size implements SizeInterface
* @param int $offset_y
* @return Size
*/
public function alignPivot(string $position, int $offset_x = 0, int $offset_y = 0): self
public function alignPivot(string $position, int $offset_x = 0, int $offset_y = 0): SizeInterface
{
switch (strtolower($position)) {
case 'top':
@@ -182,7 +182,7 @@ class Size implements SizeInterface
return $this;
}
public function alignPivotTo(SizeInterface $size, string $position): self
public function alignPivotTo(SizeInterface $size, string $position): SizeInterface
{
$reference = new Size($size->getWidth(), $size->getHeight());
$reference->alignPivot($position);
@@ -214,32 +214,32 @@ class Size implements SizeInterface
return new Resizer($width, $height);
}
public function resize(?int $width = null, ?int $height = null): self
public function resize(?int $width = null, ?int $height = null): SizeInterface
{
return $this->getResizer($width, $height)->resize($this);
}
public function resizeDown(?int $width = null, ?int $height = null): self
public function resizeDown(?int $width = null, ?int $height = null): SizeInterface
{
return $this->getResizer($width, $height)->resizeDown($this);
}
public function scale(?int $width = null, ?int $height = null): self
public function scale(?int $width = null, ?int $height = null): SizeInterface
{
return $this->getResizer($width, $height)->scale($this);
}
public function scaleDown(?int $width = null, ?int $height = null): self
public function scaleDown(?int $width = null, ?int $height = null): SizeInterface
{
return $this->getResizer($width, $height)->scaleDown($this);
}
public function cover(int $width, int $height): self
public function cover(int $width, int $height): SizeInterface
{
return $this->getResizer($width, $height)->cover($this);
}
public function contain(int $width, int $height): self
public function contain(int $width, int $height): SizeInterface
{
return $this->getResizer($width, $height)->contain($this);
}

View File

@@ -9,13 +9,17 @@ interface SizeInterface
public function getPivot(): PointInterface;
public function setWidth(int $width): SizeInterface;
public function setHeight(int $height): SizeInterface;
public function resize(?int $width = null, ?int $height = null): SizeInterface;
public function getAspectRatio(): float;
public function fitsInto(SizeInterface $size): bool;
public function isLandscape(): bool;
public function isPortrait(): bool;
public function alignPivot(string $position, int $offset_x = 0, int $offset_y = 0): SizeInterface;
public function alignPivotTo(SizeInterface $size, string $position): SizeInterface;
public function contain(int $width, int $height): SizeInterface;
public function getRelativePositionTo(SizeInterface $size): PointInterface;
public function resize(?int $width = null, ?int $height = null): SizeInterface;
public function resizeDown(?int $width = null, ?int $height = null): SizeInterface;
public function scale(?int $width = null, ?int $height = null): SizeInterface;
public function scaleDown(?int $width = null, ?int $height = null): SizeInterface;
public function cover(int $width, int $height): SizeInterface;
public function contain(int $width, int $height): SizeInterface;
}