plugin/team/Manager/TeamManager.php
public function computeValidTeamName(Workspace $workspace, $teamName, $index = 0)
    {
        $name = 0 === $index ? $teamName : $teamName.' '.$index;

        $teams = $this->teamRepo->findBy(['workspace' => $workspace, 'name' => $name]);

        while (count($teams) > 0) {
            ++$index;
            $name = $teamName.' '.$index;
            $teams = $this->teamRepo->findBy(['workspace' => $workspace, 'name' => $name]);
        }

        return ['name' => $name, 'index' => $index];
    }
public function computeValidTeamName(Workspace $workspace, $teamName, $index = 0)
    {
        $name = 0 === $index ? $teamName : $teamName.' '.$index;

        $teams = $this->teamRepo->findBy(['workspace' => $workspace, 'name' => $name]);

        while (count($teams) > 0) {
            ++$index;
            $name = $teamName.' '.$index;
            $teams = $this->teamRepo->findBy(['workspace' => $workspace, 'name' => $name]);
        }

        return ['name' => $name, 'index' => $index];
    }
public function computeValidTeamName ( Workspace $ workspace , $ teamName , $ index = 0 ) { $ name = 0 === $ index ? $ teamName : $ teamName . ' ' . $ index ; $ teams = $ this -> teamRepo -> findBy ( [ 'workspace' => $ workspace , 'name' => $ name ] ) ; while ( count ( $ teams ) > 0 ) { ++ $ index ; $ name = $ teamName . ' ' . $ index ; $ teams = $ this -> teamRepo -> findBy ( [ 'workspace' => $ workspace , 'name' => $ name ] ) ; } return [ 'name' => $ name , 'index' => $ index ] ; }
Checks if name already exists and returns a incremented version if it does.

@param Workspace $workspace
@param string    $teamName
@param int       $index

@return array
Checks if name already exists and returns a incremented version if it does .