HumHub Documentation (unofficial)

Box
in package
implements BoxInterface

FinalYes

A box implementation.

Table of Contents

Interfaces

BoxInterface
Interface for a box.

Properties

$height  : int
$width  : int

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
throws
InvalidArgumentException

__toString()

Returns a string representation of the current box.

public __toString() : string
Tags
see
BoxInterface::__toString()
Return values
string

heighten()

Resizes box to given height, constraining proportions and returns the new box.

public heighten(mixed $height) : static
Parameters
$height : mixed
Tags
see
BoxInterface::heighten()
Return values
static

increase()

Creates new BoxInterface, adding given size to both sides.

public increase(mixed $size) : static
Parameters
$size : mixed
Tags
see
BoxInterface::increase()
Return values
static

scale()

Creates new BoxInterface instance with ratios applied to both sides.

public scale(mixed $ratio) : static
Parameters
$ratio : mixed
Tags
see
BoxInterface::scale()
Return values
static

square()

Gets current box square, useful for getting total number of pixels in a given box.

public square() : int
Tags
see
BoxInterface::square()
Return values
int

widen()

Resizes box to given width, constraining proportions and returns the new box.

public widen(mixed $width) : static
Parameters
$width : mixed
Tags
see
BoxInterface::widen()
Return values
static

        
On this page

Search results