vendor/geo-io/geometry/src/Coordinates.php line 7

Open in your IDE?
  1. <?php
  2. namespace GeoIO\Geometry;
  3. use GeoIO\Geometry\Exception\InvalidCoordinateException;
  4. class Coordinates
  5. {
  6.     private $x;
  7.     private $y;
  8.     private $z;
  9.     private $m;
  10.     public function __construct($x$y$z null$m null)
  11.     {
  12.         $this->$x;
  13.         $this->$y;
  14.         $this->$z;
  15.         $this->$m;
  16.         $this->assert();
  17.     }
  18.     public function getX()
  19.     {
  20.         return $this->x;
  21.     }
  22.     public function getY()
  23.     {
  24.         return $this->y;
  25.     }
  26.     public function getZ()
  27.     {
  28.         return $this->z;
  29.     }
  30.     public function getM()
  31.     {
  32.         return $this->m;
  33.     }
  34.     private function assert()
  35.     {
  36.         $x $this->getX();
  37.         if (!is_int($x) && !is_float($x)) {
  38.             throw InvalidCoordinateException::create('X');
  39.         }
  40.         $y $this->getY();
  41.         if (!is_int($y) && !is_float($y)) {
  42.             throw InvalidCoordinateException::create('Y');
  43.         }
  44.         $z $this->getZ();
  45.         if (!is_null($z) && !is_int($z) && !is_float($z)) {
  46.             throw InvalidCoordinateException::create('Z'true);
  47.         }
  48.         $m $this->getM();
  49.         if (!is_null($m) && !is_int($m) && !is_float($m)) {
  50.             throw InvalidCoordinateException::create('M'true);
  51.         }
  52.     }
  53. }