read BIFF8 constant value array from array data
returns e.g. array('value' => '{1,2;3,4}', 'size' => 40}
section 2.5.8

@param string $arrayData
@return array
513128
private static function readBIFF8ConstantArray($arrayData)
    {
        // offset: 0; size: 1; number of columns decreased by 1
        $nc = ord($arrayData[0]);

        // offset: 1; size: 2; number of rows decreased by 1
        $nr = self::getInt2d($arrayData, 1);
        $size = 3; // initialize
        $arrayData = substr($arrayData, 3);

        // offset: 3; size: var; list of ($nc + 1) * ($nr + 1) constant values
        $matrixChunks = array();
        for ($r = 1; $r <= $nr + 1; ++$r) {
            $items = array();
            for ($c = 1; $c <= $nc + 1; ++$c) {
                $constant = self::_readBIFF8Constant($arrayData);
                $items[] = $constant['value'];
                $arrayData = substr($arrayData, $constant['size']);
                $size += $constant['size'];
            }
            $matrixChunks[] = implode(',', $items); // looks like e.g. '1,"hello"'
        }
        $matrix = '{' . implode(';', $matrixChunks) . '}';

        return array(
            'value' => $matrix,
            'size' => $size,
        );
    }
1343156
private function _readBIFF8CellRangeAddressList($subData)
	{
		$cellRangeAddresses = array();

		// offset: 0; size: 2; number of the following cell range addresses
		$nm = self::_GetInt2d($subData, 0);

		$offset = 2;
		// offset: 2; size: 8 * $nm; list of $nm (fixed) cell range addresses
		for ($i = 0; $i < $nm; ++$i) {
			$cellRangeAddresses[] = $this->_readBIFF8CellRangeAddressFixed(substr($subData, $offset, 8));
			$offset += 8;
		}

		return array(
			'size' => 2 + 8 * $nm,
			'cellRangeAddresses' => $cellRangeAddresses,
		);
	}
262558
protected static function filterValues(array $data)
    {
        $returnValue = array();
        foreach ($data as $d) {
            if ($d !== null) {
                $returnValue[] = $d->getValue();
            } else {
                $returnValue[] = $d;
            }
        }

        return $returnValue;
    }
391893
public function readFromArray(array $data) : array
    {
        foreach($data as $key => $value)
        {
            if (is_string($value)){
                $value = $this->macro_processor->process($value);
                $data[$key] = $value;
            }
            else if(is_array($value)){
                $data[$key] = $this->readFromArray($value);
            }
        }
        return $data;
    }
872221
protected function _getData(array $data): array
    {
        // Stringify empty values
        if (!empty($data)) {
            foreach ($data as $fieldName => $value) {
                $data[$fieldName] = $this->_stringifyEmptyValue($value);
            }
        }

        return $data;
    }
615452
private function _readBIFF8CellRangeAddressFixed($subData)
	{
		// offset: 0; size: 2; index to first row
		$fr = self::_GetInt2d($subData, 0) + 1;

		// offset: 2; size: 2; index to last row
		$lr = self::_GetInt2d($subData, 2) + 1;

		// offset: 4; size: 2; index to first column
		$fc = self::_GetInt2d($subData, 4);

		// offset: 6; size: 2; index to last column
		$lc = self::_GetInt2d($subData, 6);

		// check values
		if ($fr > $lr || $fc > $lc) {
			throw new PHPExcel_Reader_Exception('Not a cell range address');
		}

		// column index to letter
		$fc = PHPExcel_Cell::stringFromColumnIndex($fc);
		$lc = PHPExcel_Cell::stringFromColumnIndex($lc);

		if ($fr == $lr and $fc == $lc) {
			return "$fc$fr";
		}
		return "$fc$fr:$lc$lr";
	}
1160811
public static function soa(string $rdata): array
    {
        $offset = 0;

        return array_merge(
            [
                'mname' => Decoder::decodeDomainName($rdata, $offset),
                'rname' => Decoder::decodeDomainName($rdata, $offset),
            ],
            unpack('Nserial/Nrefresh/Nretry/Nexpire/Nminimum', substr($rdata, $offset))
        );
    }
250310
public function getPrimaryValues(array $data) : array
    {
        $return = [];
        /** @var Column $column */
        foreach ($this->thead->elements as $column) {
            if ($column instanceof Column && $column->isPrimary()) {
                $return[$column->getId()] = $data[$column->getId()] ?? null;
            }
        }

        return $return;
    }
113417
private function readByteStringShort($subData)
    {
        // offset: 0; size: 1; length of the string (character count)
        $ln = ord($subData[0]);

        // offset: 1: size: var; character array (8-bit characters)
        $value = $this->decodeCodepage(substr($subData, 1, $ln));

        return array(
            'value' => $value,
            'size' => 1 + $ln, // size in bytes of data structure
        );
    }
605605
public function normalizeData(array $data): array
    {
        $normalizedMetaData = [];
        foreach ($data as $key => $value) {
            $normalizedKey = strtolower($key);
            $normalizedValue = $this->normalizeValues($normalizedKey, $value);
            $normalizedMetaData[$normalizedKey] = $normalizedValue;
        }

        return $normalizedMetaData;
    }
