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