private function validateName(PhabricatorProject $project) { $slug = $project->getPhrictionSlug(); $name = $project->getName(); if ($slug == '/') { throw new PhabricatorProjectNameCollisionException("Project names must be unique and contain some letters or numbers."); } $id = $project->getID(); $collision = id(new PhabricatorProject())->loadOneWhere('(name = %s OR phrictionSlug = %s) AND id %Q %nd', $name, $slug, $id ? '!=' : 'IS NOT', $id ? $id : null); if ($collision) { $other_name = $collision->getName(); $other_id = $collision->getID(); throw new PhabricatorProjectNameCollisionException("Project names must be unique. The name '{$name}' is too similar to " . "the name of another project, '{$other_name}' (Project ID: " . "{$other_id}). Choose a unique name."); } }