Parse an array of properties into a storable format

@param array $rawProperties An array of properties to parse
@return array Parsed array of properties
775147
protected function parseProperties(array $rawProperties) {
        if (isset($rawProperties['exif:GPSLatitude']) &&
            isset($rawProperties['exif:GPSLongitude'])) {

            // We store coordinates in GeoJSON-format (lng/lat)
            $rawProperties['gps:location'] = [
                $this->parseGpsCoordinate(
                    $rawProperties['exif:GPSLongitude'],
                    $rawProperties['exif:GPSLongitudeRef']
                ),
                $this->parseGpsCoordinate(
                    $rawProperties['exif:GPSLatitude'],
                    $rawProperties['exif:GPSLatitudeRef']
                ),
            ];
        }

        if (isset($rawProperties['exif:GPSAltitude'])) {
            $alt = explode('/', $rawProperties['exif:GPSAltitude'], 2);
            $rawProperties['gps:altitude'] = $alt[0] / (int) $alt[1];
        }

        $properties = [];
        foreach ($rawProperties as $key => $val) {
            // Get rid of dots in property names
            $key = str_replace('.', ':', $key);

            // Replace underscore with dash for png properties
            if (substr($key, 0, 3) === 'png') {
                $key = str_replace('_', '-', $key);
            }

            $properties[$key] = $val;
        }

        return $properties;
    }
1279464
protected function getPropertiesContentData($properties, $propertyValues)
    {
        $contentData = [];

        foreach ($properties as $property) {
            if ($this->exportManager->hasExport($property->getType(), $this->format)) {
                if (!isset($propertyValues[$property->getName()])) {
                    continue;
                }

                $propertyValue = $propertyValues[$property->getName()];

                if ($property instanceof BlockMetadata) {
                    $data = $this->getBlockPropertyData($property, $propertyValue);
                } else {
                    $data = $this->getPropertyData($property, $propertyValue);
                }

                $contentData[$property->getName()] = $data;
            }
        }

        return $contentData;
    }
381582
public function data(array $properties = null)
    {
        $data = [];
        $properties = $this->properties($properties);
        foreach ($properties as $propertyIdent => $property) {
            // Ensure objects are properly encoded.
            $val = $this->propertyValue($propertyIdent);
            $val = $this->serializedValue($val);
            $data[$propertyIdent] = $val;
        }

        return $data;
    }
900362
protected function parseProperties($propertiesDefinition, &$loadedDependencies = array()){
        $parseProperties= array();
        foreach ($propertiesDefinition as $key => $definition) {
            $property= NULL;
            if(isset($definition['ref'])){
                //Conseguimos la dependencia
                $property= $this->getDependency($definition['ref'], $loadedDependencies);
            }else{
                //Casteo el valor al tipo indicado
                $property= $definition['value'];
                if($definition['value'] != 'array'){
                    settype($property, $definition['type']);
                }
            }
            $parseProperties[$key]= $property;
        }
        return $parseProperties;
    }
536338
public function getPropertyNames()
    {
        $result = array();

        foreach ( $this->getRawPropertyNames() as $rawName )
        {
            $result[] = String::camelize( $rawName );
        }

        return $result;
    }
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]);
        }
    }
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;
    }
19484
protected function parseProperties(array $properties, string $slug)
    {
        switch (count($properties)) {
            case 1:
                // Square with defaults.
                return [$properties[0], $properties[0], false, false];
                break;
            case 2:
                // Custom size with defaults.
                return [$properties[0], $properties[1], false, false];
                break;
            case 3:
                // Custom size with custom crop option.
                return [$properties[0], $properties[1], $properties[2], false];
                break;
            case 4:
            default:
                // All properties with custom label.
                $label = (is_bool($properties[3]) && true === $properties[3]) ? $this->label($slug) : $properties[3];

                return [$properties[0], $properties[1], $properties[2], $label];
        }
    }
661357
private function parseHttpHeaders($rawHeaders) {
		// ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986
		$headers = array();
		$key = '';

		foreach (explode("\n", $rawHeaders) as $h) {
			$h = explode(':', $h, 2);

			if (isset($h[1])) {
				if (!isset($headers[$h[0]])) {
					$headers[$h[0]] = trim($h[1]);
				} elseif (is_array($headers[$h[0]])) {
					$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
				} else {
					$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
				}

				$key = $h[0];
			} else {
				if (substr($h[0], 0, 1) === "\t") {
					$headers[$key] .= "\r\n\t".trim($h[0]);
				} elseif (!$key) {
					$headers[0] = trim($h[0]);
				}
				trim($h[0]);
			}
		}

		return $headers;
	}
