#401 : Fix for PHPCS

This commit is contained in:
Progi1984 2016-05-13 22:06:18 +02:00
parent 3bb541c610
commit 2fed2de62d
34 changed files with 113 additions and 155 deletions

View File

@ -2445,7 +2445,6 @@ class Calculation
foreach (array_keys(self::$localeBoolean) as $excelBoolean) { foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui'; self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
} }
} }
if (self::$functionReplaceToLocale === null) { if (self::$functionReplaceToLocale === null) {
@ -3183,7 +3182,6 @@ class Calculation
++$index; // Drop the redundant plus symbol ++$index; // Drop the redundant plus symbol
} elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal
return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression
} elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? } elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
//echo 'Element with value '.$opCharacter.' is an Operator', PHP_EOL; //echo 'Element with value '.$opCharacter.' is an Operator', PHP_EOL;
while ($stack->count() > 0 && while ($stack->count() > 0 &&
@ -3195,7 +3193,6 @@ class Calculation
$stack->push('Binary Operator', $opCharacter); // Finally put our current operator onto the stack $stack->push('Binary Operator', $opCharacter); // Finally put our current operator onto the stack
++$index; ++$index;
$expectingOperator = false; $expectingOperator = false;
} elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis?
//echo 'Element is a Closing bracket', PHP_EOL; //echo 'Element is a Closing bracket', PHP_EOL;
$expectingOperand = false; $expectingOperand = false;
@ -3278,7 +3275,6 @@ class Calculation
} }
} }
++$index; ++$index;
} elseif ($opCharacter == ',') { // Is this the separator for function arguments? } elseif ($opCharacter == ',') { // Is this the separator for function arguments?
//echo 'Element is a Function argument separator', PHP_EOL; //echo 'Element is a Function argument separator', PHP_EOL;
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last (
@ -3304,12 +3300,10 @@ class Calculation
$expectingOperator = false; $expectingOperator = false;
$expectingOperand = true; $expectingOperand = true;
++$index; ++$index;
} elseif ($opCharacter == '(' && !$expectingOperator) { } elseif ($opCharacter == '(' && !$expectingOperator) {
// echo 'Element is an Opening Bracket<br />'; // echo 'Element is an Opening Bracket<br />';
$stack->push('Brace', '('); $stack->push('Brace', '(');
++$index; ++$index;
} elseif ($isOperandOrFunction && !$expectingOperator) { // do we now have a function/variable/number? } elseif ($isOperandOrFunction && !$expectingOperator) { // do we now have a function/variable/number?
$expectingOperator = true; $expectingOperator = true;
$expectingOperand = false; $expectingOperand = false;
@ -3422,7 +3416,6 @@ class Calculation
$output[] = $details; $output[] = $details;
} }
$index += $length; $index += $length;
} elseif ($opCharacter == '$') { // absolute row or column range } elseif ($opCharacter == '$') { // absolute row or column range
++$index; ++$index;
} elseif ($opCharacter == ')') { // miscellaneous error checking } elseif ($opCharacter == ')') { // miscellaneous error checking
@ -3692,7 +3685,6 @@ class Calculation
} else { } else {
$this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack); $this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack);
} }
} elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) { } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) {
$cellRef = null; $cellRef = null;
// echo 'Element '.$token.' is a Cell reference<br />'; // echo 'Element '.$token.' is a Cell reference<br />';
@ -3875,7 +3867,6 @@ class Calculation
} }
$stack->push('Value', self::wrapResult($result)); $stack->push('Value', self::wrapResult($result));
} }
} else { } else {
// if the token is a number, boolean, string or an Excel error, push it onto the stack // if the token is a number, boolean, string or an Excel error, push it onto the stack
if (isset(self::$excelConstants[strtoupper($token)])) { if (isset(self::$excelConstants[strtoupper($token)])) {

View File

@ -294,9 +294,9 @@ class DateTime
$day = \PHPExcel\Shared\Date::dayStringToNumber($day); $day = \PHPExcel\Shared\Date::dayStringToNumber($day);
} }
$year = ($year !== null) ? \PHPExcel\Shared\String::testStringAsNumeric($year) : 0; $year = ($year !== null) ? \PHPExcel\Shared\StringHelper::testStringAsNumeric($year) : 0;
$month = ($month !== null) ? \PHPExcel\Shared\String::testStringAsNumeric($month) : 0; $month = ($month !== null) ? \PHPExcel\Shared\StringHelper::testStringAsNumeric($month) : 0;
$day = ($day !== null) ? \PHPExcel\Shared\String::testStringAsNumeric($day) : 0; $day = ($day !== null) ? \PHPExcel\Shared\StringHelper::testStringAsNumeric($day) : 0;
if ((!is_numeric($year)) || if ((!is_numeric($year)) ||
(!is_numeric($month)) || (!is_numeric($month)) ||
(!is_numeric($day))) { (!is_numeric($day))) {

View File

@ -238,8 +238,8 @@ class TextData
$haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE(); $haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if (($offset > 0) && (\PHPExcel\Shared\String::CountCharacters($haystack) > $offset)) { if (($offset > 0) && (\PHPExcel\Shared\StringHelper::CountCharacters($haystack) > $offset)) {
if (\PHPExcel\Shared\String::CountCharacters($needle) == 0) { if (\PHPExcel\Shared\StringHelper::CountCharacters($needle) == 0) {
return $offset; return $offset;
} }
if (function_exists('mb_strpos')) { if (function_exists('mb_strpos')) {
@ -275,8 +275,8 @@ class TextData
$haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE(); $haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
if (($offset > 0) && (\PHPExcel\Shared\String::CountCharacters($haystack) > $offset)) { if (($offset > 0) && (\PHPExcel\Shared\StringHelper::CountCharacters($haystack) > $offset)) {
if (\PHPExcel\Shared\String::CountCharacters($needle) == 0) { if (\PHPExcel\Shared\StringHelper::CountCharacters($needle) == 0) {
return $offset; return $offset;
} }
if (function_exists('mb_stripos')) { if (function_exists('mb_stripos')) {
@ -449,7 +449,7 @@ class TextData
$mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE(); $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
return \PHPExcel\Shared\String::StrToLower($mixedCaseString); return \PHPExcel\Shared\StringHelper::StrToLower($mixedCaseString);
} }
@ -469,7 +469,7 @@ class TextData
$mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE(); $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
return \PHPExcel\Shared\String::StrToUpper($mixedCaseString); return \PHPExcel\Shared\StringHelper::StrToUpper($mixedCaseString);
} }
@ -489,7 +489,7 @@ class TextData
$mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE(); $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
} }
return \PHPExcel\Shared\String::StrToTitle($mixedCaseString); return \PHPExcel\Shared\StringHelper::StrToTitle($mixedCaseString);
} }
@ -612,9 +612,9 @@ class TextData
if (!is_numeric($value)) { if (!is_numeric($value)) {
$numberValue = str_replace( $numberValue = str_replace(
\PHPExcel\Shared\String::getThousandsSeparator(), \PHPExcel\Shared\StringHelper::getThousandsSeparator(),
'', '',
trim($value, " \t\n\r\0\x0B" . \PHPExcel\Shared\String::getCurrencyCode()) trim($value, " \t\n\r\0\x0B" . \PHPExcel\Shared\StringHelper::getCurrencyCode())
); );
if (is_numeric($numberValue)) { if (is_numeric($numberValue)) {
return (float) $numberValue; return (float) $numberValue;

View File

@ -40,7 +40,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder
{ {
// sanitize UTF-8 strings // sanitize UTF-8 strings
if (is_string($value)) { if (is_string($value)) {
$value = \PHPExcel\Shared\String::SanitizeUTF8($value); $value = \PHPExcel\Shared\StringHelper::SanitizeUTF8($value);
} }
// Find out data type // Find out data type
@ -100,9 +100,9 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder
} }
// Check for currency // Check for currency
$currencyCode = \PHPExcel\Shared\String::getCurrencyCode(); $currencyCode = \PHPExcel\Shared\StringHelper::getCurrencyCode();
$decimalSeparator = \PHPExcel\Shared\String::getDecimalSeparator(); $decimalSeparator = \PHPExcel\Shared\StringHelper::getDecimalSeparator();
$thousandsSeparator = \PHPExcel\Shared\String::getThousandsSeparator(); $thousandsSeparator = \PHPExcel\Shared\StringHelper::getThousandsSeparator();
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) { if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
// Convert value to number // Convert value to number
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value)); $value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
@ -165,7 +165,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder
// Check for newline character "\n" // Check for newline character "\n"
if (strpos($value, "\n") !== false) { if (strpos($value, "\n") !== false) {
$value = \PHPExcel\Shared\String::SanitizeUTF8($value); $value = \PHPExcel\Shared\StringHelper::SanitizeUTF8($value);
$cell->setValueExplicit($value, DataType::TYPE_STRING); $cell->setValueExplicit($value, DataType::TYPE_STRING);
// Set style // Set style
$cell->getWorksheet()->getStyle($cell->getCoordinate()) $cell->getWorksheet()->getStyle($cell->getCoordinate())

View File

@ -90,7 +90,7 @@ class DataType
} }
// string must never be longer than 32,767 characters, truncate if necessary // string must never be longer than 32,767 characters, truncate if necessary
$pValue = \PHPExcel\Shared\String::Substring($pValue, 0, 32767); $pValue = \PHPExcel\Shared\StringHelper::Substring($pValue, 0, 32767);
// we require that newline is represented as "\n" in core, not as "\r\n" or "\r" // we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
$pValue = str_replace(array("\r\n", "\r"), "\n", $pValue); $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);

View File

@ -40,7 +40,7 @@ class DefaultValueBinder implements IValueBinder
{ {
// sanitize UTF-8 strings // sanitize UTF-8 strings
if (is_string($value)) { if (is_string($value)) {
$value = \PHPExcel\Shared\String::SanitizeUTF8($value); $value = \PHPExcel\Shared\StringHelper::SanitizeUTF8($value);
} elseif (is_object($value)) { } elseif (is_object($value)) {
// Handle any objects that might be injected // Handle any objects that might be injected
if ($value instanceof \DateTime) { if ($value instanceof \DateTime) {

View File

@ -281,7 +281,7 @@ class CSV extends BaseReader implements IReader
// Convert encoding if necessary // Convert encoding if necessary
if ($this->inputEncoding !== 'UTF-8') { if ($this->inputEncoding !== 'UTF-8') {
$rowDatum = \PHPExcel\Shared\String::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding); $rowDatum = \PHPExcel\Shared\StringHelper::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
} }
// Set cell value // Set cell value

View File

@ -789,7 +789,7 @@ class Excel2003XML extends BaseReader implements IReader
protected static function convertStringEncoding($string, $charset) protected static function convertStringEncoding($string, $charset)
{ {
if ($charset != 'UTF-8') { if ($charset != 'UTF-8') {
return \PHPExcel\Shared\String::ConvertEncoding($string, 'UTF-8', $charset); return \PHPExcel\Shared\StringHelper::ConvertEncoding($string, 'UTF-8', $charset);
} }
return $string; return $string;
} }

View File

@ -93,7 +93,6 @@ class Excel2007 extends BaseReader implements IReader
$xl = true; $xl = true;
} }
break; break;
} }
} }
} }
@ -526,7 +525,7 @@ class Excel2007 extends BaseReader implements IReader
if (isset($xmlStrings) && isset($xmlStrings->si)) { if (isset($xmlStrings) && isset($xmlStrings->si)) {
foreach ($xmlStrings->si as $val) { foreach ($xmlStrings->si as $val) {
if (isset($val->t)) { if (isset($val->t)) {
$sharedStrings[] = \PHPExcel\Shared\String::ControlCharacterOOXML2PHP((string) $val->t); $sharedStrings[] = \PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $val->t);
} elseif (isset($val->r)) { } elseif (isset($val->r)) {
$sharedStrings[] = $this->parseRichText($val); $sharedStrings[] = $this->parseRichText($val);
} }
@ -1533,7 +1532,6 @@ class Excel2007 extends BaseReader implements IReader
} }
} }
} }
} }
// TODO: Autoshapes from twoCellAnchors! // TODO: Autoshapes from twoCellAnchors!
@ -2073,15 +2071,14 @@ class Excel2007 extends BaseReader implements IReader
$value = new \PHPExcel\RichText(); $value = new \PHPExcel\RichText();
if (isset($is->t)) { if (isset($is->t)) {
$value->createText(\PHPExcel\Shared\String::ControlCharacterOOXML2PHP((string) $is->t)); $value->createText(\PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $is->t));
} else { } else {
if (is_object($is->r)) { if (is_object($is->r)) {
foreach ($is->r as $run) { foreach ($is->r as $run) {
if (!isset($run->rPr)) { if (!isset($run->rPr)) {
$objText = $value->createText(\PHPExcel\Shared\String::ControlCharacterOOXML2PHP((string) $run->t)); $objText = $value->createText(\PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $run->t));
} else { } else {
$objText = $value->createTextRun(\PHPExcel\Shared\String::ControlCharacterOOXML2PHP((string) $run->t)); $objText = $value->createTextRun(\PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $run->t));
if (isset($run->rPr->rFont["val"])) { if (isset($run->rPr->rFont["val"])) {
$objText->getFont()->setName((string) $run->rPr->rFont["val"]); $objText->getFont()->setName((string) $run->rPr->rFont["val"]);

View File

@ -981,7 +981,6 @@ class Excel5 extends BaseReader implements IReader
$this->readDefault(); $this->readDefault();
break; break;
} }
} }
// treat MSODRAWING records, sheet-level Escher // treat MSODRAWING records, sheet-level Escher
@ -1344,7 +1343,7 @@ class Excel5 extends BaseReader implements IReader
case 0x1E: // null-terminated string prepended by dword string length case 0x1E: // null-terminated string prepended by dword string length
$byteLength = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset); $byteLength = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset);
$value = substr($this->summaryInformation, $secOffset + 8 + $offset, $byteLength); $value = substr($this->summaryInformation, $secOffset + 8 + $offset, $byteLength);
$value = \PHPExcel\Shared\String::ConvertEncoding($value, 'UTF-8', $codePage); $value = \PHPExcel\Shared\StringHelper::ConvertEncoding($value, 'UTF-8', $codePage);
$value = rtrim($value); $value = rtrim($value);
break; break;
case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
@ -1490,7 +1489,7 @@ class Excel5 extends BaseReader implements IReader
case 0x1E: // null-terminated string prepended by dword string length case 0x1E: // null-terminated string prepended by dword string length
$byteLength = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset); $byteLength = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset);
$value = substr($this->documentSummaryInformation, $secOffset + 8 + $offset, $byteLength); $value = substr($this->documentSummaryInformation, $secOffset + 8 + $offset, $byteLength);
$value = \PHPExcel\Shared\String::ConvertEncoding($value, 'UTF-8', $codePage); $value = \PHPExcel\Shared\StringHelper::ConvertEncoding($value, 'UTF-8', $codePage);
$value = rtrim($value); $value = rtrim($value);
break; break;
case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
@ -3689,13 +3688,13 @@ class Excel5 extends BaseReader implements IReader
$sstCount = count($this->sst[$index]['fmtRuns']); $sstCount = count($this->sst[$index]['fmtRuns']);
for ($i = 0; $i <= $sstCount; ++$i) { for ($i = 0; $i <= $sstCount; ++$i) {
if (isset($fmtRuns[$i])) { if (isset($fmtRuns[$i])) {
$text = \PHPExcel\Shared\String::Substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos); $text = \PHPExcel\Shared\StringHelper::Substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos);
$charPos = $fmtRuns[$i]['charPos']; $charPos = $fmtRuns[$i]['charPos'];
} else { } else {
$text = \PHPExcel\Shared\String::Substring($this->sst[$index]['value'], $charPos, \PHPExcel\Shared\String::CountCharacters($this->sst[$index]['value'])); $text = \PHPExcel\Shared\StringHelper::Substring($this->sst[$index]['value'], $charPos, \PHPExcel\Shared\StringHelper::CountCharacters($this->sst[$index]['value']));
} }
if (\PHPExcel\Shared\String::CountCharacters($text) > 0) { if (\PHPExcel\Shared\StringHelper::CountCharacters($text) > 0) {
if ($i == 0) { // first text run, no style if ($i == 0) { // first text run, no style
$richText->createText($text); $richText->createText($text);
} else { } else {
@ -3943,7 +3942,6 @@ class Excel5 extends BaseReader implements IReader
} }
$formula = $this->getFormulaFromStructure($formulaStructure); // get formula in human language $formula = $this->getFormulaFromStructure($formulaStructure); // get formula in human language
$cell->setValueExplicit('=' . $formula, \PHPExcel\Cell\DataType::TYPE_FORMULA); $cell->setValueExplicit('=' . $formula, \PHPExcel\Cell\DataType::TYPE_FORMULA);
} catch (\PHPExcel\Exception $e) { } catch (\PHPExcel\Exception $e) {
$cell->setValueExplicit($value, $dataType); $cell->setValueExplicit($value, $dataType);
} }
@ -7504,7 +7502,7 @@ class Excel5 extends BaseReader implements IReader
$string = self::uncompressByteString($string); $string = self::uncompressByteString($string);
} }
return \PHPExcel\Shared\String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE'); return \PHPExcel\Shared\StringHelper::ConvertEncoding($string, 'UTF-8', 'UTF-16LE');
} }
@ -7534,7 +7532,7 @@ class Excel5 extends BaseReader implements IReader
*/ */
private function decodeCodepage($string) private function decodeCodepage($string)
{ {
return \PHPExcel\Shared\String::ConvertEncoding($string, 'UTF-8', $this->codepage); return \PHPExcel\Shared\StringHelper::ConvertEncoding($string, 'UTF-8', $this->codepage);
} }