377487
private function readBIFF5CellRangeAddressFixed($subData)
    {
        // offset: 0; size: 2; index to first row
        $fr = self::getInt2d($subData, 0) + 1;

        // offset: 2; size: 2; index to last row
        $lr = self::getInt2d($subData, 2) + 1;

        // offset: 4; size: 1; index to first column
        $fc = ord($subData{4});

        // offset: 5; size: 1; index to last column
        $lc = ord($subData{5});

        // check values
        if ($fr > $lr || $fc > $lc) {
            throw new PHPExcel_Reader_Exception('Not a cell range address');
        }

        // column index to letter
        $fc = PHPExcel_Cell::stringFromColumnIndex($fc);
        $lc = PHPExcel_Cell::stringFromColumnIndex($lc);

        if ($fr == $lr and $fc == $lc) {
            return "$fc$fr";
        }
        return "$fc$fr:$lc$lr";
    }
550984
public static function FromArray( array $objectData, bool $fixed = false ) : Size
   {

      $w = 0;
      if ( isset( $objectData[ 'width' ] ) )
      {
         $w = \intval( $objectData[ 'width' ] );
      }
      else if ( isset( $objectData[ 'Width' ] ) )
      {
         $w = \intval( $objectData[ 'Width' ] );
      }
      else if ( isset( $objectData[ 0 ] ) )
      {
         $w = \intval( $objectData[ 0 ] );
      }

      $h = 0;
      if ( isset( $objectData[ 'height' ] ) )
      {
         $h = \intval( $objectData[ 'height' ] );
      }
      else if ( isset( $objectData[ 'Height' ] ) )
      {
         $h = \intval( $objectData[ 'Height' ] );
      }
      else if ( isset( $objectData[ 1 ] ) )
      {
         $h = \intval( $objectData[ 1 ] );
      }

      if ( isset( $objectData[ 'fixed' ] ) )
      {
         $fixed = (bool) \intval( $objectData[ 'fixed' ] );
      }

      return new Size( $w, $h, $fixed );

   }
784066
protected function decodeData(array $data)
    {
        $result = [];

        if (is_array($data[0])) {
            foreach ($data[0] as $k => $v) {
                $result[$k] = $this->decodeData([$data[0][$k], $data[1][$k], $data[2][$k], $data[3][$k], $data[4][$k]]);
            }

            return $result;
        }

        return [
            'name' => $data[0],
            'type' => $data[1],
            'tmp_name' => $data[2],
            'error' => $data[3],
            'size' => $data[4],
        ];
    }
224771
protected static function normalizeRelationshipData(array &$value, array $arrayData)
    {
        $relationships = [];
        foreach ($arrayData[JsonApiTransformer::RELATIONSHIPS_KEY] as $attribute => $attributeValue) {
            //if $value[data] is not found, get next level where [data] should exist.
            if (!array_key_exists(JsonApiTransformer::DATA_KEY, $attributeValue)) {
                array_shift($attributeValue);
            }


            if (count($attributeValue[JsonApiTransformer::DATA_KEY]) > 0) {
                $relationships[$attribute] = $attributeValue;
            }
        }

        return $relationships;
    }
337342
public function getCalculationFields(array $fieldData)
    {
        $output = array();

        // Perform automatic calculation
        if (isset($this->_fieldDefinition['gtf_calculate_using'])) {
            $sources = explode(self::FIELD_SEP, $this->_fieldDefinition['gtf_calculate_using']);

            foreach ($sources as $source) {
                if (isset($fieldData[$source]) && $fieldData[$source]) {
                    $output[$source] = $fieldData[$source];
                } else {
                    $output[$source] = null;
                }
            }
        }
        return array_reverse($output, true);
    }
30238
public function initFromArray(array $data) {

        $unknownFields = [];

        foreach ($data as $k => $v) {

            if (empty($v)) {
                continue;
            }

            $setter = 'set' . ucfirst(str_replace('_', '', ucwords($k, '_')));

            if (method_exists($this, $setter)) {
                $this->{$setter}($v);
                continue;
            }

            $unknownFields[$k] = $v;

        }

        if (!empty($unknownFields)) {
            trigger_error('Encountered unknown fields in response: ' . json_encode($unknownFields));
        }

        return $this;

    }
665844
private function _readBIFF8CellRangeAddress($subData)
	{
		// todo: if cell range is just a single cell, should this funciton
		// not just return e.g. 'A1' and not 'A1:A1' ?

		// offset: 0; size: 2; index to first row (0... 65535) (or offset (-32768... 32767))
			$fr = self::_GetInt2d($subData, 0) + 1;

		// offset: 2; size: 2; index to last row (0... 65535) (or offset (-32768... 32767))
			$lr = self::_GetInt2d($subData, 2) + 1;

		// offset: 4; size: 2; index to first column or column offset + relative flags

		// bit: 7-0; mask 0x00FF; column index
		$fc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 4));

		// bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
		if (!(0x4000 & self::_GetInt2d($subData, 4))) {
			$fc = '$' . $fc;
		}

		// bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
		if (!(0x8000 & self::_GetInt2d($subData, 4))) {
			$fr = '$' . $fr;
		}

		// offset: 6; size: 2; index to last column or column offset + relative flags

		// bit: 7-0; mask 0x00FF; column index
		$lc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 6));

		// bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
		if (!(0x4000 & self::_GetInt2d($subData, 6))) {
			$lc = '$' . $lc;
		}

		// bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
		if (!(0x8000 & self::_GetInt2d($subData, 6))) {
			$lr = '$' . $lr;
		}

		return "$fc$fr:$lc$lr";
	}