@param FileDescriptorProto[] $protos

@return array
960619
public function getFileDescriptors($protos)
    {
        $files = [];
        foreach ($protos as $proto) {
            $file = FileDescriptor::buildFromProto($proto);

            foreach ($file->getMessageType() as $desc) {
                $this->addDescriptor($desc);
            }
            unset($desc);

            foreach ($file->getEnumType() as $desc) {
                $this->addEnumDescriptor($desc);
            }
            unset($desc);

            foreach ($file->getMessageType() as $desc) {
                $this->crossLink($desc);
            }

            foreach ($file->getService() as $service) {
                $this->crossLinkService($service);
            }
            unset($desc);
            $files[] = $file;
        }
        return $files;
    }
1333347
private static function traverse($elems)
    {
        $result = [];

        foreach ($elems as $elem) {
            if ('{DAV:}property' !== $elem['name']) {
                continue;
            }

            $namespace = isset($elem['attributes']['namespace']) ?
                $elem['attributes']['namespace'] :
                'DAV:';

            $propName = '{'.$namespace.'}'.$elem['attributes']['name'];

            $value = null;
            if (is_array($elem['value'])) {
                $value = self::traverse($elem['value']);
            }

            $result[$propName] = $value;
        }

        return $result;
    }
978137
private function parseHeaders(array $headers)
    {
        $indexes = [];
        $metas   = [];

        foreach ($headers as $key => $value) {
            $key = strtolower($key);

            if (strpos($key, 'x-riak-index-') === 0) {
                $name  = substr($key, 13);
                $value = isset($indexes[$name])
                    ? array_merge($indexes[$name], $value)
                    : $value;

                $indexes[$name] = $value;
            }

            if (strpos($key, 'x-riak-meta-') === 0) {
                $name  = strtolower(substr($key, 12));
                $value = is_array($value)
                    ? reset($value)
                    : $value;

                $metas[$name] = $value;
            }
        }

        return [
            'indexes' => $indexes,
            'metas'   => $metas
        ];
    }
407942
public function parse( $files, $initialize = array( ) ) {
		\UArray::doConvertToArray( $files );
		$result = array( );
		if ( is_array( $initialize ) ) {
			array_unshift( $files, $initialize );
		}
		foreach ( $files as $file ) {
			$parsed = $this->parseIni( $file );
			$this->mergeValues( $result, $parsed );
		}
		if ( $this->arrayObjectOption ) {
			$options = array( $this->errorStrategy );
			if ( ! $this->deepSelectorOption ) {
				$options[ ] = \Pixel418\Iniliq::DISABLE_DEEP_SELECTORS;
			}
			$ArrayClass = \UObject::getNamespace( $this ) . '\\ArrayObject';
			$result = new $ArrayClass( $result, $options );
		}
		return $result;
	}
1029047
public function describe_file_types($types) {

        $descriptions = [];
        $types = $this->normalize_file_types($types);

        foreach ($types as $type) {
            if ($type === '*') {
                $desc = get_string('filetypesany', 'core_form');
                $descriptions[$desc] = [];
            } else if ($group = $this->is_filetype_group($type)) {
                $desc = $this->get_group_description($type);
                $descriptions[$desc] = $group->extensions;

            } else if ($this->looks_like_mimetype($type)) {
                $desc = get_mimetype_description($type);
                $descriptions[$desc] = file_get_typegroup('extension', [$type]);

            } else {
                $desc = get_mimetype_description(['filename' => 'fakefile'.$type]);
                if (isset($descriptions[$desc])) {
                    $descriptions[$desc][] = $type;
                } else {
                    $descriptions[$desc] = [$type];
                }
            }
        }

        $data = [];

        foreach ($descriptions as $desc => $exts) {
            sort($exts);
            $data[] = (object)[
                'description' => $desc,
                'extensions' => join(' ', $exts),
            ];
        }

        core_collator::asort_objects_by_property($data, 'description', core_collator::SORT_NATURAL);

        return (object)[
            'hasdescriptions' => !empty($data),
            'descriptions' => array_values($data),
        ];
    }
179155
public final function getValidateRules(...$fileds) {
		if ($fileds) {
			$rules = [];
			foreach ($fileds as $f) {
				if (isset($this->rules[ $f ])) {
					$rules[ $f ] = $this->rules[ $f ];
				}
			}

			return $rules;
		}

		return $this->rules;
	}
