/** * Get map model. * * @param int|string $mapId Model id or alias. * * @return MapModel * * @throws \InvalidArgumentException If no model is found. */ public function getModel($mapId) { $model = MapModel::findByIdOrAlias($mapId); if ($model === null) { throw new \InvalidArgumentException(sprintf('Model "%s" not found', $mapId)); } return $model; }