Oihana PHP System

LatitudeRule extends AbstractRangeRule

Validates that a value represents a valid geographic latitude.

The latitude must be a numeric value between -90 and 90 degrees (inclusive).

Tags
example
use oihana\validations\rules\LatitudeRule;

$rule = new LatitudeRule();

$rule->check(45.0);       // true
$rule->check(-89.9999);   // true
$rule->check(91);         // false
$rule->check('foo');      // false
$rule->check(null);       // false
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Properties

$max  : float|int
Upper numeric bound (inclusive).
$message  : string
The default error message for invalid latitude values.
$min  : float|int
Lower numeric bound (inclusive).

Methods

check()  : bool
Check if the given value lies within the defined range.
getMax()  : float|int
Gets the maximum bound.
getMin()  : float|int
Gets the minimum bound.

Properties

$max

Upper numeric bound (inclusive).

protected float|int $max = 90

$message

The default error message for invalid latitude values.

protected string $message = 'The :attribute must be a valid latitude between -90 and 90 degrees.'

$min

Lower numeric bound (inclusive).

protected float|int $min = -90

Methods

check()

Check if the given value lies within the defined range.

public check(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

getMax()

Gets the maximum bound.

public getMax() : float|int
Return values
float|int

getMin()

Gets the minimum bound.

public getMin() : float|int
Return values
float|int

        
On this page

Search results