Box
class Box implements BoxInterface
A box implementation.
Methods
Constructs the Size with given width and height.
Gets box width.
Gets box height.
Creates new BoxInterface instance with ratios applied to both sides.
Creates new BoxInterface, adding given size to both sides.
Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0).
Gets current box square, useful for getting total number of pixels in a given box.
Returns a string representation of the current box.
Resizes box to given width, constraining proportions and returns the new box.
Resizes box to given height, constraining proportions and returns the new box.
Details
at line 39
__construct(int $width, int $height)
Constructs the Size with given width and height.
at line 53
int
getWidth()
Gets box width.
at line 63
int
getHeight()
Gets box height.
at line 73
BoxInterface
scale(float $ratio)
Creates new BoxInterface instance with ratios applied to both sides.
at line 86
BoxInterface
increase(int $size)
Creates new BoxInterface, adding given size to both sides.
at line 96
bool
contains(BoxInterface $box, PointInterface $start = null)
Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0).
at line 108
int
square()
Gets current box square, useful for getting total number of pixels in a given box.
at line 118
string
__toString()
Returns a string representation of the current box.
at line 128
BoxInterface
widen(int $width)
Resizes box to given width, constraining proportions and returns the new box.
at line 138
BoxInterface
heighten(int $height)
Resizes box to given height, constraining proportions and returns the new box.