/** * @param CM_Model_Location $location * @return int|null */ public function getDistance(CM_Model_Location $location) { $pointCurrent = $this->getGeoPoint(); $pointAgainst = $location->getGeoPoint(); if (!$pointCurrent || !$pointAgainst) { return null; } return (int) round($pointCurrent->calculateDistanceTo($pointAgainst)); }