class Dimensions (View source)

Traits

Properties

protected array $constraints

The constraints for the dimensions rule.

Methods

$this|TWhenReturnType
when(bool $value, callable $callback = null, callable $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

$this|TUnlessReturnType
unless(bool $value, callable $callback = null, callable $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

void
__construct(array $constraints = [])

Create a new dimensions rule instance.

$this
width(int $value)

Set the "width" constraint.

$this
height(int $value)

Set the "height" constraint.

$this
minWidth(int $value)

Set the "min width" constraint.

$this
minHeight(int $value)

Set the "min height" constraint.

$this
maxWidth(int $value)

Set the "max width" constraint.

$this
maxHeight(int $value)

Set the "max height" constraint.

$this
ratio(float $value)

Set the "ratio" constraint.

string
__toString()

Convert the rule to a validation string.

Details

$this|TWhenReturnType when(bool $value, callable $callback = null, callable $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

bool $value
callable $callback
callable $default

Return Value

$this|TWhenReturnType

$this|TUnlessReturnType unless(bool $value, callable $callback = null, callable $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

bool $value
callable $callback
callable $default

Return Value

$this|TUnlessReturnType

void __construct(array $constraints = [])

Create a new dimensions rule instance.

Parameters

array $constraints

Return Value

void

$this width(int $value)

Set the "width" constraint.

Parameters

int $value

Return Value

$this

$this height(int $value)

Set the "height" constraint.

Parameters

int $value

Return Value

$this

$this minWidth(int $value)

Set the "min width" constraint.

Parameters

int $value

Return Value

$this

$this minHeight(int $value)

Set the "min height" constraint.

Parameters

int $value

Return Value

$this

$this maxWidth(int $value)

Set the "max width" constraint.

Parameters

int $value

Return Value

$this

$this maxHeight(int $value)

Set the "max height" constraint.

Parameters

int $value

Return Value

$this

$this ratio(float $value)

Set the "ratio" constraint.

Parameters

float $value

Return Value

$this

string __toString()

Convert the rule to a validation string.

Return Value

string