isRepresentingSpot() && !$this->isRepresentingVoid()) { throw new \Exception('The map description contains invalid representations.'); } if (!is_bool($visited)) { throw new \Exception('The visited argument must be boolean.'); } parent::__construct($row, $column); $this->representation = $tileRepresentation; $this->visited = $visited; } /** * @return Spot * @throws \Exception */ public function getSpot() { if (is_null($this->spot)) { throw new \Exception('This tile does not belong to any spot.'); } return $this->spot; } /** * @param Spot $spot */ public function setSpot(Spot $spot) { $this->spot = $spot; } /** * @return boolean */ public function isVisited() { return $this->visited; } /** * Flags this Tile as "visited" */ public function visit() { $this->visited = true; } /** * @return boolean */ public function isRepresentingSpot() { return $this->representation == self::REPRESENTS_SPOT; } /** * @return bool */ public function isRepresentingVoid() { return $this->representation == self::REPRESENTS_VOID; } }