Reads a cell range address in BIFF5 e.g. 'A2:B6' or 'A1'
always fixed range
section 2.5.14

@param string $subData
@return string
@throws PHPExcel_Reader_Exception
559039
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";
	}
780600
private function extractScriptDataValue_UI16(&$data)
    {
        $result = $this->parseUI16(substr($data, 0, 2));
        $data = substr($data, 2);

        return $result;
    }
1304729
private static function rle(&$stringData)
        {
            $outArray = array();
            $symbolArray = str_split($stringData);
            $last = '';
            $run = 1;
            
            while (count($symbolArray) > 0) {
                $symbol = array_shift($symbolArray);
                
                if ($symbol != $last) {
                    if ($run > 1) 
                        $outArray[] = $run;
                    
                    if ($last != '')
                        $outArray[] = $last;
                        
                    $run = 1;
                    $last = $symbol;
                } else {
                    $run++;
                }
            }
            
            if ($run > 1) 
                $outArray[] = $run;
                
            $outArray[] = $last;
            
            $stringData = $outArray;
        }
957298
public static function a(string $rdata): string
    {
        if (!filter_var($rdata, FILTER_VALIDATE_IP)) {
            throw new \InvalidArgumentException(sprintf('The IP address "%s" is invalid.', $rdata));
        }

        return inet_pton($rdata);
    }
320762
public function setRange($pRange = '')
    {
        // Uppercase coordinate
        $cellAddress = explode('!', strtoupper($pRange));
        if (count($cellAddress) > 1) {
            list($worksheet, $pRange) = $cellAddress;
        }

        if (strpos($pRange, ':') !== false) {
            $this->range = $pRange;
        } elseif (empty($pRange)) {
            $this->range = '';
        } else {
            throw new PHPExcel_Exception('Autofilter must be set on a range of cells.');
        }

        if (empty($pRange)) {
            //    Discard all column rules
            $this->columns = array();
        } else {
            //    Discard any column rules that are no longer valid within this range
            list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range);
            foreach ($this->columns as $key => $value) {
                $colIndex = PHPExcel_Cell::columnIndexFromString($key);
                if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) {
                    unset($this->columns[$key]);
                }
            }
        }

        return $this;
    }
826644
private function decode($encData)
    {
        $params = explode(self::ENC_SEPARATOR, $encData);
        if (count($params) < self::ENC_SECTIONS) {
            return false;
        }

        $startIndex = intval(base64_decode($params[self::ENC_STARTINDEX_INDEX]));
        $dataLength = intval(base64_decode($params[self::ENC_DATALENGTH_INDEX]));

        if (empty($startIndex) || empty($dataLength)) {
            return false;
        }

        $data = $params[self::ENC_DATA_INDEX];

        return base64_decode(substr($data, $startIndex, $dataLength));
    }
649787
private static function _readUnicodeStringLong($subData)
	{
		$value = '';

		// offset: 0: size: 2; length of the string (character count)
		$characterCount = self::_GetInt2d($subData, 0);

		$string = self::_readUnicodeString(substr($subData, 2), $characterCount);

		// add 2 for the string length
		$string['size'] += 2;

		return $string;
	}
33520
private static function getExcel(array $data)
    {
        $excel = new \PHPExcel();
        $row = 1;
        $col = 0;
        $sheet = $excel->getActiveSheet();
        foreach ($data as $d) {
            if (is_array($d)) {
                foreach ($d as $dd) {
                    $sheet->getCellByColumnAndRow($col, $row)->setValue((string)$dd);
                    $col++;
                }
                $col = 0;
            } else {
                $sheet->getCellByColumnAndRow($col, $row)->setValue((string)$d);
            }
            $row++;
        }
        return $excel;
    }
1078560
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";
    }
415310
public function getRange(Range $range)
    {
        $content = $this->getContent();
        $start = $range->start->toOffset($content);
        $length = $range->end->toOffset($content) - $start;
        return substr($content, $start, $length);
    }
1086991
public function format($data = null) {
        $validType = $this->checkType($data);
        $validRange = $this->checkRange($data);
        $validValue = $this->checkValueSet($data);

        if ($validType && $validRange && $validValue) {
            return $data;
        } else if ($validType && (!$validRange || !$validValue)) {

            if ($this->getNull()) {
                return null;
            } else if (!$validValue) {
                $valueSet = $this->getValueSet();
                return $valueSet[0];
            } else {
                throw new \Exception("Unable to format " . $this->getType() . " to range" . $this->getRange());
            }

        } else if (!$validType) {
            if (!settype($data, $this->getType())) {
                if ($this->getType() === "integer" && (float)$data !== (int)$data) {
                    $data = (float)$data;
                } else {
                    $data = (int)$data;
                }
            }
            $validRange = $this->checkRange($data);
            $validValue = $this->checkValueSet($data);

            if ($validRange && $validValue) {
                return $data;
            } else if ($this->getNull()) {
                return null;
            } else if (!$validValue) {
                $valueSet = $this->getValueSet();
                return $valueSet[0];
            } else {
                throw new \Exception("Unable to format " . $this->getType() . " to range" . $this->getRange());
            }
        }
    }
