Parse FILE input and return HttpFile objects.
@param  array  $raw
@return array
321032
protected function parseFiles(array $raw) {
		if(isset($raw['name']) && isset($raw['type']) && isset($raw['tmp_name']) && isset($raw['error']) && isset($raw['size'])) {
			if(is_array($raw['name'])) {
				$name = $this->convertTo('name', $raw['name']);
				$type = $this->convertTo('type', $raw['type']);
				$tmp_name = $this->convertTo('tmp_name', $raw['tmp_name']);
				$error = $this->convertTo('error', $raw['error']);
				$size = $this->convertTo('size', $raw['size']);

				$files = $this->mergeAll($name, $type, $tmp_name, $error, $size);

				foreach($files as $k=>$v)
					$files[$k] = \Asgard\Http\HttpFile::createFromArray($v);
			}
			else
				$files = \Asgard\Http\HttpFile::createFromArray($raw);
		}
		else {
			foreach($raw as $k=>$v)
				$raw[$k] = $this->parseFiles($v);
			$files = $raw;
		}

		return $files;
	}
799246
public function data($raw = false)
    {
        $data = $this->getArrayCopy();

        if ($raw) {
            foreach ($data as $key => $val) {
                if ($val instanceof Resource) {
                    $data[$key] = $val->data($raw);
                }
            }
            foreach ($this->link_data as $key => $val) {
                if ($val instanceof Resource) {
                    $data[$key] = $val->data($raw);
                }
            }
        }

        return $data;
    }
101424
protected function parserHttpHeadersAsArray($rawHeaders)
    {
        $headers = array();

        foreach(explode("\n", $rawHeaders) as $i => $line)
        {
            if($i == 0)
            {
                $headers['HTTP_STATUS'] = substr($line, 9, 3);
            }
            else
            {
                list($key, $value) = explode(': ', $line);
                $headers[trim($key)] = trim($value);
            }
        }

        return $headers;
    }
887237
protected function parseRequestBody($requestBody)
    {
        $body = $files = [];
        if(is_string($requestBody))
        {
            $body = $requestBody;
        }
        else if(is_array($requestBody))
        {
            foreach($requestBody as $k => $v)
            {
                if($v instanceof UploadedFile)
                {
                    $files[] = $v;
                }
                else
                {
                    $body[$k] = $v;
                }
            }
            $body = http_build_query($body, '', '&');
        }
        else
        {
            throw new \InvalidArgumentException('$requestBody only can be string or array');
        }
        return [$body, $files];
    }
740713
public static function parseHeaders(string $raw_header): array
    {
        $raw_header = explode("\r\n\r\n", $raw_header);
        if (count($raw_header) > 1) {
            $headers = [];
            foreach ($raw_header as $header) {
                $headers[] = self::parseHeader($header);
            }

            return $headers;
        } else {
            return self::parseHeader($raw_header[0]);
        }
    }
300800
public function parse($rawData) {
        $rawData = trim($rawData);

        $start = substr($rawData, 0, 4);
        if ($start === '<!--') {
            $stop = '-->';
        } elseif (substr($start, 0, 2) === '/*') {
            $start = '/*';
            $stop = '*/';
        } else {
            return [];
        }

        $meta = trim(substr($rawData, strlen($start), strpos($rawData, $stop) - (strlen($stop) + 1)));
        try {
            $meta = Yaml::parse($meta);//$this->parsePhileFormat($meta);
            $meta = ($meta === null) ? [] : $this->convertKeys($meta);
        } catch (ParseException $e) {
            printf("Unable to parse the YAML string: %s<br>", $e->getMessage());
        }
        return $meta;
    }
656641
private function parseFile(string $path): array
    {
        $json = json_decode(file_get_contents($path), true);
        $root = dirname($path);

        $namespaces = array_merge(
            iterator_to_array($this->parseNamespaces($json['autoload']['psr-4'] ?: [], $root)),
            iterator_to_array($this->parseNamespaces($json['autoload-dev']['psr-4'] ?: [], $root))
        );
        return $namespaces;
    }
342136
protected function readMetadata($id)
    {
        $filename = $this->getFilename($id, true);
        $this->assertFile($filename);
        if (is_file($filename)) {
            if (false === ($data = file_get_contents($filename))) {
                throw new RawFileCacheException(sprintf('Cannot read file : %s', $filename), RawFileCacheException::CANNOT_READ_FILE);
            }
            return (array)unserialize($data);
        }
        return [];
    }
1353680
protected function splitHeaders($rawHeaders)
    {
        $headers = array();

        $lines = explode("\n", trim($rawHeaders));
        $headers['HTTP'] = array_shift($lines);

        foreach ($lines as $h) {
            $h = explode(':', $h, 2);

            if (isset($h[1])) {
                $headers[$h[0]] = trim($h[1]);
            }
        }

        return (object)$headers;
    }