1088152
private function getImages(array $ids)
    {
        if (empty($ids)) {
            return [];
        }

        $qb = $this->getImageRepository()->createQueryBuilder('o');

        $images = $qb
            ->where($qb->expr()->in('o.id', $ids))
            ->orderBy('o.position')
            ->getQuery()
            ->getResult();

        if (count($images) !== count($ids)) {
            throw $this->createNotFoundException('Unable to find one or more images.');
        }

        return $images;
    }
1087977
public static function prototype(?bool $isConsole = false) : array
  {
    return [
      'console' => $isConsole,
      'config' => Application::getConfig(),
      'events' => new Events,
      'route' => new Route,
      'view' => Template::class,
      'variables' => GlobalVariables::class
    ];
  }
259979
public static function getSchemasByNamespaces(array $namespaces)
    {
        $schemas = [];

        /** @var SchemaDescriptor $schema */
        foreach (self::$schemasByCurie as $schema) {
            if (in_array($schema->getId()->getNamespace(), $namespaces)) {
                $schemas[] = $schema;
            }
        }

        return $schemas;
    }
1206721
private function getRawHeaders(array $headers)
    {
        $rawHeaders = '';
        foreach ($headers as $key => $value) {
            $rawHeaders .= sprintf("%s: %s\n", $key, is_array($value) ? implode(', ', $value) : $value);
        }
        $rawHeaders .= "\n";

        return $rawHeaders;
    }
163689
private function readRowFromAssoc(array $attributes, array $typeNames, AbstractPlatform $platform): array
    {
        $row = [];
        foreach ($this->readTypedAttributes($attributes, $typeNames, $platform) as $name => $value) {
            $row[$name] = $value;
        }

        return $row;
    }
817629
private static function _createSocket($proto)
    {
        $sock = ($proto === 'tcp') ?
            socket_create(AF_INET, SOCK_STREAM, SOL_TCP):
            socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)
        ;
        if (!$sock) {
            throw new \UnexpectedValueException("socket_create() failed: " . socket_strerror(socket_last_error()));
        }
        return $sock;
    }
665864
protected function getResultArray(SearchRequest $searchRequest, $suggestions, $documents, $didASecondSearch) : array
    {
        return ['suggestions' => $suggestions, 'suggestion' => $searchRequest->getRawUserQuery(), 'documents' => $documents, 'didSecondSearch' => $didASecondSearch];
    }
964674
public static function support(array $processingTypes)
    {
        $prototypes = [];

        foreach ($processingTypes as $typeClassOrPrototype) {
            if ($typeClassOrPrototype instanceof Prototype) {
                $prototypes[] = $typeClassOrPrototype;
            } else {
                Assertion::string($typeClassOrPrototype);
                Assertion::classExists($typeClassOrPrototype);
                Assertion::implementsInterface($typeClassOrPrototype, Type::class);
                $prototypes[] = $typeClassOrPrototype::prototype();
            }
        }

        return new self($prototypes, false);
    }
544729
public function toArray()
    {
        $prototypes = $this->getPrototypes();
        $signatures = array();
        foreach ($prototypes as $prototype) {
            $signatures[] = $prototype->toArray();
        }

        return array(
            'name'            => $this->getName(),
            'callback'        => $this->getCallback()->toArray(),
            'prototypes'      => $signatures,
            'methodHelp'      => $this->getMethodHelp(),
            'invokeArguments' => $this->getInvokeArguments(),
            'object'          => $this->getObject(),
        );
    }
1019357
protected function parseImplicitMultiplication(array $tokens)
    {
        $result = [];
        $lastToken = null;
        foreach ($tokens as $token) {
            if (Token::canFactorsInImplicitMultiplication($lastToken, $token)) {
                $result[] = new Token('*', TokenType::MultiplicationOperator);
            }
            $lastToken = $token;
            $result[] = $token;
        }
        return $result;
    }
1063661
private function getFiles(array $uploadedFiles)
    {
        $files = [];

        foreach ($uploadedFiles as $key => $value) {
            if ($value instanceof UploadedFileInterface) {
                $files[$key] = $this->createUploadedFile($value);
            } else {
                $files[$key] = $this->getFiles($value);
            }
        }

        return $files;
    }