Warms up the metadata objects for the provided model types.

@param   array   $types
@return  array
513390
private function doWarm(array $types)
    {
        $warmed = [];
        $this->doClear($types);
        foreach ($types as $type) {
            $this->mf->getMetadataForType($type);
            $warmed[] = $type;
        }
        return $warmed;
    }
839091
public static function create(array $types) : IType
    {
        InvalidArgumentException::verifyAllInstanceOf(__METHOD__, 'types', $types, IType::class);

        $flatTypes = [];
        foreach ($types as $type) {
            if ($type instanceof UnionType) {
                $flatTypes += $type->getTypes();
            } else {
                $flatTypes[$type->asTypeString()] = $type;
            }
        }

        foreach ($flatTypes as $key => $type) {
            foreach ($flatTypes as $otherType) {
                if ($type->isSubsetOf($otherType) && !$type->equals($otherType)) {
                    unset($flatTypes[$key]);
                    continue 2;
                }
            }
        }

        if (count($flatTypes) === 1) {
            return reset($flatTypes);
        }

        $typeString = implode('|', array_keys($flatTypes));

        if (!isset(self::$cache[$typeString])) {
            self::$cache[$typeString] = new self($flatTypes, $typeString);
        }

        return self::$cache[$typeString];
    }
1105111
public function whereTypeIn(array $types)
    {
        if (count($types) > 0) {
            $this->joinSingleRelatives = true;
            $clause = '';

            for ($i = 0, $count = count($types); $i < $count; $i++) {
                $clause .= $i === 0 ?
                    "resourceType.name = :type_{$i}" :
                    "OR resourceType.name = :type_{$i}";
                $clause .= $i < $count - 1 ? PHP_EOL : '';
                $this->parameters[":type_{$i}"] = $types[$i];
            }

            $this->addWhereClause($clause);
        }

        return $this;
    }
259872
private static function getFieldTypeArray($fields)
    {
        if (count($fields) === 0) {
            return;
        }

        $types = array();

        foreach ($fields as &$field) {
            $types[] = $field->type;
        }

        return $types;
    }
1022820
private function propertyTypeUsesGroups(array $type)
    {
        if (array_key_exists($type['name'], $this->propertyTypeUseGroupsCache)) {
            return $this->propertyTypeUseGroupsCache[$type['name']];
        }

        try {
            $metadata = $this->factory->getMetadataForClass($type['name']);

            foreach ($metadata->propertyMetadata as $item) {
                if (null !== $item->groups && $item->groups != [GroupsExclusionStrategy::DEFAULT_GROUP]) {
                    $this->propertyTypeUseGroupsCache[$type['name']] = true;

                    return true;
                }
            }
            $this->propertyTypeUseGroupsCache[$type['name']] = false;

            return false;
        } catch (\ReflectionException $e) {
            $this->propertyTypeUseGroupsCache[$type['name']] = null;

            return null;
        }
    }
1313583
public function createFromArray(array $types)
    {
        foreach ($types as $type) {
            $this->collection->add(Type::fromString($type));
        }

        return $this->collection;
    }
127738
private function prepareComponentList (array $types)
    {
        $this->types = [];

        foreach ($types as $type)
        {
            $this->types[$type->getKey()] = $type;
        }
    }
315314
public function stack($types = [])
    {
        if (is_string($types)) {
            $types = explode(',', $types) ?: [];
            $types = array_filter(array_map('trim', $types));
        }

        $files = $this->stack->getList($types);

        return $files;
    }
347861
private function loadModels(array $items)
    {
        $classes = [];
        $results = [];

        // Retrieve a list of keys to load from each class.
        foreach ($items as $item) {
            if (!is_null($item['key'])) {
                $classes[$item['class']][] = $item['key'];
            }
        }

        // Iterate list of classes and load all records matching a key.
        foreach ($classes as $class => $keys) {
            $model = new $class();
            $results[$class] = $model->whereIn($model->getKeyName(), $keys)->get()->keyBy($model->getKeyName());
        }

        return $results;
    }
