Hydrate a collection of team objects into a collection of
TeamEntity objects

@param stdClass[] $teams
@return TeamEntity[]
426536
public static function hydrateCollection(array $teams)
    {
        $hydrated = [];

        foreach ($teams as $team) {
            $hydrated[] = self::hydrate($team);
        }

        return $hydrated;
    }
281113
public static function hydrateCollection(array $comments)
    {
        $hydrated = [];

        foreach ($comments as $comment) {
            $hydrated[] = self::hydrate($comment);
        }

        return $hydrated;
    }
778048
public static function hydrateCollection(array $activities)
    {
        $hydrated = [];

        foreach ($activities as $activity) {
            $hydrated[] = self::hydrate($activity);
        }

        return $hydrated;
    }
868639
public static function hydrateCollection(array $libraries)
    {
        $hydrated = [];

        foreach ($libraries as $library) {
            $hydrated[] = self::hydrate($library);
        }

        return $hydrated;
    }
963146
public static function hydrateCollection(array $comparisons)
    {
        $hydrated = [];

        foreach ($comparisons as $comparison) {
            $hydrated[] = self::hydrate($comparison);
        }

        return $hydrated;
    }
286690
public static function hydrate(array $items, $connection = null)
    {
        $collection = with($instance = new static)->newCollection();

        foreach ($items as $item) {
            $model = $instance->newFromBuilder($item);

            if (! is_null($connection)) {
                $model->setConnection($connection);
            }

            $collection->push($model);
        }

        return $collection;
    }
867278
public function switchTeam( $team )
    {
        if( $team !== 0 && $team !== null )
        {
            $team        = $this->retrieveTeamId( $team );
            $teamModel   = Config::get( 'teamwork.team_model' );
            $teamObject  = ( new $teamModel() )->find( $team );
            if( !$teamObject )
            {
                $exception = new ModelNotFoundException();
                $exception->setModel( $teamModel );
                throw $exception;
            }
            if( !$teamObject->users->contains( $this->getKey() ) )
            {
                $exception = new UserNotInTeamException();
                $exception->setTeam( $teamObject->name );
                throw $exception;
            }
        }
        $this->current_team_id = $team;
        $this->save();

        if( $this->relationLoaded('currentTeam') ) {
            $this->load('currentTeam');
        }
        
        return $this;
    }
1135528
public function hydrate(array $objects, array $fields = array())
    {
        return $this->modelBuilder->buildAll($objects, $this->class->getManagerIdentifier(), $fields);
    }
276222
public static function fetchTeam($team = null)
    {
        if (is_null($team) || !Config::get('laratrust.use_teams')) {
            return null;
        }

        return static::getIdFor($team, 'team');
    }
932084
public function listTeams(string $org): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org));
    }
281555
public function team($identities)
	{
		if (is_array($identities))
		{
			if (count($identities) > 10)
			{
				throw new ListMaxException('This request can only support a list of 10 elements, '.count($identities).' given.');
			}
		}

		$ids = $this->extractIds($identities);
		$ids = implode(',', $ids);

		$array = $this->request('team/by-summoner/'.$ids);

		$summoners = [];
		foreach ($array as $summonerId => $summonerTeams)
		{
			$teams = [];
			foreach ($summonerTeams as $info)
			{
				$id         = $info['fullId'];
				$team       = $this->attachStaticDataToDto(new Dto\Team($info));
				$teams[$id] = $team;
			}
			$summoners[$summonerId] = $teams;

			foreach ($teams as $id => $team)
			{
				$this->teams[$id] = $team;
			}
		}

		$this->attachResponses($identities, $summoners, 'teams');

		if (is_array($identities))
		{
			return $summoners;
		}
		else
		{
			return reset($summoners);
		}
	}
270154
public static function hydrate( array $items, $connection = null )
	{
		$instance = ( new static )->setConnection( $connection );

		$items = array_map( function ( $item ) use ( $instance )
		{
			return $instance->newFromBuilder( $item );
		}, $items );

		return $instance->newCollection( $items );
	}
944972
public function prune($team = null)
    {
        if ($team) {
            $this->addUsingAlias(TeamTableMap::ID, $team->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
89299
public function team()
    {
        $teams = $this->rec->teams();
        foreach ($teams as $team) {
            if ($team->index() === $this->teamIndex) {
                return $team;
            }
        }
    }
1173967
public function getTeams($params = [])
  {
      $defaults = [
          'limit'  => 25,
          'offset' => 0,
      ];

      return $this->wrapper->request('GET', 'teams', ['query' => $this->resolveOptions($params, $defaults)]);
  }
68525
public function serialize(Team $team)
    {
        $users = $team->getRole() ? $team->getRole()->getUsers()->toArray() : $team->getUsers()->toArray();

        return [
            'id' => $team->getUuid(),
            'name' => $team->getName(),
            'description' => $team->getDescription(),
            'workspace' => $this->workspaceSerializer->serialize($team->getWorkspace(), [Options::SERIALIZE_MINIMAL]),
            'maxUsers' => $team->getMaxUsers(),
            'countUsers' => count($users),
            'selfRegistration' => $team->isSelfRegistration(),
            'selfUnregistration' => $team->isSelfUnregistration(),
            'directory' => $team->getDirectory() ?
                $this->resourceNodeSerializer->serialize($team->getDirectory()->getResourceNode(), [Options::SERIALIZE_MINIMAL]) :
                null,
            'publicDirectory' => $team->isPublic(),
            'deletableDirectory' => $team->isDirDeletable(),
            'role' => $team->getRole() ?
                $this->roleSerializer->serialize($team->getRole(), [Options::SERIALIZE_MINIMAL]) :
                null,
            'teamManagerRole' => $team->getTeamManagerRole() ?
                $this->roleSerializer->serialize($team->getTeamManagerRole(), [Options::SERIALIZE_MINIMAL]) :
                null,
        ];
    }
1043922
public static function hydrateCollection(array $modifications)
    {
        $hydrated = [];

        foreach ($modifications as $modification) {
            $hydrated[] = self::hydrate($modification);
        }

        return $hydrated;
    }