View File

@ -144,7 +144,7 @@ class SYLK extends BaseReader implements IReader
$columnIndex = 0; $columnIndex = 0;
// convert SYLK encoded $rowData to UTF-8 // convert SYLK encoded $rowData to UTF-8
$rowData = \PHPExcel\Shared\String::SYLKtoUTF8($rowData); $rowData = \PHPExcel\Shared\StringHelper::SYLKtoUTF8($rowData);
// explode each row at semicolons while taking into account that literal semicolon (;) // explode each row at semicolons while taking into account that literal semicolon (;)
// is escaped like this (;;) // is escaped like this (;;)
@ -231,7 +231,7 @@ class SYLK extends BaseReader implements IReader
// loop through one row (line) at a time in the file // loop through one row (line) at a time in the file
while (($rowData = fgets($fileHandle)) !== false) { while (($rowData = fgets($fileHandle)) !== false) {
// convert SYLK encoded $rowData to UTF-8 // convert SYLK encoded $rowData to UTF-8
$rowData = \PHPExcel\Shared\String::SYLKtoUTF8($rowData); $rowData = \PHPExcel\Shared\StringHelper::SYLKtoUTF8($rowData);
// explode each row at semicolons while taking into account that literal semicolon (;) // explode each row at semicolons while taking into account that literal semicolon (;)
// is escaped like this (;;) // is escaped like this (;;)

View File

@ -465,7 +465,6 @@ class ReferenceHelper
// Formula should be adjusted // Formula should be adjusted
$cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle())); $cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
} }
} }
} }
@ -492,7 +491,6 @@ class ReferenceHelper
} }
} }
} }
} }
} }

