Skip to content

GeoLocation

Pieter Hordijk edited this page Dec 31, 2018 · 1 revision

TOC

Latitude

Validates the input (numeric) to be a valid latitude coordinate.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\GeoLocation\Latitude;

(new Latitude())->validate(12.3567);

Failure reasons

  • Numeric.NumericType when the validated value is not a numeric type
  • GeoLocation.Latitude when the validated value is not within the latitude range (-90 - 90 exclusive)

LatitudeRange

Validates the input (numeric) to be within a valid latitude range of float and float.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\GeoLocation\LatitudeRange;

(new LatitudeRange(-12, 18.6428))->validate(12.3567);

Failure reasons

  • Numeric.NumericType when the validated value is not a numeric type
  • GeoLocation.Latitude when the validated value is not within the latitude range (-90 - 90 exclusive)
  • Numeric.Minimum when the validated value is less than the minimum value
  • Numeric.Maximum when the validated value is bigger than the maximum value

Longitude

Validates the input (numeric) to be a valid longitude coordinate.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\GeoLocation\Longitude;

(new Longitude())->validate(12.3567);

Failure reasons

  • Numeric.NumericType when the validated value is not a numeric type
  • GeoLocation.Longitude when the validated value is not within the latitude range (-180 - 180 exclusive)

LongitudeRange

Validates the input (numeric) to be within a valid longitude range of float and float.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\GeoLocation\LongitudeRange;

(new LongitudeRange(-12, 18.6428))->validate(12.3567);

Failure reasons

  • Numeric.NumericType when the validated value is not a numeric type
  • GeoLocation.Longitude when the validated value is not within the longitude range (-180 - 180 exclusive)
  • Numeric.Minimum when the validated value is less than the minimum value
  • Numeric.Maximum when the validated value is bigger than the maximum value
Clone this wiki locally