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 \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 getMin() and getMax() have the same not null value. Yiisoft\Validator\CountableLimitInterface
getGreaterThanMaxMessage() Returns message used when a validated value is greater than maximum in getMax(). Yiisoft\Validator\CountableLimitInterface
getLessThanMinMessage() Returns message used when a validated value is less than minimum set in 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 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 getMin() and getMax() have the same not null value.

See also getNotExactlyMessage() for related error message.

public abstract getExactly( ): integer|null
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 getMax().

public abstract getGreaterThanMaxMessage( ): string
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 getMin().

public abstract getLessThanMinMessage( ): string
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 getMax( ): integer|null
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 getMin( ): integer|null
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 getExactly().

public abstract getNotExactlyMessage( ): string
return string

Validation error message.

                public function getNotExactlyMessage(): string;