x = $x; $this->y = $y; $this->weight = $weight; $this->isWalkable = $isWalkable; } /** * Get the cost to walk on this node * * @return float * * @since 1.0.0 */ public function getWeight() : float { return $this->weight; } /** * Get x-coordinate * * @return int * * @since 1.0.0 */ public function getX() : int { return $this->x; } /** * Get y-coordinate * * @return int * * @since 1.0.0 */ public function getY() : int { return $this->y; } /** * Is node equal to another node? * * @param Node $node Node to compare to * * @return bool * * @since 1.0.0 */ public function isEqual(self $node) : bool { return $this->x === $node->getX() && $this->y === $node->getY(); } /** * Get the coordinates of this node. * * @return array ['x' => ?, 'y' => ?] * * @since 1.0.0 */ public function getCoordinates() : array { return ['x' => $this->x, 'y' => $this->y]; } }