View File

@ -564,7 +564,6 @@ class Font
$columnWidth = $pPixels ? $columnWidth = $pPixels ?
self::$defaultColumnWidths[$font->getName()][$font->getSize()]['px'] self::$defaultColumnWidths[$font->getName()][$font->getSize()]['px']
: self::$defaultColumnWidths[$font->getName()][$font->getSize()]['width']; : self::$defaultColumnWidths[$font->getName()][$font->getSize()]['width'];
} else { } else {
// We don't have data for this particular font and size, use approximation by // We don't have data for this particular font and size, use approximation by
// extrapolating from Calibri 11 // extrapolating from Calibri 11

View File

@ -523,11 +523,11 @@ class Matrix
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value, '"'); $value = trim($value, '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
$this->A[$i][$j] += $value; $this->A[$i][$j] += $value;
@ -617,11 +617,11 @@ class Matrix
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value, '"'); $value = trim($value, '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
$this->A[$i][$j] -= $value; $this->A[$i][$j] -= $value;
@ -713,11 +713,11 @@ class Matrix
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value, '"'); $value = trim($value, '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
$this->A[$i][$j] *= $value; $this->A[$i][$j] *= $value;
@ -768,11 +768,11 @@ class Matrix
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value, '"'); $value = trim($value, '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
if ($value == 0) { if ($value == 0) {
@ -1049,11 +1049,11 @@ class Matrix
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value, '"'); $value = trim($value, '"');
$validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); $validValues &= \PHPExcel\Shared\StringHelper::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
$this->A[$i][$j] = pow($this->A[$i][$j], $value); $this->A[$i][$j] = pow($this->A[$i][$j], $value);

View File

@ -225,7 +225,6 @@ class PPS
$raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++); $raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++);
$raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++); $raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++);
$raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++); $raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
} }
return $cnt; return $cnt;
} }