139982
public function buildFromRaw(array $rawTokens)
    {
        trigger_error(__CLASS__.' is no longer supported and will be removed in version 2', \E_USER_DEPRECATED);
        $lineNumber = 0;
        $tokens = array();
        foreach ($rawTokens as $rawToken) {
            $token = $this->makeFromRaw($rawToken, $lineNumber);
            if ($token->hasNumber()) {
                $lineNumber = $token->getLineNumber() + substr_count($token->getValue(), "\n");
            }
            $tokens[] = $token;
        }

        return $tokens;
    }
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;
    }
334366
private function methodLoader(array $classProperties)
    {
        $result = [];
        foreach ($classProperties as $propertyName => $nullVal) {
            $result[$propertyName] = $this->getPropertyValue($propertyName);
        }

        return $result;
    }
582312
private function resolveRawProgresses(array $rawProgresses): array
    {
        static $callbacks;

        $callbacks = $callbacks ?? [
            self::OP_CPY => function (int $x, int $y): array {
                return [self::OP_CPY, $x - 1, $y - 1, 1];
            },
            self::OP_DEL => function (int $x, int $y): array {
                return [self::OP_DEL, $x - 1, $y, 1];
            },
            self::OP_INS => function (int $x, int $y): array {
                return [self::OP_INS, $x, $y - 1, 1];
            },
            self::OP_REP => function (int $x, int $y): array {
                return [self::OP_REP, $x - 1, $y - 1, 1];
            },
        ];

        foreach ($rawProgresses as &$rawProgress) {
            $rawProgress = $callbacks[$rawProgress[2]](
                $rawProgress[0],
                $rawProgress[1]
            );
        }
        unset($rawProgress);

        return $rawProgresses;
    }
826447
public function getHttpResponseHeaders($rawHeaders)
    {
        if (is_array($rawHeaders)) {
            return $this->parseArrayHeaders($rawHeaders);
        }
        return $this->parseStringHeaders($rawHeaders);
    }
759972
protected function resolveStreamProperties(array $properties)
	{
		// defaults keys for transforming
		$properties += [
			'tags'            => [],
			'sample_rate'     => 0,
			'codec_name'      => null,
			'codec_long_name' => '',
			'type'            => $properties['codec_type'],
			'frequency'       => 0,
			'channels'        => 1
		];
		
		$properties['metadata'] = (array) $properties['tags'];
		$properties['frequency'] = (int) $properties['sample_rate'];
		$properties['codec'] = new Codec($properties['codec_name'], $properties['codec_long_name']);
		$properties['frame_rate'] = isset($properties['r_frame_rate']) ? $properties['r_frame_rate'] : 0.0;
		
		if (strpos($properties['frame_rate'], '/') > 0)
		{
			list($val1, $val2) = explode('/', $properties['frame_rate']);
			
			if ($val1 > 0 && $val2 > 0)
			{
				$properties['frame_rate'] = (float) $val1 / (float) $val2;
			}
		}
		
		return $properties;
	}
284684
public function getMultipleProperties(array $propertyNames)
    {
        $this->parseStyleAttribute();

        $result = [];

        foreach ($propertyNames as $propertyName) {
            if (!is_string($propertyName)) {
                throw new InvalidArgumentException(sprintf('Property name must be a string, %s given', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName))));
            }

            if (array_key_exists($propertyName, $this->properties)) {
                $result[$propertyName] = $this->properties[$propertyName];
            }
        }

        return $result;
    }
740260
private function parseHeaders($raw_headers)
    {
        $raw_headers = preg_split('/\r\n/', $raw_headers, null, PREG_SPLIT_NO_EMPTY);
        $http_headers = [];

        $raw_headers_count = count($raw_headers);
        for ($i = 1; $i < $raw_headers_count; $i++) {
            list($key, $value) = explode(':', $raw_headers[$i], 2);
            $key = trim($key);
            $value = trim($value);
            // Use isset() as array_key_exists() and ArrayAccess are not compatible.
            if (isset($http_headers[$key])) {
                $http_headers[$key] .= ',' . $value;
            } else {
                $http_headers[$key] = $value;
            }
        }

        return array(isset($raw_headers['0']) ? $raw_headers['0'] : '', $http_headers);
    }