Ejemplo n.º 1
0
 /**
  * Compare a provided coordinate against this one.
  * @param  Coordinate $comparison
  * @return int      Uses standard <=> style return values.
  */
 public function compareTo(Coordinate $comparison) : int
 {
     if ($comparison->x() < $this->x() || $comparison->y() < $this->y()) {
         return -1;
     }
     if ($comparison->x() > $this->x() || $comparison->y() > $this->y()) {
         return 1;
     }
     return 0;
 }
Ejemplo n.º 2
0
 /**
  * Count the number of cells in the range
  * @return int
  */
 public function count() : int
 {
     $rangeX = ord($this->to->x()) - ord($this->from->x());
     $rangeY = $this->to->y() - $this->from->y();
     return ++$rangeX * ++$rangeY;
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getCoordinate() : Coordinate
 {
     return Coordinate::fromString($this->adapterCell->getCoordinate());
 }
Ejemplo n.º 4
0
 /**
  * @dataProvider invalidProvider
  * @expectedException HelloFresh\Ausraster\Exception\InvalidCoordinateException
  */
 public function testCreatingInvalidCoordinateFromString($x, $y)
 {
     Coordinate::fromString($x . $y);
 }