252125
public function getTermsByType($type)
    {
        $terms = new ArrayCollection();
        $taxonomies = $this->getTaxonomiesByType($type);

        /* @var TermTaxonomy $taxonomy */
        if ($taxonomies !== null) {
            foreach ($taxonomies as $taxonomy) {
                $terms[] = $taxonomy->getTerm();
            }
        }

        return ($terms->count() == 0) ? null : $terms;
    }
274119
protected function getValidators( $types )
    {
        $validators = array();

        if ( 'image/*' == $types )
        {
            $validators[] = array(
                'name' => 'Zend\Validator\File\IsImage',
            );
        }
        else if ( ! empty( $types ) && '*' !== $types && '*/*' !== $types )
        {
            $validators[] = array(
                'name'      => 'Zend\Validator\File\MimeType',
                'options'   => array(
                    'mimeType' => $types
                ),
            );
        }

        return $validators;
    }
156810
protected function valTypes(array $types)
    {
        $nonEmptyTypes = array_filter(array_map([$this, 'valType'], $types));

        // If there are no valid types
        if (!count($nonEmptyTypes)) {
            throw new InvalidArgumentException(
                InvalidArgumentException::EMPTY_TYPES_STR,
                InvalidArgumentException::EMPTY_TYPES
            );
        }

        return array_values($nonEmptyTypes);
    }
803475
public static function namesByType(array $types)
    {
        $names = array();

        foreach ($types as $type) {
            $names[] = self::nameByType($type);
        }

        return $names;
    }
1170589
public function withTypes(array $types)
    {
        $choices = [
            PlatformInterface::TYPE_MOBILE,
            PlatformInterface::TYPE_TV,
            PlatformInterface::TYPE_WEB,
        ];

        Assertion::allChoice($types, $choices);
        Assertion::same($types, \array_unique($types));

        $instance = clone $this;

        $instance->types = $types;

        return $instance;
    }
1232652
private function doClear(array $types)
    {
        $cleared = [];
        $this->mf->enableCache(false);

        foreach ($types as $type) {
            $metadata = $this->mf->getMetadataForType($type);
            $this->mf->getCache()->evictMetadataFromCache($metadata);
            $cleared[] = $type;
        }

        $this->mf->enableCache(true);
        $this->mf->clearMemory();
        return $cleared;
    }
873602
public function getBestResponseType(array $types)
    {
        if (empty($types))
            return "";

        $this->sortTypes($types);
        $type = reset($types);
        return $this->accepts($type) ? current($types) : null;
    }
1090045
public static function create(array $types = [])
    {
        $expandedTypes = [];

        foreach ([Direction::SERIALIZATION, Direction::DESERIALIZATION] as $direction) {
            $expandedTypes[$direction] = isset($types[$direction]) ? $types[$direction] : [];
            unset($types[$direction]);
        }

        $types = array_merge([
            Type::ARRAY_    => new ArrayType(),
            Type::BOOL      => $booleanType = new BooleanType(),
            Type::BOOLEAN   => $booleanType,
            Type::CLOSURE   => new ClosureType(),
            Type::DATE_TIME => new DateTimeType(),
            Type::DOUBLE    => $floatType = new FloatType(),
            Type::EXCEPTION => new ExceptionType(),
            Type::FLOAT     => $floatType,
            Type::INT       => $integerType = new IntegerType(),
            Type::INTEGER   => $integerType,
            Type::NULL      => new NullType(),
            Type::NUMERIC   => $floatType,
            Type::OBJECT    => new ObjectType(),
            Type::RESOURCE  => new ResourceType(),
            Type::STD_CLASS => new StdClassType(),
            Type::STRING    => new StringType(),
        ], $types);

        foreach ($expandedTypes as &$innerTypes) {
            $innerTypes = array_merge($types, $innerTypes);
        }

        return new static($expandedTypes);
    }