Skip to content

Commit

Permalink
Throw exceptions if resizer receives unvalid values
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Jan 2, 2024
1 parent 66b2895 commit ec1fead
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Geometry/Tools/RectangleResizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ public function __construct(
protected ?int $width = null,
protected ?int $height = null,
) {
//
if (is_int($width) && $width < 1) {
throw new GeometryException(
'The width you specify must be greater than or equal to 1.'
);
}

if (is_int($height) && $height < 1) {
throw new GeometryException(
'The height you specify must be greater than or equal to 1.'
);
}
}

public static function to(...$arguments): self
Expand Down

0 comments on commit ec1fead

Please sign in to comment.