Box
in package
implements
BoxInterface
FinalYes
A box implementation.
Table of Contents
Interfaces
- BoxInterface
- Interface for a box.
Properties
Methods
- __construct() : mixed
- Constructs the Size with given width and height.
- __toString() : string
- Returns a string representation of the current box.
- contains() : bool
- Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0).
- getHeight() : int
- Gets box height.
- getWidth() : int
- Gets box width.
- heighten() : static
- Resizes box to given height, constraining proportions and returns the new box.
- increase() : static
- Creates new BoxInterface, adding given size to both sides.
- scale() : static
- Creates new BoxInterface instance with ratios applied to both sides.
- square() : int
- Gets current box square, useful for getting total number of pixels in a given box.
- widen() : static
- Resizes box to given width, constraining proportions and returns the new box.
Properties
$height
private
int
$height
$width
private
int
$width
Methods
__construct()
Constructs the Size with given width and height.
public
__construct(int $width, int $height) : mixed
Parameters
- $width : int
- $height : int
Tags
__toString()
Returns a string representation of the current box.
public
__toString() : string
Tags
Return values
stringcontains()
Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0).
public
contains(BoxInterface $box[, PointInterface $start = null ]) : bool
Parameters
- $box : BoxInterface
- $start : PointInterface = null
Tags
Return values
boolgetHeight()
Gets box height.
public
getHeight() : int
Tags
Return values
intgetWidth()
Gets box width.
public
getWidth() : int
Tags
Return values
intheighten()
Resizes box to given height, constraining proportions and returns the new box.
public
heighten(mixed $height) : static
Parameters
- $height : mixed
Tags
Return values
staticincrease()
Creates new BoxInterface, adding given size to both sides.
public
increase(mixed $size) : static
Parameters
- $size : mixed
Tags
Return values
staticscale()
Creates new BoxInterface instance with ratios applied to both sides.
public
scale(mixed $ratio) : static
Parameters
- $ratio : mixed
Tags
Return values
staticsquare()
Gets current box square, useful for getting total number of pixels in a given box.
public
square() : int
Tags
Return values
intwiden()
Resizes box to given width, constraining proportions and returns the new box.
public
widen(mixed $width) : static
Parameters
- $width : mixed