0 follower

Interface Yiisoft\Validator\CountableLimitInterface

Implemented byYiisoft\Validator\Rule\Count, Yiisoft\Validator\Rule\Length

An optional interface for rules to implement. Rules implementing it must have minimum and maximum limits and also "exactly" value for strict equality. Boundaries must reflect numbers of countable items.

The package ships with {@see \Yiisoft\Validator\CountableLimitTrait} which already implements that interface. All you have to do is to include it in the rule class along with the interface.

Public Methods

Hide inherited methods

Method Description Defined By
getExactly() Returns current "exactly" value meant for strict comparison. It is a shortcut for the case when {@see getMin()} and {@see getMax()} have the same not null value. Yiisoft\Validator\CountableLimitInterface
getGreaterThanMaxMessage() Returns message used when a validated value is greater than maximum in {@see getMax()}. Yiisoft\Validator\CountableLimitInterface
getLessThanMinMessage() Returns message used when a validated value is less than minimum set in {@see getMin()}. Yiisoft\Validator\CountableLimitInterface
getMax() Returns current maximum limit. Yiisoft\Validator\CountableLimitInterface
getMin() Returns current minimum limit. Yiisoft\Validator\CountableLimitInterface
getNotExactlyMessage() Returns message used when a validated value doesn't exactly match the one set in {@see getExactly()}. Yiisoft\Validator\CountableLimitInterface

Method Details

Hide inherited methods

getExactly() public abstract method

Returns current "exactly" value meant for strict comparison. It is a shortcut for the case when {@see getMin()} and {@see getMax()} have the same not null value.

See also getNotExactlyMessage() for related error message.

public abstract integer|null getExactly ( )
return integer|null

A number representing "exactly" value. null means no strict comparison so lower / upper limits / both must be set.

                public function getExactly(): ?int;

            
getGreaterThanMaxMessage() public abstract method

Returns message used when a validated value is greater than maximum in {@see getMax()}.

public abstract string getGreaterThanMaxMessage ( )
return string

Validation error message.

                public function getGreaterThanMaxMessage(): string;

            
getLessThanMinMessage() public abstract method

Returns message used when a validated value is less than minimum set in {@see getMin()}.

public abstract string getLessThanMinMessage ( )
return string

Validation error message.

                public function getLessThanMinMessage(): string;

            
getMax() public abstract method

Returns current maximum limit.

See also getGreaterThanMaxMessage() for related error message.

public abstract integer|null getMax ( )
return integer|null

A number representing maximum boundary. null means no upper bound.

                public function getMax(): ?int;

            
getMin() public abstract method

Returns current minimum limit.

See also getLessThanMinMessage() for related error message.

public abstract integer|null getMin ( )
return integer|null

A number representing minimum boundary. null means no lower bound.

                public function getMin(): ?int;

            
getNotExactlyMessage() public abstract method

Returns message used when a validated value doesn't exactly match the one set in {@see getExactly()}.

public abstract string getNotExactlyMessage ( )
return string

Validation error message.

                public function getNotExactlyMessage(): string;