/** * Create for manager * * @param Project $project * * @return AdapterInterface */ public function createAdapter(Project $project) { $className = "AppBundle\\Manager\\" . ucfirst($project->getRepositoryType()) . "Adapter"; if (class_exists($className)) { return new $className($project); } throw new \InvalidArgumentException('Unknown adapter: ' . $project->getRepositoryType()); }