View File

@ -3951,7 +3951,6 @@ class PclZip
// ----- Get UNIX date format // ----- Get UNIX date format
$p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
} else { } else {
$p_header['mtime'] = time(); $p_header['mtime'] = time();
} }
@ -4051,7 +4050,6 @@ class PclZip
// ----- Get UNIX date format // ----- Get UNIX date format
$p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
} else { } else {
$p_header['mtime'] = time(); $p_header['mtime'] = time();
} }

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Shared; namespace PHPExcel\Shared;
/** /**
* \PHPExcel\Shared\String * \PHPExcel\Shared\StringHelper
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -27,7 +27,7 @@ namespace PHPExcel\Shared;
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
class String class StringHelper
{ {
/** Constants */ /** Constants */
/** Regular Expressions */ /** Regular Expressions */

View File

@ -440,7 +440,6 @@ class Style extends Style\Supervisor implements IComparable
} }
break; break;
} }
} else { } else {
// not a supervisor, just apply the style array directly on style object // not a supervisor, just apply the style array directly on style object
if (array_key_exists('fill', $pStyles)) { if (array_key_exists('fill', $pStyles)) {

View File

@ -135,7 +135,6 @@ class Color extends Supervisor implements \PHPExcel\IComparable
case 'startColor': case 'startColor':
$key = 'startcolor'; $key = 'startcolor';
break; break;
} }
return $this->parent->getStyleArray(array($key => $array)); return $this->parent->getStyleArray(array($key => $array));
} }

View File

@ -687,7 +687,6 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable
if ($value != (int)$value) { if ($value != (int)$value) {
self::formatAsFraction($value, $format); self::formatAsFraction($value, $format);
} }
} else { } else {
// Handle the number itself // Handle the number itself
@ -711,8 +710,8 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable
$value = number_format( $value = number_format(
$value, $value,
strlen($right), strlen($right),
\PHPExcel\Shared\String::getDecimalSeparator(), \PHPExcel\Shared\StringHelper::getDecimalSeparator(),
\PHPExcel\Shared\String::getThousandsSeparator() \PHPExcel\Shared\StringHelper::getThousandsSeparator()
); );
$value = preg_replace($number_regex, $value, $format); $value = preg_replace($number_regex, $value, $format);
} else { } else {
@ -735,7 +734,7 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable
$currencyCode = $m[1]; $currencyCode = $m[1];
list($currencyCode) = explode('-', $currencyCode); list($currencyCode) = explode('-', $currencyCode);
if ($currencyCode == '') { if ($currencyCode == '') {
$currencyCode = \PHPExcel\Shared\String::getCurrencyCode(); $currencyCode = \PHPExcel\Shared\StringHelper::getCurrencyCode();
} }
$value = preg_replace('/\[\$([^\]]*)\]/u', $currencyCode, $value); $value = preg_replace('/\[\$([^\]]*)\]/u', $currencyCode, $value);
} }

View File

@ -460,7 +460,7 @@ class Chart extends WriterPart
} }
$objWriter->startElement('a:t'); $objWriter->startElement('a:t');
// $objWriter->writeAttribute('xml:space', 'preserve'); // $objWriter->writeAttribute('xml:space', 'preserve');
$objWriter->writeRawData(\PHPExcel\Shared\String::ControlCharacterPHP2OOXML($caption)); $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($caption));
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
@ -810,7 +810,7 @@ class Chart extends WriterPart
$objWriter->startElement('a:t'); $objWriter->startElement('a:t');
// $objWriter->writeAttribute('xml:space', 'preserve'); // $objWriter->writeAttribute('xml:space', 'preserve');
$objWriter->writeRawData(\PHPExcel\Shared\String::ControlCharacterPHP2OOXML($caption)); $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($caption));
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();

