Hydrate a collection of license objects into a collection of
LicenseEntity objects

@param stdClass[] $licenses
@return LicenseEntity[]
352935
public static function hydrateCollection(array $licenses)
    {
        $hydrated = [];

        foreach ($licenses as $license) {
            $hydrated[] = self::hydrate($license);
        }

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

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

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

        foreach ($customClasses as $customClass) {
            $hydrated[] = self::hydrate($customClass);
        }

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

        foreach ($types as $type) {
            $hydrated[] = self::hydrate($type);
        }

        return $hydrated;
    }
1251163
public static function hydrate(stdClass $source)
    {
        $hydrated = new SourceEntity();

        if (isset($source->id)) {
            $hydrated->setId($source->id);
        }

        if (isset($source->class)) {
            $hydrated->setClass($source->class);
        }

        if (isset($source->method)) {
            $hydrated->setMethod($source->method);
        }

        if (isset($source->property)) {
            $hydrated->setProperty($source->property);
        }

        if (isset($source->parameter)) {
            $hydrated->setParameter($source->parameter);
        }

        if (isset($source->type)) {
            $hydrated->setType($source->type);
        }

        return $hydrated;
    }
177713
private function pullFromEntities(array $entities)
    {
        $events = [];
        foreach ($entities as $entity) {
            // ignore Doctrine not initialized proxy classes
            // proxy class can't have a domain events
            if ((!($entity instanceof Proxy) || $entity->__isInitialized()) && $entity instanceof AggregateEvents) {
                $events = array_merge($events, $entity->pullEvents());
            }
        }

        return $events;
    }
1302574
public static function hydrateCollection(array $sinks)
    {
        $hydrated = [];

        foreach ($sinks as $sink) {
            $hydrated[] = self::hydrate($sink);
        }

        return $hydrated;
    }
337551
private function encapsulate($entities)
	{
		$items = [];

		foreach ($entities as $entity)
		{
			$items[] = Entity::fromMetadata($entity, $this);
		}

		return new Collection($items);
	}
833563
public function transform($entities)
    {
        if (is_null($entities) || count($entities) === 0) {
            return [];
        }

        $data = [];
        $accessor = PropertyAccess::createPropertyAccessor();

        foreach ($entities as $entity) {
            $text = is_null($this->textProperty)
                ? (string)$entity
                : $accessor->getValue($entity, $this->textProperty);
            $data[$accessor->getValue($entity, $this->primaryKey)] = [
                'text' => $text
            ];
        }

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

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

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

        return $result;
    }
647617
public function checkEntities($entities)
    {
        return array_filter($entities, function ($val) {
            $entityClass = $this->entityClass;
            return ($val instanceof $entityClass);
        });
    }
609692
protected function transform_db_records_to_entities(array $records) {
        $preprocessors = $this->get_preprocessors();
        $result = array_map(function($record) {
            return ['record' => $record];
        }, $records);

        $result = array_reduce(array_keys($preprocessors), function($carry, $preprocessor) use ($records, $preprocessors) {
            $step = $preprocessors[$preprocessor];
            $dependencies = $step->execute($records);

            foreach ($dependencies as $index => $dependency) {
                // Add the new dependency to the list.
                $carry[$index] = array_merge($carry[$index], [$preprocessor => $dependency]);
            }

            return $carry;
        }, $result);

        return $this->from_db_records($result);
    }
1006073
public function getModels ($entities)
    {
        $models = array();

        foreach ($entities as $entity) {
            $models[] = $this->getModel($entity);
        }

        return $models;
    }
855389
public static function collectIds($entities)
	{
		$ids = array();

		foreach ($entities as $entity) {
			$ids[] = $entity->getId();
		}

		return $ids;
	}
420229
public static function hydrateCollection(array $reviews)
    {
        $hydrated = [];

        foreach ($reviews as $review) {
            $hydrated[] = self::hydrate($review);
        }

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

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

        return $hydrated;
    }