Hydrate a collection of context objects into a collection of
ContextEntity objects

@param stdClass[] $contexts
@return ContextEntity[]
424584
public static function hydrateCollection(array $contexts)
    {
        $hydrated = [];

        foreach ($contexts as $context) {
            $hydrated[] = self::hydrate($context);
        }

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

        foreach ($resources as $resource) {
            $hydrated[] = self::hydrate($resource);
        }

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

        foreach ($languages as $language) {
            $hydrated[] = self::hydrate($language);
        }

        return $hydrated;
    }
487848
private function getData($context)
    {
        if (!array_key_exists($context, $this->storage)) {
            $this->storage[$context] = new FilesystemCache($this->directory . '/' . $context, self::EXTENSION);
        }

        return $this->storage[$context];
    }
306963
public function jsonLDSerialize(string $context = self::DEFAULT_CONTEXT, bool $types = NULL)
    {
        return array_map(function($m) use ($context, $types) {
            return $m->jsonLDSerialize($context, $types ?? true); 
        }, $this->members);
    }
653282
public static function getDataCacheKey($data, Context $context)
    {
        $group = $context->hasAttribute('groups') ? $context->getAttribute('groups') : '*';
        $version = $context->hasAttribute('version') ? $context->getAttribute('version') : '*';

        $dataArray = [
            'data' => $data,
            'serializationFormat' => $context->getFormat(),
            'serializationGroups' => $group,
            'serializationVersion' => $version,
        ];

        try {
            return \sha1(\serialize($dataArray));
        } catch (\Exception $e) {
            return;
        }
    }
1295868
protected function mergeContextHeaders($context)
    {
        $headers = $this->headers->asArray();
        
        if($context === null ) {
            return $headers;
        }
        
        $cookieUpdates = $context->cookies()->updates();
        if(empty($cookieUpdates)) {
            return $headers;
        }
        
        $cookieHeaders = array();
        foreach($cookieUpdates as $update) {
            $cookieHeaders[] = $update->asHeader();
        }
        
        foreach($headers as $name => $value) {
            if(strtolower($name) === 'set-cookie') {
                foreach($cookieHeaders as $header) {
                    $headers[$name][] = $header;
                }
                return $headers;
            }
        }
        
        $headers['Set-Cookie'] = $cookieHeaders;
        return $headers;
    }
976548
public static function hydrateCollection(array $controllers)
    {
        $hydrated = [];

        foreach ($controllers as $controller) {
            $hydrated[] = self::hydrate($controller);
        }

        return $hydrated;
    }
122264
public function setContexts($contexts)
    {
        if ($contexts) {
            foreach ((array) $contexts as $name => $value) {
                $this->getContext()->set($name, $value);
            }
        }
    }
962536
public function contextFactory(ContextFactory $instance = null, array $contexts = [])
    {
        if ($instance === null) {
            if ($this->_contextFactory === null) {
                $this->_contextFactory = ContextFactory::createWithDefaults($contexts);
            }

            return $this->_contextFactory;
        }
        $this->_contextFactory = $instance;

        return $this->_contextFactory;
    }
1135320
public static function hydrateCollection(array $extensions)
    {
        $hydrated = [];

        foreach ($extensions as $extension) {
            $hydrated[] = self::hydrate($extension);
        }

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

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

        return $hydrated;
    }
1222266
public function remove( $contexts )
	{
		if ( is_string( $contexts ) )
		{
			unset( $this->contexts[ $contexts ] );
		}
		else if ( $contexts instanceof ContextsFilter )
		{
			$contexts = array_keys( $contexts->getContexts() );
		}

		if ( is_array( $contexts ) )
		{
			foreach ( $contexts as $context )
			{
				unset( $this->contexts[ $context ] );
			}
		}

		return $this;
	}
536666
private function packValues(array $entities): array
    {
        $result = [];
        foreach ($entities as $entity) {
            $result[] = $entity->packValue();
        }

        return $result;
    }
477558
public static function hydrateCollection(array $applications)
    {
        $hydrated = [];

        foreach ($applications as $application) {
            $hydrated[] = self::hydrate($application);
        }

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

        foreach ($phps as $php) {
            $hydrated[] = self::hydrate($php);
        }

        return $hydrated;
    }
894784
private function hydrateMany(string $classPath, array $data): Collection
    {
        $collection = new Collection();
        foreach ($data as $entityData) {
            /** @var Hydratable $entity */
            $entity = new $classPath();
            $entity->hydrate($entityData);

            $collection->append($entity);
        }

        return $collection;
    }