View File

@ -61,7 +61,6 @@ class Rels extends WriterPart
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
'docProps/custom.xml' 'docProps/custom.xml'
); );
} }
// Relationship docProps/app.xml // Relationship docProps/app.xml

View File

@ -109,7 +109,7 @@ class StringTable extends WriterPart
$objWriter->startElement('si'); $objWriter->startElement('si');
if (! $textElement instanceof \PHPExcel\RichText) { if (! $textElement instanceof \PHPExcel\RichText) {
$textToWrite = \PHPExcel\Shared\String::ControlCharacterPHP2OOXML($textElement); $textToWrite = \PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($textElement);
$objWriter->startElement('t'); $objWriter->startElement('t');
if ($textToWrite !== trim($textToWrite)) { if ($textToWrite !== trim($textToWrite)) {
$objWriter->writeAttribute('xml:space', 'preserve'); $objWriter->writeAttribute('xml:space', 'preserve');
@ -208,7 +208,7 @@ class StringTable extends WriterPart
// t // t
$objWriter->startElement($prefix.'t'); $objWriter->startElement($prefix.'t');
$objWriter->writeAttribute('xml:space', 'preserve'); $objWriter->writeAttribute('xml:space', 'preserve');
$objWriter->writeRawData(\PHPExcel\Shared\String::ControlCharacterPHP2OOXML($element->getText())); $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($element->getText()));
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
@ -283,7 +283,7 @@ class StringTable extends WriterPart
// t // t
$objWriter->startElement($prefix.'t'); $objWriter->startElement($prefix.'t');
// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains // $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains
$objWriter->writeRawData(\PHPExcel\Shared\String::ControlCharacterPHP2OOXML($element->getText())); $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($element->getText()));
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();

View File

@ -327,7 +327,7 @@ class Worksheet extends WriterPart
// Default row height // Default row height
if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) { if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
$objWriter->writeAttribute('customHeight', 'true'); $objWriter->writeAttribute('customHeight', 'true');
$objWriter->writeAttribute('defaultRowHeight', \PHPExcel\Shared\String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); $objWriter->writeAttribute('defaultRowHeight', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
} else { } else {
$objWriter->writeAttribute('defaultRowHeight', '14.4'); $objWriter->writeAttribute('defaultRowHeight', '14.4');
} }
@ -340,7 +340,7 @@ class Worksheet extends WriterPart
// Default column width // Default column width
if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) { if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
$objWriter->writeAttribute('defaultColWidth', \PHPExcel\Shared\String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth())); $objWriter->writeAttribute('defaultColWidth', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
} }
// Outline level - row // Outline level - row
@ -391,7 +391,7 @@ class Worksheet extends WriterPart
$objWriter->writeAttribute('width', '9.10'); $objWriter->writeAttribute('width', '9.10');
} else { } else {
// Width set // Width set
$objWriter->writeAttribute('width', \PHPExcel\Shared\String::FormatNumber($colDimension->getWidth())); $objWriter->writeAttribute('width', \PHPExcel\Shared\StringHelper::FormatNumber($colDimension->getWidth()));
} }
// Column visibility // Column visibility
@ -735,12 +735,12 @@ class Worksheet extends WriterPart
{ {
// pageMargins // pageMargins
$objWriter->startElement('pageMargins'); $objWriter->startElement('pageMargins');
$objWriter->writeAttribute('left', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getLeft())); $objWriter->writeAttribute('left', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getLeft()));
$objWriter->writeAttribute('right', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getRight())); $objWriter->writeAttribute('right', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getRight()));
$objWriter->writeAttribute('top', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getTop())); $objWriter->writeAttribute('top', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getTop()));
$objWriter->writeAttribute('bottom', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getBottom())); $objWriter->writeAttribute('bottom', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getBottom()));
$objWriter->writeAttribute('header', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getHeader())); $objWriter->writeAttribute('header', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getHeader()));
$objWriter->writeAttribute('footer', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getFooter())); $objWriter->writeAttribute('footer', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getFooter()));
$objWriter->endElement(); $objWriter->endElement();
} }
@ -1001,7 +1001,7 @@ class Worksheet extends WriterPart
// Row dimensions // Row dimensions
if ($rowDimension->getRowHeight() >= 0) { if ($rowDimension->getRowHeight() >= 0) {
$objWriter->writeAttribute('customHeight', '1'); $objWriter->writeAttribute('customHeight', '1');
$objWriter->writeAttribute('ht', \PHPExcel\Shared\String::FormatNumber($rowDimension->getRowHeight())); $objWriter->writeAttribute('ht', \PHPExcel\Shared\StringHelper::FormatNumber($rowDimension->getRowHeight()));
} }
// Row visibility // Row visibility
@ -1096,7 +1096,7 @@ class Worksheet extends WriterPart
switch (strtolower($mappedType)) { switch (strtolower($mappedType)) {
case 'inlinestr': // Inline string case 'inlinestr': // Inline string
if (! $cellValue instanceof \PHPExcel\RichText) { if (! $cellValue instanceof \PHPExcel\RichText) {
$objWriter->writeElement('t', \PHPExcel\Shared\String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue))); $objWriter->writeElement('t', \PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
} elseif ($cellValue instanceof \PHPExcel\RichText) { } elseif ($cellValue instanceof \PHPExcel\RichText) {
$objWriter->startElement('is'); $objWriter->startElement('is');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue); $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
@ -1131,7 +1131,7 @@ class Worksheet extends WriterPart
if ($this->getParentWriter()->getPreCalculateFormulas()) { if ($this->getParentWriter()->getPreCalculateFormulas()) {
// $calculatedValue = $pCell->getCalculatedValue(); // $calculatedValue = $pCell->getCalculatedValue();
if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') { if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') {
$objWriter->writeElement('v', \PHPExcel\Shared\String::FormatNumber($calculatedValue)); $objWriter->writeElement('v', \PHPExcel\Shared\StringHelper::FormatNumber($calculatedValue));
} else { } else {
$objWriter->writeElement('v', '0'); $objWriter->writeElement('v', '0');
} }

View File

@ -117,7 +117,7 @@ class Font
$bCharSet, $bCharSet,
$reserved $reserved
); );
$data .= \PHPExcel\Shared\String::UTF8toBIFF8UnicodeShort($this->font->getName()); $data .= \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeShort($this->font->getName());
$length = strlen($data); $length = strlen($data);
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);

