MatchMakingLobby/Services/Match.php
function addPlayerInTeam($login, $teamId)
	{
		switch($teamId)
		{
			case 0:
				if(array_search($login, $this->team2))
				{
					throw new \InvalidArgumentException();
				}
				if(!array_search($login, $this->team1))
				{
					$this->team1[] = $login;
				}
				break;
			case 1:
				if(array_search($login, $this->team1))
				{
					throw new \InvalidArgumentException();
				}
				if(!array_search($login, $this->team2))
				{
					$this->team2[] = $login;
				}
				break;
			default:
				throw new \InvalidArgumentException();
		}
	}
function addPlayerInTeam($login, $teamId)
	{
		switch($teamId)
		{
			case 0:
				if(array_search($login, $this->team2))
				{
					throw new \InvalidArgumentException();
				}
				if(!array_search($login, $this->team1))
				{
					$this->team1[] = $login;
				}
				break;
			case 1:
				if(array_search($login, $this->team1))
				{
					throw new \InvalidArgumentException();
				}
				if(!array_search($login, $this->team2))
				{
					$this->team2[] = $login;
				}
				break;
			default:
				throw new \InvalidArgumentException();
		}
	}
function addPlayerInTeam ( $ login , $ teamId ) { switch ( $ teamId ) { case 0 : if ( array_search ( $ login , $ this -> team2 ) ) { throw new \ InvalidArgumentException ( ) ; } if ( ! array_search ( $ login , $ this -> team1 ) ) { $ this -> team1 [ ] = $ login ; } break ; case 1 : if ( array_search ( $ login , $ this -> team1 ) ) { throw new \ InvalidArgumentException ( ) ; } if ( ! array_search ( $ login , $ this -> team2 ) ) { $ this -> team2 [ ] = $ login ; } break ; default : throw new \ InvalidArgumentException ( ) ; } }
add a login in a team, throw an exception if the login is already teamed or if the team does not exist
@param string $login
@param int $teamId
@throws \InvalidArgumentException
add a login in a team throw an exception if the login is already teamed or if the team does not exist