Skip to content

Commit

Permalink
Add doc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Sep 13, 2024
1 parent 8e14e99 commit e878ccc
Showing 1 changed file with 45 additions and 5 deletions.
50 changes: 45 additions & 5 deletions src/Geometry/Rectangle.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,45 +283,85 @@ public function bottomRightPoint(): PointInterface
}

/**
* @see SizeInterface::resize()
*
* @throws GeometryException
*/
protected function resizer(?int $width = null, ?int $height = null): RectangleResizer
{
return new RectangleResizer($width, $height);
}

public function resize(?int $width = null, ?int $height = null): SizeInterface
{
return $this->resizer($width, $height)->resize($this);
}

/**
* @see SizeInterface::resizeDown()
*
* @throws GeometryException
*/
public function resizeDown(?int $width = null, ?int $height = null): SizeInterface
{
return $this->resizer($width, $height)->resizeDown($this);
}

/**
* @see SizeInterface::scale()
*
* @throws GeometryException
*/
public function scale(?int $width = null, ?int $height = null): SizeInterface
{
return $this->resizer($width, $height)->scale($this);
}

/**
* @see SizeInterface::scaleDown()
*
* @throws GeometryException
*/
public function scaleDown(?int $width = null, ?int $height = null): SizeInterface
{
return $this->resizer($width, $height)->scaleDown($this);
}

/**
* @see SizeInterface::cover()
*
* @throws GeometryException
*/
public function cover(int $width, int $height): SizeInterface
{
return $this->resizer($width, $height)->cover($this);
}

/**
* @see SizeInterface::contain()
*
* @throws GeometryException
*/
public function contain(int $width, int $height): SizeInterface
{
return $this->resizer($width, $height)->contain($this);
}

/**
* @see SizeInterface::containMax()
*
* @throws GeometryException
*/
public function containMax(int $width, int $height): SizeInterface
{
return $this->resizer($width, $height)->containDown($this);
}

/**
* Create resizer instance with given target size
*
* @param null|int $width
* @param null|int $height
* @throws GeometryException
* @return RectangleResizer
*/
protected function resizer(?int $width = null, ?int $height = null): RectangleResizer
{
return new RectangleResizer($width, $height);
}
}

0 comments on commit e878ccc

Please sign in to comment.