class Dimensions implements Stringable

Traits

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

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

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

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

__construct(array $constraints = [])

Create a new dimensions rule instance.

width(int|string $value)

Set the "width" constraint.

height(int|string $value)

Set the "height" constraint.

minWidth(int|string $value)

Set the "min width" constraint.

minHeight(int|string $value)

Set the "min height" constraint.

maxWidth(int|string $value)

Set the "max width" constraint.

maxHeight(int|string $value)

Set the "max height" constraint.

ratio(float|string $value)

Set the "ratio" constraint.

minRatio(float|string $value)

Set the minimum aspect ratio.

maxRatio(float|string $value)

Set the maximum aspect ratio.

ratioBetween(float|string $min, float|string $max)

Set the aspect ratio range.

string
__toString()

Convert the rule to a validation string.

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

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

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

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

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

at line 19
__construct(array $constraints = [])

Create a new dimensions rule instance.

Parameters

array $constraints

the constraints for the dimensions rule

at line 27
Dimensions width(int|string $value)

Set the "width" constraint.

Parameters

int|string $value

Return Value

Dimensions

at line 37
Dimensions height(int|string $value)

Set the "height" constraint.

Parameters

int|string $value

Return Value

Dimensions

at line 47
Dimensions minWidth(int|string $value)

Set the "min width" constraint.

Parameters

int|string $value

Return Value

Dimensions

at line 57
Dimensions minHeight(int|string $value)

Set the "min height" constraint.

Parameters

int|string $value

Return Value

Dimensions

at line 67
Dimensions maxWidth(int|string $value)

Set the "max width" constraint.

Parameters

int|string $value

Return Value

Dimensions

at line 77
Dimensions maxHeight(int|string $value)

Set the "max height" constraint.

Parameters

int|string $value

Return Value

Dimensions

at line 87
Dimensions ratio(float|string $value)

Set the "ratio" constraint.

Parameters

float|string $value

Return Value

Dimensions

at line 97
Dimensions minRatio(float|string $value)

Set the minimum aspect ratio.

Parameters

float|string $value

Return Value

Dimensions

at line 107
Dimensions maxRatio(float|string $value)

Set the maximum aspect ratio.

Parameters

float|string $value

Return Value

Dimensions

at line 117
Dimensions ratioBetween(float|string $min, float|string $max)

Set the aspect ratio range.

Parameters

float|string $min
float|string $max

Return Value

Dimensions

at line 128
string __toString()

Convert the rule to a validation string.

Return Value

string