537925
private function readSp()
    {
        // offset: 0; size: 2; recVer and recInstance

        // bit: 4-15; mask: 0xFFF0; recInstance
        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;

        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);

        // move stream pointer to next record
        $this->pos += 8 + $length;
    }
1075948
public static function getParallelLimit($tokenData)
    {
        if (!empty($tokenData['owner']['limits'][self::PARALLEL_LIMIT_NAME]['value'])) {
            return (int) $tokenData['owner']['limits'][self::PARALLEL_LIMIT_NAME]['value'];
        }

        return null;
    }
980522
public function getCell($pCoordinate = 'A1')
    {
        // Check cell collection
        if ($this->_cellCollection->isDataSet($pCoordinate)) {
            return $this->_cellCollection->getCacheData($pCoordinate);
        }

        // Worksheet reference?
        if (strpos($pCoordinate, '!') !== false) {
            $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
			return $this->_parent->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]);
        }

        // Named range?
        if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
            (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
            $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
            if ($namedRange !== NULL) {
                $pCoordinate = $namedRange->getRange();
                return $namedRange->getWorksheet()->getCell($pCoordinate);
            }
        }

        // Uppercase coordinate
        $pCoordinate = strtoupper($pCoordinate);

        if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) {
            throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.');
        } elseif (strpos($pCoordinate, '$') !== false) {
            throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
        }

        // Create new cell object
        return $this->_createNewCell($pCoordinate);
    }
1239999
private function _readOfficeArtRGFOPTE($data, $n) {

		$splicedComplexData = substr($data, 6 * $n);

		// loop through property-value pairs
		for ($i = 0; $i < $n; ++$i) {
			// read 6 bytes at a time
			$fopte = substr($data, 6 * $i, 6);

			// offset: 0; size: 2; opid
			$opid = PHPExcel_Reader_Excel5::_GetInt2d($fopte, 0);

			// bit: 0-13; mask: 0x3FFF; opid.opid
			$opidOpid = (0x3FFF & $opid) >> 0;

			// bit: 14; mask 0x4000; 1 = value in op field is BLIP identifier
			$opidFBid = (0x4000 & $opid) >> 14;

			// bit: 15; mask 0x8000; 1 = this is a complex property, op field specifies size of complex data
			$opidFComplex = (0x8000 & $opid) >> 15;

			// offset: 2; size: 4; the value for this property
			$op = PHPExcel_Reader_Excel5::_GetInt4d($fopte, 2);

			if ($opidFComplex) {
				$complexData = substr($splicedComplexData, 0, $op);
				$splicedComplexData = substr($splicedComplexData, $op);

				// we store string value with complex data
				$value = $complexData;
			} else {
				// we store integer value
				$value = $op;
			}

			$this->_object->setOPT($opidOpid, $value);
		}
	}
1271533
private function getHeaders($rawData)
    {
        if (is_string($rawData)) {
            $rawData = explode("\n", $rawData);
        }

        $key = null;
        $headers = array();
        foreach ($rawData as $line) {
            $line = trim($line);
            if (preg_match("/^([a-zA-Z0-9-]+):/i", $line, $matches)) {
                $key = strtolower($matches[1]);
                if (isset($headers[$key])) {
                    if (!is_array($headers[$key])) {
                        $headers[$key] = array($headers[$key]);
                    }

                    $headers[$key][] = trim(str_replace($matches[0], '', $line));
                    continue;
                }

                $headers[$key] = trim(str_replace($matches[0], '', $line));
                continue;
            }

            if (!is_null($key) && isset($headers[$key])) {
                if (is_array($headers[$key])) {
                    $headers[$key][count($headers[$key])-1] .= ' '.$line;
                    continue;
                }

                $headers[$key] .= ' '.$line;
            }
        }

        return $headers;
    }
1246993
private function readByteStringLong($subData)
    {
        // offset: 0; size: 2; length of the string (character count)
        $ln = self::getInt2d($subData, 0);

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

        //return $string;
        return array(
            'value' => $value,
            'size' => 2 + $ln, // size in bytes of data structure
        );
    }