public function getDistanceObject() { if (is_object($this->distance)) { return $this->distance; } return new $this->distance(); }