Oihana PHP System

LongitudeRule 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 LongitudeRule();

$rule->check(  100  ) ;  // true
$rule->check( -100  ) ;  // true
$rule->check(  190  ) ;  // 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 longitude 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 = 180

$message

The default error message for invalid longitude values.

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

$min

Lower numeric bound (inclusive).

protected float|int $min = -180

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