View File

@ -510,48 +510,37 @@ class Parser
{ {
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) { if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
return $this->convertString($token); return $this->convertString($token);
} elseif (is_numeric($token)) { } elseif (is_numeric($token)) {
return $this->convertNumber($token); return $this->convertNumber($token);
// match references like A1 or $A$1 // match references like A1 or $A$1
} elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) { } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
return $this->convertRef2d($token); return $this->convertRef2d($token);
// match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1 // match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) { } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
return $this->convertRef3d($token); return $this->convertRef3d($token);
// match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1 // match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) { } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
return $this->convertRef3d($token); return $this->convertRef3d($token);
// match ranges like A1:B2 or $A$1:$B$2 // match ranges like A1:B2 or $A$1:$B$2
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) { } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) {
return $this->convertRange2d($token); return $this->convertRange2d($token);
// match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2 // match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) { } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
return $this->convertRange3d($token); return $this->convertRange3d($token);
// match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2 // match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) { } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
return $this->convertRange3d($token); return $this->convertRange3d($token);
// operators (including parentheses) // operators (including parentheses)
} elseif (isset($this->ptg[$token])) { } elseif (isset($this->ptg[$token])) {
return pack("C", $this->ptg[$token]); return pack("C", $this->ptg[$token]);
// match error codes // match error codes
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') { } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
return $this->convertError($token); return $this->convertError($token);
// commented so argument number can be processed correctly. See toReversePolish(). // commented so argument number can be processed correctly. See toReversePolish().
/*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token)) /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token))
{ {
return($this->convertFunction($token, $this->_func_args)); return($this->convertFunction($token, $this->_func_args));
}*/ }*/
// if it's an argument, ignore the token (the argument remains) // if it's an argument, ignore the token (the argument remains)
} elseif ($token == 'arg') { } elseif ($token == 'arg') {
return ''; return '';
@ -595,7 +584,7 @@ class Parser
throw new \PHPExcel\Writer\Exception("String is too long"); throw new \PHPExcel\Writer\Exception("String is too long");
} }
return pack('C', $this->ptg['ptgStr']) . \PHPExcel\Shared\String::UTF8toBIFF8UnicodeShort($string); return pack('C', $this->ptg['ptgStr']) . \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeShort($string);
} }
/** /**

View File

@ -480,7 +480,7 @@ class Workbook extends BIFFwriter
// add size of Workbook globals part 2, the length of the SHEET records // add size of Workbook globals part 2, the length of the SHEET records
$total_worksheets = count($this->phpExcel->getAllSheets()); $total_worksheets = count($this->phpExcel->getAllSheets());
foreach ($this->phpExcel->getWorksheetIterator() as $sheet) { foreach ($this->phpExcel->getWorksheetIterator() as $sheet) {
$offset += $boundsheet_length + strlen(\PHPExcel\Shared\String::UTF8toBIFF8UnicodeShort($sheet->getTitle())); $offset += $boundsheet_length + strlen(\PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeShort($sheet->getTitle()));
} }
// add the sizes of each of the Sheet substreams, respectively // add the sizes of each of the Sheet substreams, respectively
@ -678,7 +678,6 @@ class Workbook extends BIFFwriter
$scope = 0; $scope = 0;
} }
$chunk .= $this->writeData($this->writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false)); $chunk .= $this->writeData($this->writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
} catch (\PHPExcel\Exception $e) { } catch (\PHPExcel\Exception $e) {
// do nothing // do nothing
} }
@ -805,10 +804,10 @@ class Workbook extends BIFFwriter
$options = $isBuiltIn ? 0x20 : 0x00; $options = $isBuiltIn ? 0x20 : 0x00;
// length of the name, character count // length of the name, character count
$nlen = \PHPExcel\Shared\String::CountCharacters($name); $nlen = \PHPExcel\Shared\StringHelper::CountCharacters($name);
// name with stripped length field // name with stripped length field
$name = substr(\PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($name), 2); $name = substr(\PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($name), 2);
// size of the formula (in bytes) // size of the formula (in bytes)
$sz = strlen($formulaData); $sz = strlen($formulaData);
@ -939,7 +938,7 @@ class Workbook extends BIFFwriter
$grbit = 0x0000; // Visibility and sheet type $grbit = 0x0000; // Visibility and sheet type
$data = pack("VCC", $offset, $ss, $st); $data = pack("VCC", $offset, $ss, $st);
$data .= \PHPExcel\Shared\String::UTF8toBIFF8UnicodeShort($sheetname); $data .= \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeShort($sheetname);
$length = strlen($data); $length = strlen($data);
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
@ -1006,7 +1005,7 @@ class Workbook extends BIFFwriter
{ {
$record = 0x041E; // Record identifier $record = 0x041E; // Record identifier
$numberFormatString = \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($format); $numberFormatString = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($format);
$length = 2 + strlen($numberFormatString); // Number of bytes to follow $length = 2 + strlen($numberFormatString); // Number of bytes to follow

View File

@ -403,7 +403,7 @@ class Worksheet extends BIFFwriter
if ($cVal instanceof \PHPExcel\RichText) { if ($cVal instanceof \PHPExcel\RichText) {
// $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex); // $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex);
$arrcRun = array(); $arrcRun = array();
$str_len = \PHPExcel\Shared\String::CountCharacters($cVal->getPlainText(), 'UTF-8'); $str_len = \PHPExcel\Shared\StringHelper::CountCharacters($cVal->getPlainText(), 'UTF-8');
$str_pos = 0; $str_pos = 0;
$elements = $cVal->getRichTextElements(); $elements = $cVal->getRichTextElements();
foreach ($elements as $element) { foreach ($elements as $element) {
@ -415,7 +415,7 @@ class Worksheet extends BIFFwriter
} }
$arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx); $arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
// Position FROM // Position FROM
$str_pos += \PHPExcel\Shared\String::CountCharacters($element->getText(), 'UTF-8'); $str_pos += \PHPExcel\Shared\StringHelper::CountCharacters($element->getText(), 'UTF-8');
} }
$this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun); $this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
} else { } else {
@ -446,7 +446,6 @@ class Worksheet extends BIFFwriter
case \PHPExcel\Cell\DataType::TYPE_ERROR: case \PHPExcel\Cell\DataType::TYPE_ERROR:
$this->writeBoolErr($row, $column, self::mapErrorCode($cVal), 1, $xfIndex); $this->writeBoolErr($row, $column, self::mapErrorCode($cVal), 1, $xfIndex);
break; break;
} }
} }
} }
@ -481,11 +480,9 @@ class Worksheet extends BIFFwriter
if (strpos($url, 'sheet://') !== false) { if (strpos($url, 'sheet://') !== false) {
// internal to current workbook // internal to current workbook
$url = str_replace('sheet://', 'internal:', $url); $url = str_replace('sheet://', 'internal:', $url);
} elseif (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) { } elseif (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) {
// URL // URL
// $url = $url; // $url = $url;
} else { } else {
// external (local file) // external (local file)
$url = 'external:' . $url; $url = 'external:' . $url;
@ -662,7 +659,7 @@ class Worksheet extends BIFFwriter
{ {
$record = 0x00FD; // Record identifier $record = 0x00FD; // Record identifier
$length = 0x000A; // Bytes to follow $length = 0x000A; // Bytes to follow
$str = \PHPExcel\Shared\String::UTF8toBIFF8UnicodeShort($str, $arrcRun); $str = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeShort($str, $arrcRun);
/* check if string is already present */ /* check if string is already present */
if (!isset($this->stringTable[$str])) { if (!isset($this->stringTable[$str])) {
@ -731,7 +728,7 @@ class Worksheet extends BIFFwriter
$record = 0x00FD; // Record identifier $record = 0x00FD; // Record identifier
$length = 0x000A; // Bytes to follow $length = 0x000A; // Bytes to follow
$str = \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($str); $str = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($str);
/* check if string is already present */ /* check if string is already present */
if (!isset($this->stringTable[$str])) { if (!isset($this->stringTable[$str])) {
@ -905,13 +902,10 @@ class Worksheet extends BIFFwriter
if ($stringValue !== null) { if ($stringValue !== null) {
$this->writeStringRecord($stringValue); $this->writeStringRecord($stringValue);
} }
return 0; return 0;
} catch (\PHPExcel\Exception $e) { } catch (\PHPExcel\Exception $e) {
// do nothing // do nothing
} }
} }
/** /**
@ -922,7 +916,7 @@ class Worksheet extends BIFFwriter
private function writeStringRecord($stringValue) private function writeStringRecord($stringValue)
{ {
$record = 0x0207; // Record identifier $record = 0x0207; // Record identifier
$data = \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($stringValue); $data = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($stringValue);
$length = strlen($data); $length = strlen($data);
$header = pack('vv', $record, $length); $header = pack('vv', $record, $length);
@ -1060,10 +1054,10 @@ class Worksheet extends BIFFwriter
$url .= "\0"; $url .= "\0";
// character count // character count
$url_len = \PHPExcel\Shared\String::CountCharacters($url); $url_len = \PHPExcel\Shared\StringHelper::CountCharacters($url);
$url_len = pack('V', $url_len); $url_len = pack('V', $url_len);
$url = \PHPExcel\Shared\String::ConvertEncoding($url, 'UTF-16LE', 'UTF-8'); $url = \PHPExcel\Shared\StringHelper::ConvertEncoding($url, 'UTF-16LE', 'UTF-8');
// Calculate the data length // Calculate the data length
$length = 0x24 + strlen($url); $length = 0x24 + strlen($url);
@ -1623,7 +1617,7 @@ class Worksheet extends BIFFwriter
hexdec($password) hexdec($password)
); );
$recordData .= \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong('p' . md5($recordData)); $recordData .= \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong('p' . md5($recordData));
$length = strlen($recordData); $length = strlen($recordData);
@ -1846,7 +1840,7 @@ class Worksheet extends BIFFwriter
} }
*/ */
$recordData = \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader()); $recordData = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader());
$length = strlen($recordData); $length = strlen($recordData);
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
@ -1870,7 +1864,7 @@ class Worksheet extends BIFFwriter
} }
*/ */
$recordData = \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddFooter()); $recordData = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddFooter());
$length = strlen($recordData); $length = strlen($recordData);
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
@ -2893,22 +2887,22 @@ class Worksheet extends BIFFwriter
// prompt title // prompt title
$promptTitle = $dataValidation->getPromptTitle() !== '' ? $promptTitle = $dataValidation->getPromptTitle() !== '' ?
$dataValidation->getPromptTitle() : chr(0); $dataValidation->getPromptTitle() : chr(0);
$data .= \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($promptTitle); $data .= \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($promptTitle);
// error title // error title
$errorTitle = $dataValidation->getErrorTitle() !== '' ? $errorTitle = $dataValidation->getErrorTitle() !== '' ?
$dataValidation->getErrorTitle() : chr(0); $dataValidation->getErrorTitle() : chr(0);
$data .= \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($errorTitle); $data .= \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($errorTitle);
// prompt text // prompt text
$prompt = $dataValidation->getPrompt() !== '' ? $prompt = $dataValidation->getPrompt() !== '' ?
$dataValidation->getPrompt() : chr(0); $dataValidation->getPrompt() : chr(0);
$data .= \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($prompt); $data .= \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($prompt);
// error text // error text
$error = $dataValidation->getError() !== '' ? $error = $dataValidation->getError() !== '' ?
$dataValidation->getError() : chr(0); $dataValidation->getError() : chr(0);
$data .= \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($error); $data .= \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($error);
// formula 1 // formula 1
try { try {
@ -3184,7 +3178,7 @@ class Worksheet extends BIFFwriter
$dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
$dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); $dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
} else { } else {
$dataBlockFont = \PHPExcel\Shared\String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName()); $dataBlockFont = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName());
} }
// Font Size // Font Size
if ($conditional->getStyle()->getFont()->getSize() == null) { if ($conditional->getStyle()->getFont()->getSize() == null) {

View File

@ -4,7 +4,7 @@ namespace PHPExcel\Writer;
use PHPExcel\Calculation; use PHPExcel\Calculation;
use PHPExcel\Shared\Font; use PHPExcel\Shared\Font;
use PHPExcel\Shared\String; use PHPExcel\Shared\StringHelper;
use PHPExcel\Spreadsheet; use PHPExcel\Spreadsheet;
/** /**

View File

@ -322,9 +322,9 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
public function testTEXT() public function testTEXT()
{ {
// Enforce decimal and thousands separator values to UK/US, and currency code to USD // Enforce decimal and thousands separator values to UK/US, and currency code to USD
call_user_func(array('\PHPExcel\Shared\String', 'setDecimalSeparator'), '.'); call_user_func(array('\PHPExcel\Shared\StringHelper', 'setDecimalSeparator'), '.');
call_user_func(array('\PHPExcel\Shared\String', 'setThousandsSeparator'), ','); call_user_func(array('\PHPExcel\Shared\StringHelper', 'setThousandsSeparator'), ',');
call_user_func(array('\PHPExcel\Shared\String', 'setCurrencyCode'), '$'); call_user_func(array('\PHPExcel\Shared\StringHelper', 'setCurrencyCode'), '$');
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
@ -342,9 +342,9 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
*/ */
public function testVALUE() public function testVALUE()
{ {
call_user_func(array('\PHPExcel\Shared\String', 'setDecimalSeparator'), '.'); call_user_func(array('\PHPExcel\Shared\StringHelper', 'setDecimalSeparator'), '.');
call_user_func(array('\PHPExcel\Shared\String', 'setThousandsSeparator'), ' '); call_user_func(array('\PHPExcel\Shared\StringHelper', 'setThousandsSeparator'), ' ');
call_user_func(array('\PHPExcel\Shared\String', 'setCurrencyCode'), '$'); call_user_func(array('\PHPExcel\Shared\StringHelper', 'setCurrencyCode'), '$');
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);

View File

@ -62,9 +62,9 @@ class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase
->method('getCellCacheController') ->method('getCellCacheController')
->will($this->returnValue($cache)); ->will($this->returnValue($cache));
\PHPExcel\Shared\String::setCurrencyCode($currencyCode); \PHPExcel\Shared\StringHelper::setCurrencyCode($currencyCode);
\PHPExcel\Shared\String::setDecimalSeparator($decimalSeparator); \PHPExcel\Shared\StringHelper::setDecimalSeparator($decimalSeparator);
\PHPExcel\Shared\String::setThousandsSeparator($thousandsSeparator); \PHPExcel\Shared\StringHelper::setThousandsSeparator($thousandsSeparator);
$cell = new \PHPExcel\Cell(null, \PHPExcel\Cell\DataType::TYPE_STRING, $sheet); $cell = new \PHPExcel\Cell(null, \PHPExcel\Cell\DataType::TYPE_STRING, $sheet);

View File

@ -8,13 +8,13 @@ class StringTest extends \PHPUnit_Framework_TestCase
{ {
public function testGetIsMbStringEnabled() public function testGetIsMbStringEnabled()
{ {
$result = call_user_func(array('\PHPExcel\Shared\String','getIsMbstringEnabled')); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','getIsMbstringEnabled'));
$this->assertTrue($result); $this->assertTrue($result);
} }
public function testGetIsIconvEnabled() public function testGetIsIconvEnabled()
{ {
$result = call_user_func(array('\PHPExcel\Shared\String','getIsIconvEnabled')); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','getIsIconvEnabled'));
$this->assertTrue($result); $this->assertTrue($result);
} }
@ -23,16 +23,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
$localeconv = localeconv(); $localeconv = localeconv();
$expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ','; $expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ',';
$result = call_user_func(array('\PHPExcel\Shared\String','getDecimalSeparator')); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','getDecimalSeparator'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetDecimalSeparator() public function testSetDecimalSeparator()
{ {
$expectedResult = ','; $expectedResult = ',';
$result = call_user_func(array('\PHPExcel\Shared\String','setDecimalSeparator'), $expectedResult); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','setDecimalSeparator'), $expectedResult);
$result = call_user_func(array('\PHPExcel\Shared\String','getDecimalSeparator')); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','getDecimalSeparator'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
@ -41,16 +41,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
$localeconv = localeconv(); $localeconv = localeconv();
$expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ','; $expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ',';
$result = call_user_func(array('\PHPExcel\Shared\String','getThousandsSeparator')); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','getThousandsSeparator'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetThousandsSeparator() public function testSetThousandsSeparator()
{ {
$expectedResult = ' '; $expectedResult = ' ';
$result = call_user_func(array('\PHPExcel\Shared\String','setThousandsSeparator'), $expectedResult); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','setThousandsSeparator'), $expectedResult);
$result = call_user_func(array('\PHPExcel\Shared\String','getThousandsSeparator')); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','getThousandsSeparator'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
@ -59,16 +59,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
$localeconv = localeconv(); $localeconv = localeconv();
$expectedResult = (!empty($localeconv['currency_symbol'])) ? $localeconv['currency_symbol'] : '$'; $expectedResult = (!empty($localeconv['currency_symbol'])) ? $localeconv['currency_symbol'] : '$';
$result = call_user_func(array('\PHPExcel\Shared\String','getCurrencyCode')); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','getCurrencyCode'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetCurrencyCode() public function testSetCurrencyCode()
{ {
$expectedResult = '£'; $expectedResult = '£';
$result = call_user_func(array('\PHPExcel\Shared\String','setCurrencyCode'), $expectedResult); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','setCurrencyCode'), $expectedResult);
$result = call_user_func(array('\PHPExcel\Shared\String','getCurrencyCode')); $result = call_user_func(array('\PHPExcel\Shared\StringHelper','getCurrencyCode'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
} }

View File

@ -9,8 +9,8 @@ class NumberFormatDateTest extends \PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
\PHPExcel\Shared\String::setDecimalSeparator('.'); \PHPExcel\Shared\StringHelper::setDecimalSeparator('.');
\PHPExcel\Shared\String::setThousandsSeparator(','); \PHPExcel\Shared\StringHelper::setThousandsSeparator(',');
} }
/** /**

View File

@ -9,8 +9,8 @@ class NumberFormatTest extends \PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
\PHPExcel\Shared\String::setDecimalSeparator('.'); \PHPExcel\Shared\StringHelper::setDecimalSeparator('.');
\PHPExcel\Shared\String::setThousandsSeparator(','); \PHPExcel\Shared\StringHelper::setThousandsSeparator(',');
} }
/** /**