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 59
int
getWidth()
Gets box width.
at line 69
int
getHeight()
Gets box height.
at line 79
BoxInterface
scale(float $ratio)
Creates new BoxInterface instance with ratios applied to both sides.
at line 92
BoxInterface
increase(int $size)
Creates new BoxInterface, adding given size to both sides.
at line 102
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 114
int
square()
Gets current box square, useful for getting total number of pixels in a given box.
at line 124
string
__toString()
Returns a string representation of the current box.
at line 134
BoxInterface
widen(int $width)
Resizes box to given width, constraining proportions and returns the new box.
at line 144
BoxInterface
heighten(int $height)
Resizes box to given height, constraining proportions and returns the new box.