Esempio 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;
 }
Esempio 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;
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function getCoordinate() : Coordinate
 {
     return Coordinate::fromString($this->adapterCell->getCoordinate());
 }
Esempio n. 4
0
 /**
  * @dataProvider invalidProvider
  * @expectedException HelloFresh\Ausraster\Exception\InvalidCoordinateException
  */
 public function testCreatingInvalidCoordinateFromString($x, $y)
 {
     Coordinate::fromString($x . $y);
 }