/** * @param $locId * @return LocationHelper * @throws \Exception */ public function getLocation($locId) { if ($this->locations->offsetExists($locId)) { return $this->locations->offsetGet($locId); } else { return $this->locHelper->factory($locId); } }