PHP Class Eloquent\Phony\Verification\Cardinality

Datei anzeigen Open project: eloquent/phony Class Usage Examples

Public Methods

Method Description
__construct ( integer $minimum = 1, integer | null $maximum = null, boolean $isAlways = false ) Construct a new cardinality.
assertSingular ( ) Asserts that this cardinality is suitable for events that can only happen once or not at all.
isAlways ( ) : boolean Returns true if 'always' is enabled.
isNever ( ) : boolean Returns true if this cardinality is 'never'.
matches ( integer | boolean $count, integer $maximumCount ) : boolean Returns true if the supplied count matches this cardinality.
maximum ( ) : integer | null Get the maximum.
minimum ( ) : integer Get the minimum.
setIsAlways ( boolean $isAlways ) Turn 'always' on or off.

Method Details

__construct() public method

Construct a new cardinality.
public __construct ( integer $minimum = 1, integer | null $maximum = null, boolean $isAlways = false )
$minimum integer The minimum.
$maximum integer | null The maximum, or null for no maximum.
$isAlways boolean True if 'always' should be enabled.

assertSingular() public method

Asserts that this cardinality is suitable for events that can only happen once or not at all.
public assertSingular ( )

isAlways() public method

Returns true if 'always' is enabled.
public isAlways ( ) : boolean
return boolean True if 'always' is enabled.

isNever() public method

Returns true if this cardinality is 'never'.
public isNever ( ) : boolean
return boolean True if this cardinality is 'never'.

matches() public method

Returns true if the supplied count matches this cardinality.
public matches ( integer | boolean $count, integer $maximumCount ) : boolean
$count integer | boolean The count or result to check.
$maximumCount integer The maximum possible count.
return boolean True if the supplied count matches this cardinality.

maximum() public method

Get the maximum.
public maximum ( ) : integer | null
return integer | null The maximum.

minimum() public method

Get the minimum.
public minimum ( ) : integer
return integer The minimum.

setIsAlways() public method

Turn 'always' on or off.
public setIsAlways ( boolean $isAlways )
$isAlways boolean True to enable 'always'.