584613
public function parseRawHeaders(array $rawHeaders)
    {
        $headers = array();
        $key = '';
        foreach ($rawHeaders as $rawHeader) {
            $rawHeaderLineParts = explode(':', $rawHeader, 2);
            if (isset($rawHeaderLineParts[1])) {
                $key = $rawHeaderLineParts[0];
                $value = trim($rawHeaderLineParts[1]);
                if (!isset($headers[$key])) {
                    $headers[$key] = $value;
                } elseif (is_array($headers[$key])) {
                    $headers[$key][] = $value;
                } else {
                    $headers[$key] = array($headers[$key], $value);
                }
            } elseif (strlen($rawHeaderLineParts[0]) > 0) {
                if (!$key) {
                    $headers[0] = trim($rawHeaderLineParts[0]);
                } elseif (in_array(substr($rawHeaderLineParts[0], 0, 1), array(' ', "\t"))) {
                    if (is_array($headers[$key])) {
                        $lastValue = array_pop($headers[$key]);
                        $headers[$key][] = $lastValue . "\r\n" . rtrim($rawHeaderLineParts[0]);
                    } else {
                        $headers[$key] .= "\r\n" . rtrim($rawHeaderLineParts[0]);
                    }
                }
            }
        }
        return $headers;
    }
689473
protected function getResponseContent(ResponseInterface $rawResponse)
    {
        // First check that content in response exists, due too bug: https://bugs.php.net/bug.php?id=54484
        $content = (string) $rawResponse->getBody();
        if (!$content) {
            return [];
        }

        $response = json_decode($content, true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            parse_str($content, $response);
        }

        return $response;
    }
932743
protected function _parse_assets($type, $assets, $attr, $group, $raw = false)
	{
		if ( ! is_array($assets))
		{
			$assets = array($assets);
		}

		foreach ($assets as $key => $asset)
		{
			// Prevent duplicate files in a group.
			if (\Arr::get($this->_groups, "$group.$key.file") == $asset)
			{
				continue;
			}

			$this->_groups[$group][] = array(
				'type'	=>	$type,
				'file'	=>	$asset,
				'raw'	=>	$raw,
				'attr'	=>	(array) $attr
			);
		}
	}
513260
public function load(array $file, Filesystem $fileReader)
    {
        if ($this->checkFile($file, $fileReader, $type = 'json') == true) {
            $this->open($file, $fileReader);
            if ($this->checkContentsAreArray() == true) {
                return $this->rawContents;
            }
        }
    }
236518
protected function getHeadersAsArray($rawHeaders)
    {
        $headers = [];

        foreach (explode("\r\n", (string) $rawHeaders) as $header) {
            if (false !== strpos($header, ':')) {
                list($name, $headerStr) = explode(':', $header, 2);
                $headers[trim($name)] = trim($headerStr);
            }
        }

        return $headers;
    }
242550
protected function parseData(array $data)
	{
		$this->files = array();

		foreach ($data as $key => $value)
		{
			// If this value is an instance of the HttpFoundation File class we will
			// remove it from the data array and add it to the files array, which
			// is used to conveniently separate out the files from other datas.
			if ($value instanceof File)
			{
				$this->files[$key] = $value;

				unset($data[$key]);
			}
		}

		return $data;
	}
714444
public function parseListing($raw)
    {
        $raw = explode(PHP_EOL, $raw);
        $raw = array_filter($raw);
        $data = [];

        foreach ($raw as $o) {
            $info = explode($this->delimeter, $o);

            $value = [
                'type'        => $info[$this->info_positions['TYPE']],
                'permissions' => $info[$this->info_positions['PERMISSIONS']],
                'date'        => $info[$this->info_positions['DATE']],
                'time'        => $info[$this->info_positions['TIME']],
                'owner'       => $info[$this->info_positions['OWNER']],
                'group'       => $info[$this->info_positions['GROUP']],
                'size'        => $info[$this->info_positions['SIZE']],
                'name'        => (!empty($info[$this->info_positions['NAME']])) ? $info[$this->info_positions['NAME']] : '../',
            ];

            array_push($data, $value);
        }

        return $data;
    }
879774
private function parseInput()
    {
        $result = null;
        try {
            $rawBody = file_get_contents('php://input');
            if (strpos($rawBody, '&form_key=')) {
                $parts = explode('&form_key=', $rawBody);
                $rawBody = reset($parts);
            }
            $obj = json_decode($rawBody, true);
            if ($obj) {
                $type = $this->getInDataType();
                $asArray = (array)$obj;
                $result = $this->inputProcessor->convertValue($asArray, $type);
            }
        } catch (\Throwable $t) {
            $this->logger->error("Cannot parse input data: " . $t->getMessage());
        }
        return $result;
    }