long = $long; $this->lat = $lat; $this->name = $name; } /** * Is equals to. * * @param City $city City * * @return bool * * @since 1.0.0 */ public function equals(City $city) : bool { return $this->name === $city->getName() && $this->lat === $city->getLatitude() && $this->long === $city->getLatitude(); } /** * Get name. * * @return string * * @since 1.0.0 */ public function getName() : string { return $this->name; } /** * Get latitude. * * @return float * * @since 1.0.0 */ public function getLatitude() : float { return $this->lat; } /** * Distance to city in meter * * @param City $city City * * @return float * * @since 1.0.0 */ public function getDistanceTo(City $city) : float { return Sphere::distance2PointsOnSphere($this->lat, $this->long, $city->getLatitude(), $city->getLongitude()); } /** * Get longitude. * * @return float * * @since 1.0.0 */ public function getLongitude() : float { return $this->long; } }