@param array $raw

@return $this[]|self[]
187131
public static function create(array $raw) : array
    {
        $return = [];
        foreach ($raw as $postName => $fileValue) {
            if (!is_array($fileValue['error'])) {
                if ($fileValue['error'] != 4) {
                    $return[$postName] = new self($postName, $fileValue);
                }
            } else {
                $keys = [$postName];

                $browse = function (\RecursiveArrayIterator $iterator) use (
                    &$browse,
                    &$keys,
                    &$return,
                    $postName,
                    $fileValue
                ) {
                    while ($iterator->valid()) {
                        $arrayKeys = array_keys($iterator->getArrayCopy());
                        $currentKey = $arrayKeys[sizeof($arrayKeys) - 1];
                        $currentValue = $iterator->getArrayCopy()[$iterator->key()];

                        if ($iterator->hasChildren()) {
                            $keys[] = $iterator->key();
                            $browse($iterator->getChildren());
                        } else {
                            $names = &$fileValue['name'];
                            $types = &$fileValue['type'];
                            $sizes = &$fileValue['size'];
                            $tmps = &$fileValue['tmp_name'];
                            $errors = &$fileValue['error'];

                            $clone = array_merge($keys, [$iterator->key()]);
                            array_shift($clone);

                            $returnRef = &$return[$postName];

                            while (!is_null($key = array_shift($clone))) {
                                $names = &$names[$key];
                                $types = &$types[$key];
                                $sizes = &$sizes[$key];
                                $tmps = &$tmps[$key];
                                $errors = &$errors[$key];

                                $returnRef = &$returnRef[$key];
                            }

                            if (!is_null($names) && $errors != 4) {
                                $returnRef = new File(implode('/', $keys), [
                                    'name' => $names,
                                    'type' => $types,
                                    'size' => $sizes,
                                    'tmp_name' => $tmps,
                                    'error' => $errors,
                                ]);
                            }
                        }

                        // reset, iterator change tree
                        if (!is_array($currentValue) && $currentKey == $iterator->key()) {
                            $keys = [$postName];
                        }

                        $iterator->next();
                    }
                };

                $iterator = new \RecursiveArrayIterator($fileValue['name']);
                iterator_apply($iterator, $browse, [$iterator]);
            }
        }

        return $return;
    }
639486
protected static function parseOrder(array $rawOrder) {

        $dtOrder = new DataTablesOrder();

        if (false === static::isValidRawOrder($rawOrder)) {
            return $dtOrder;
        }

        $dtOrder->setColumn(intval($rawOrder[DataTablesOrderInterface::DATATABLES_PARAMETER_COLUMN]));
        $dtOrder->setDir($rawOrder[DataTablesOrderInterface::DATATABLES_PARAMETER_DIR]);

        return $dtOrder;
    }
668916
public function toResponse(): array
    {
        $r = [];
        foreach ($this->raw as $cookie) {
            $r[] = (string)$cookie;
        }

        return $r;
    }
554696
protected static function parseOrders(array $rawOrders) {

        $dtOrders = [];

        foreach ($rawOrders as $current) {
            $dtOrders[] = static::parseOrder($current);
        }

        return $dtOrders;
    }
669576
public function setRawData(array $data) {

        $this->rawData = $data;

        if (isset($data['message'])) {
            $this->setMessage($data['message']);
        }

        return $this;

    }
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;
	}
117211
private function fixValues(array $rawData): array
    {
        $data = [];
        foreach ($rawData as $key => $value) {
            if (is_array($value)) {
                $data[$key] = $this->fixValues($value);
            } else {
                $data[$key] = $this->fixValue($value);
            }
        }

        return $data;
    }
630318
public function parse($raw)
    {
        $lines = explode("\n", $raw);

        // Status Line
        preg_match('/HTTP\/(\d\.\d) (\d\d\d) (.*)/', $lines[0], $statusLine);
        $response = (new Response())
            ->withProtocolVersion($statusLine[1])
            ->withStatus($statusLine[2], $statusLine[3]);
        unset($lines[0]);

        // Headers
        foreach ($lines as $i => $line) {
            if ('' == trim($line)) {
                unset($lines[$i]);
                break;
            }
            $header   = explode(': ', $line);
            $response = $response->withHeader($header[0], $header[1]);
            unset($lines[$i]);
        }

        // Body
        $stream = new Stream(fopen('php://memory', 'rw+'));
        $stream->write(implode("\n", $lines));
        $stream->rewind();
        $response = $response->withBody($stream);

        return $response;
    }
524071
protected function prepareHeaders(array $rawHeaders)
    {
        $headers = array();
        
        foreach ($rawHeaders as $rawHeader) {
            if (strpos($rawHeader, ':')) {
                $data = explode(':', $rawHeader);
                $headers[$data[0]][] = trim($data[1]);
            }            
        }
        
        return $headers;
    }
359632
public function tableRaw(string $raw)
    {
        $this->option->table->useRaw(true);
        $this->option->table->setRawSQL($raw);
        return $this;
    }
878041
protected function filterArray($rules, $rawAttributes)
    {
        $attributes = [];
        foreach (array_keys($rules) as $filedName) {
            $value = array_get($rawAttributes, $filedName, 'not found in array'); // Default value !== null
            if ($value !== 'not found in array') { // Only if field specified in incoming array
                if (isset($this->filters[$filedName])) {
                    $filters = explode('|', $this->filters[$filedName]);
                    foreach ($filters as $filter) {
                        array_set($attributes, $filedName, $this->$filter($value));
                    }
                } else {
                    array_set($attributes, $filedName, $value);
                }
            }
        }
        return $attributes;
    }
891437
public function unserialize($raw) {
        $returnData = array();
        $offset     = 0;

        while ($offset < strlen($raw)) {
            if (!strstr(substr($raw, $offset), "|")) {
                throw new \UnexpectedValueException("invalid data, remaining: " . substr($raw, $offset));
            }

            $pos     = strpos($raw, "|", $offset);
            $num     = $pos - $offset;
            $varname = substr($raw, $offset, $num);
            $offset += $num + 1;
            $data    = unserialize(substr($raw, $offset));

            $returnData[$varname] = $data;
            $offset += strlen(serialize($data));
        }

        return $returnData;
    }
830103
public static function prepareChoices(array $raw_choices) {
    // The $raw_choices can be an associative array.
    $choices = array_values($raw_choices);
    // Start choices list form '1'.
    array_unshift($choices, NULL);
    unset($choices[0]);
    return $choices;
  }
1013719
public function asArray()
    {
        $array = [];

        foreach ($this as $key => $val) {
            if ($val instanceof self) {
                $val = $val->asArray();
            }
            $array[$key] = $val;
        }

        return $array;
    }
1289056
public function groupRaw(string $raw)
    {
        $group = new Group();
        $group->useRaw();
        $group->setRawSQL($raw);
        $this->option->group[] = $group;
        return $this;
    }
738823
public static function fromRaw(array $raw)
    {
        $last = $raw[count($raw) - 2];
        if (strncmp($last, 'ACK', 3) === 0) {
            return self::produceFailResponse($last);
        }
        array_pop($raw);
        array_pop($raw);
        return new self($raw);
    }
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;
    }