Merge branch 'psr2' into develop

This commit is contained in:
MarkBaker 2015-05-18 18:57:39 +01:00
commit f94dcb9852
119 changed files with 16343 additions and 15205 deletions

File diff suppressed because it is too large Load Diff

View File

@ -126,7 +126,7 @@ class PHPExcel_Calculation_Database
$k = array_search($criteriaName, $fieldNames);
if (isset($dataValues[$k])) {
$dataValue = $dataValues[$k];
$dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::_wrapResult(strtoupper($dataValue)) : $dataValue;
$dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::wrapResult(strtoupper($dataValue)) : $dataValue;
$testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList);
}
}

View File

@ -323,7 +323,7 @@ class PHPExcel_Calculation_Functions
}
if (!in_array($condition{0}, array('>', '<', '='))) {
if (!is_numeric($condition)) {
$condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition));
$condition = PHPExcel_Calculation::wrapResult(strtoupper($condition));
}
return '=' . $condition;
} else {
@ -332,7 +332,7 @@ class PHPExcel_Calculation_Functions
if (!is_numeric($operand)) {
$operand = str_replace('"', '""', $operand);
$operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand));
$operand = PHPExcel_Calculation::wrapResult(strtoupper($operand));
}
return $operator.$operand;

View File

@ -1206,7 +1206,7 @@ class PHPExcel_Calculation_MathTrig
foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) {
$arg = str_replace('"', '""', $arg);
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg));
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
}
$testCondition = '='.$arg.$condition;

View File

@ -877,7 +877,7 @@ class PHPExcel_Calculation_Statistical
$aCount = 0;
foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg));
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
}
$testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
@ -1298,7 +1298,7 @@ class PHPExcel_Calculation_Statistical
// Loop through arguments
foreach ($aArgs as $arg) {
if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg));
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
}
$testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
@ -2290,7 +2290,7 @@ class PHPExcel_Calculation_Statistical
// Loop through arguments
foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg));
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
}
$testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
@ -2449,7 +2449,7 @@ class PHPExcel_Calculation_Statistical
// Loop through arguments
foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg));
$arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
}
$testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {

View File

@ -27,7 +27,6 @@
*/
class PHPExcel_Cell
{
/**
* Default range variable constant
*
@ -227,6 +226,7 @@ class PHPExcel_Cell
break;
case PHPExcel_Cell_DataType::TYPE_STRING2:
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
// no break
case PHPExcel_Cell_DataType::TYPE_STRING:
// Synonym for string
case PHPExcel_Cell_DataType::TYPE_INLINE:

View File

@ -32,98 +32,98 @@ class PHPExcel_Chart
*
* @var string
*/
private $_name = '';
private $name = '';
/**
* Worksheet
*
* @var PHPExcel_Worksheet
*/
private $_worksheet = null;
private $worksheet;
/**
* Chart Title
*
* @var PHPExcel_Chart_Title
*/
private $_title = null;
private $title;
/**
* Chart Legend
*
* @var PHPExcel_Chart_Legend
*/
private $_legend = null;
private $legend;
/**
* X-Axis Label
*
* @var PHPExcel_Chart_Title
*/
private $_xAxisLabel = null;
private $xAxisLabel;
/**
* Y-Axis Label
*
* @var PHPExcel_Chart_Title
*/
private $_yAxisLabel = null;
private $yAxisLabel;
/**
* Chart Plot Area
*
* @var PHPExcel_Chart_PlotArea
*/
private $_plotArea = null;
private $plotArea;
/**
* Plot Visible Only
*
* @var boolean
*/
private $_plotVisibleOnly = true;
private $plotVisibleOnly = true;
/**
* Display Blanks as
*
* @var string
*/
private $_displayBlanksAs = '0';
private $displayBlanksAs = '0';
/**
* Chart Asix Y as
*
* @var PHPExcel_Chart_Axis
*/
private $_yAxis = null;
private $yAxis;
/**
* Chart Asix X as
*
* @var PHPExcel_Chart_Axis
*/
private $_xAxis = null;
private $xAxis;
/**
* Chart Major Gridlines as
*
* @var PHPExcel_Chart_GridLines
*/
private $_majorGridlines = null;
private $majorGridlines;
/**
* Chart Minor Gridlines as
*
* @var PHPExcel_Chart_GridLines
*/
private $_minorGridlines = null;
private $minorGridlines;
/**
* Top-Left Cell Position
*
* @var string
*/
private $_topLeftCellRef = 'A1';
private $topLeftCellRef = 'A1';
/**
@ -131,7 +131,7 @@ class PHPExcel_Chart
*
* @var integer
*/
private $_topLeftXOffset = 0;
private $topLeftXOffset = 0;
/**
@ -139,7 +139,7 @@ class PHPExcel_Chart
*
* @var integer
*/
private $_topLeftYOffset = 0;
private $topLeftYOffset = 0;
/**
@ -147,7 +147,7 @@ class PHPExcel_Chart
*
* @var string
*/
private $_bottomRightCellRef = 'A1';
private $bottomRightCellRef = 'A1';
/**
@ -155,7 +155,7 @@ class PHPExcel_Chart
*
* @var integer
*/
private $_bottomRightXOffset = 10;
private $bottomRightXOffset = 10;
/**
@ -163,7 +163,7 @@ class PHPExcel_Chart
*
* @var integer
*/
private $_bottomRightYOffset = 10;
private $bottomRightYOffset = 10;
/**
@ -171,18 +171,18 @@ class PHPExcel_Chart
*/
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
{
$this->_name = $name;
$this->_title = $title;
$this->_legend = $legend;
$this->_xAxisLabel = $xAxisLabel;
$this->_yAxisLabel = $yAxisLabel;
$this->_plotArea = $plotArea;
$this->_plotVisibleOnly = $plotVisibleOnly;
$this->_displayBlanksAs = $displayBlanksAs;
$this->_xAxis = $xAxis;
$this->_yAxis = $yAxis;
$this->_majorGridlines = $majorGridlines;
$this->_minorGridlines = $minorGridlines;
$this->name = $name;
$this->title = $title;
$this->legend = $legend;
$this->xAxisLabel = $xAxisLabel;
$this->yAxisLabel = $yAxisLabel;
$this->plotArea = $plotArea;
$this->plotVisibleOnly = $plotVisibleOnly;
$this->displayBlanksAs = $displayBlanksAs;
$this->xAxis = $xAxis;
$this->yAxis = $yAxis;
$this->majorGridlines = $majorGridlines;
$this->minorGridlines = $minorGridlines;
}
/**
@ -192,7 +192,7 @@ class PHPExcel_Chart
*/
public function getName()
{
return $this->_name;
return $this->name;
}
/**
@ -202,7 +202,7 @@ class PHPExcel_Chart
*/
public function getWorksheet()
{
return $this->_worksheet;
return $this->worksheet;
}
/**
@ -214,7 +214,7 @@ class PHPExcel_Chart
*/
public function setWorksheet(PHPExcel_Worksheet $pValue = null)
{
$this->_worksheet = $pValue;
$this->worksheet = $pValue;
return $this;
}
@ -226,7 +226,7 @@ class PHPExcel_Chart
*/
public function getTitle()
{
return $this->_title;
return $this->title;
}
/**
@ -237,7 +237,7 @@ class PHPExcel_Chart
*/
public function setTitle(PHPExcel_Chart_Title $title)
{
$this->_title = $title;
$this->title = $title;
return $this;
}
@ -249,7 +249,7 @@ class PHPExcel_Chart
*/
public function getLegend()
{
return $this->_legend;
return $this->legend;
}
/**
@ -260,7 +260,7 @@ class PHPExcel_Chart
*/
public function setLegend(PHPExcel_Chart_Legend $legend)
{
$this->_legend = $legend;
$this->legend = $legend;
return $this;
}
@ -272,7 +272,7 @@ class PHPExcel_Chart
*/
public function getXAxisLabel()
{
return $this->_xAxisLabel;
return $this->xAxisLabel;
}
/**
@ -283,7 +283,7 @@ class PHPExcel_Chart
*/
public function setXAxisLabel(PHPExcel_Chart_Title $label)
{
$this->_xAxisLabel = $label;
$this->xAxisLabel = $label;
return $this;
}
@ -295,7 +295,7 @@ class PHPExcel_Chart
*/
public function getYAxisLabel()
{
return $this->_yAxisLabel;
return $this->yAxisLabel;
}
/**
@ -306,7 +306,7 @@ class PHPExcel_Chart
*/
public function setYAxisLabel(PHPExcel_Chart_Title $label)
{
$this->_yAxisLabel = $label;
$this->yAxisLabel = $label;
return $this;
}
@ -318,7 +318,7 @@ class PHPExcel_Chart
*/
public function getPlotArea()
{
return $this->_plotArea;
return $this->plotArea;
}
/**
@ -328,7 +328,7 @@ class PHPExcel_Chart
*/
public function getPlotVisibleOnly()
{
return $this->_plotVisibleOnly;
return $this->plotVisibleOnly;
}
/**
@ -339,7 +339,7 @@ class PHPExcel_Chart
*/
public function setPlotVisibleOnly($plotVisibleOnly = true)
{
$this->_plotVisibleOnly = $plotVisibleOnly;
$this->plotVisibleOnly = $plotVisibleOnly;
return $this;
}
@ -351,7 +351,7 @@ class PHPExcel_Chart
*/
public function getDisplayBlanksAs()
{
return $this->_displayBlanksAs;
return $this->displayBlanksAs;
}
/**
@ -362,7 +362,7 @@ class PHPExcel_Chart
*/
public function setDisplayBlanksAs($displayBlanksAs = '0')
{
$this->_displayBlanksAs = $displayBlanksAs;
$this->displayBlanksAs = $displayBlanksAs;
}
@ -373,8 +373,8 @@ class PHPExcel_Chart
*/
public function getChartAxisY()
{
if ($this->_yAxis !== null) {
return $this->_yAxis;
if ($this->yAxis !== null) {
return $this->yAxis;
}
return new PHPExcel_Chart_Axis();
@ -387,8 +387,8 @@ class PHPExcel_Chart
*/
public function getChartAxisX()
{
if ($this->_xAxis !== null) {
return $this->_xAxis;
if ($this->xAxis !== null) {
return $this->xAxis;
}
return new PHPExcel_Chart_Axis();
@ -401,8 +401,8 @@ class PHPExcel_Chart
*/
public function getMajorGridlines()
{
if ($this->_majorGridlines !== null) {
return $this->_majorGridlines;
if ($this->majorGridlines !== null) {
return $this->majorGridlines;
}
return new PHPExcel_Chart_GridLines();
@ -415,8 +415,8 @@ class PHPExcel_Chart
*/
public function getMinorGridlines()
{
if ($this->_minorGridlines !== null) {
return $this->_minorGridlines;
if ($this->minorGridlines !== null) {
return $this->minorGridlines;
}
return new PHPExcel_Chart_GridLines();
@ -433,7 +433,7 @@ class PHPExcel_Chart
*/
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
{
$this->_topLeftCellRef = $cell;
$this->topLeftCellRef = $cell;
if (!is_null($xOffset)) {
$this->setTopLeftXOffset($xOffset);
}
@ -452,9 +452,9 @@ class PHPExcel_Chart
public function getTopLeftPosition()
{
return array(
'cell' => $this->_topLeftCellRef,
'xOffset' => $this->_topLeftXOffset,
'yOffset' => $this->_topLeftYOffset
'cell' => $this->topLeftCellRef,
'xOffset' => $this->topLeftXOffset,
'yOffset' => $this->topLeftYOffset
);
}
@ -465,7 +465,7 @@ class PHPExcel_Chart
*/
public function getTopLeftCell()
{
return $this->_topLeftCellRef;
return $this->topLeftCellRef;
}
/**
@ -476,7 +476,7 @@ class PHPExcel_Chart
*/
public function setTopLeftCell($cell)
{
$this->_topLeftCellRef = $cell;
$this->topLeftCellRef = $cell;
return $this;
}
@ -508,33 +508,33 @@ class PHPExcel_Chart
public function getTopLeftOffset()
{
return array(
'X' => $this->_topLeftXOffset,
'Y' => $this->_topLeftYOffset
'X' => $this->topLeftXOffset,
'Y' => $this->topLeftYOffset
);
}
public function setTopLeftXOffset($xOffset)
{
$this->_topLeftXOffset = $xOffset;
$this->topLeftXOffset = $xOffset;
return $this;
}
public function getTopLeftXOffset()
{
return $this->_topLeftXOffset;
return $this->topLeftXOffset;
}
public function setTopLeftYOffset($yOffset)
{
$this->_topLeftYOffset = $yOffset;
$this->topLeftYOffset = $yOffset;
return $this;
}
public function getTopLeftYOffset()
{
return $this->_topLeftYOffset;
return $this->topLeftYOffset;
}
/**
@ -547,7 +547,7 @@ class PHPExcel_Chart
*/
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
{
$this->_bottomRightCellRef = $cell;
$this->bottomRightCellRef = $cell;
if (!is_null($xOffset)) {
$this->setBottomRightXOffset($xOffset);
}
@ -566,15 +566,15 @@ class PHPExcel_Chart
public function getBottomRightPosition()
{
return array(
'cell' => $this->_bottomRightCellRef,
'xOffset' => $this->_bottomRightXOffset,
'yOffset' => $this->_bottomRightYOffset
'cell' => $this->bottomRightCellRef,
'xOffset' => $this->bottomRightXOffset,
'yOffset' => $this->bottomRightYOffset
);
}
public function setBottomRightCell($cell)
{
$this->_bottomRightCellRef = $cell;
$this->bottomRightCellRef = $cell;
return $this;
}
@ -586,7 +586,7 @@ class PHPExcel_Chart
*/
public function getBottomRightCell()
{
return $this->_bottomRightCellRef;
return $this->bottomRightCellRef;
}
/**
@ -616,40 +616,40 @@ class PHPExcel_Chart
public function getBottomRightOffset()
{
return array(
'X' => $this->_bottomRightXOffset,
'Y' => $this->_bottomRightYOffset
'X' => $this->bottomRightXOffset,
'Y' => $this->bottomRightYOffset
);
}
public function setBottomRightXOffset($xOffset)
{
$this->_bottomRightXOffset = $xOffset;
$this->bottomRightXOffset = $xOffset;
return $this;
}
public function getBottomRightXOffset()
{
return $this->_bottomRightXOffset;
return $this->bottomRightXOffset;
}
public function setBottomRightYOffset($yOffset)
{
$this->_bottomRightYOffset = $yOffset;
$this->bottomRightYOffset = $yOffset;
return $this;
}
public function getBottomRightYOffset()
{
return $this->_bottomRightYOffset;
return $this->bottomRightYOffset;
}
public function refresh()
{
if ($this->_worksheet !== null) {
$this->_plotArea->refresh($this->_worksheet);
if ($this->worksheet !== null) {
$this->plotArea->refresh($this->worksheet);
}
}

View File

@ -288,7 +288,7 @@ class PHPExcel_Chart_DataSeriesValues
{
if ($this->dataSource !== null) {
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
$newDataValues = PHPExcel_Calculation::_unwrapResult(
$newDataValues = PHPExcel_Calculation::unwrapResult(
$calcEngine->_calculateFormulaValue(
'='.$this->dataSource,
null,

View File

@ -32,63 +32,63 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @var string
*/
private $_author;
private $author;
/**
* Rich text comment
*
* @var PHPExcel_RichText
*/
private $_text;
private $text;
/**
* Comment width (CSS style, i.e. XXpx or YYpt)
*
* @var string
*/
private $_width = '96pt';
private $width = '96pt';
/**
* Left margin (CSS style, i.e. XXpx or YYpt)
*
* @var string
*/
private $_marginLeft = '59.25pt';
private $marginLeft = '59.25pt';
/**
* Top margin (CSS style, i.e. XXpx or YYpt)
*
* @var string
*/
private $_marginTop = '1.5pt';
private $marginTop = '1.5pt';
/**
* Visible
*
* @var boolean
*/
private $_visible = false;
private $visible = false;
/**
* Comment height (CSS style, i.e. XXpx or YYpt)
*
* @var string
*/
private $_height = '55.5pt';
private $height = '55.5pt';
/**
* Comment fill color
*
* @var PHPExcel_Style_Color
*/
private $_fillColor;
private $fillColor;
/**
* Alignment
*
* @var string
*/
private $_alignment;
private $alignment;
/**
* Create a new PHPExcel_Comment
@ -98,10 +98,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable
public function __construct()
{
// Initialise variables
$this->_author = 'Author';
$this->_text = new PHPExcel_RichText();
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
$this->author = 'Author';
$this->text = new PHPExcel_RichText();
$this->fillColor = new PHPExcel_Style_Color('FFFFFFE1');
$this->alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
}
/**
@ -111,7 +111,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function getAuthor()
{
return $this->_author;
return $this->author;
}
/**
@ -122,7 +122,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function setAuthor($pValue = '')
{
$this->_author = $pValue;
$this->author = $pValue;
return $this;
}
@ -133,7 +133,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function getText()
{
return $this->_text;
return $this->text;
}
/**
@ -144,7 +144,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function setText(PHPExcel_RichText $pValue)
{
$this->_text = $pValue;
$this->text = $pValue;
return $this;
}
@ -155,7 +155,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function getWidth()
{
return $this->_width;
return $this->width;
}
/**
@ -166,7 +166,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function setWidth($value = '96pt')
{
$this->_width = $value;
$this->width = $value;
return $this;
}
@ -177,7 +177,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function getHeight()
{
return $this->_height;
return $this->height;
}
/**
@ -188,7 +188,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function setHeight($value = '55.5pt')
{
$this->_height = $value;
$this->height = $value;
return $this;
}
@ -199,7 +199,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function getMarginLeft()
{
return $this->_marginLeft;
return $this->marginLeft;
}
/**
@ -210,7 +210,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function setMarginLeft($value = '59.25pt')
{
$this->_marginLeft = $value;
$this->marginLeft = $value;
return $this;
}
@ -221,7 +221,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function getMarginTop()
{
return $this->_marginTop;
return $this->marginTop;
}
/**
@ -232,7 +232,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function setMarginTop($value = '1.5pt')
{
$this->_marginTop = $value;
$this->marginTop = $value;
return $this;
}
@ -243,7 +243,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function getVisible()
{
return $this->_visible;
return $this->visible;
}
/**
@ -254,7 +254,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function setVisible($value = false)
{
$this->_visible = $value;
$this->visible = $value;
return $this;
}
@ -265,7 +265,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function getFillColor()
{
return $this->_fillColor;
return $this->fillColor;
}
/**
@ -276,7 +276,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
{
$this->_alignment = $pValue;
$this->alignment = $pValue;
return $this;
}
@ -287,7 +287,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function getAlignment()
{
return $this->_alignment;
return $this->alignment;
}
/**
@ -298,16 +298,16 @@ class PHPExcel_Comment implements PHPExcel_IComparable
public function getHashCode()
{
return md5(
$this->_author
. $this->_text->getHashCode()
. $this->_width
. $this->_height
. $this->_marginLeft
. $this->_marginTop
. ($this->_visible ? 1 : 0)
. $this->_fillColor->getHashCode()
. $this->_alignment
. __CLASS__
$this->author .
$this->text->getHashCode() .
$this->width .
$this->height .
$this->marginLeft .
$this->marginTop .
($this->visible ? 1 : 0) .
$this->fillColor->getHashCode() .
$this->alignment .
__CLASS__
);
}
@ -333,6 +333,6 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/
public function __toString()
{
return $this->_text->getPlainText();
return $this->text->getPlainText();
}
}

View File

@ -40,84 +40,84 @@ class PHPExcel_DocumentProperties
*
* @var string
*/
private $_creator = 'Unknown Creator';
private $creator = 'Unknown Creator';
/**
* LastModifiedBy
*
* @var string
*/
private $_lastModifiedBy;
private $lastModifiedBy;
/**
* Created
*
* @var datetime
*/
private $_created;
private $created;
/**
* Modified
*
* @var datetime
*/
private $_modified;
private $modified;
/**
* Title
*
* @var string
*/
private $_title = 'Untitled Spreadsheet';
private $title = 'Untitled Spreadsheet';
/**
* Description
*
* @var string
*/
private $_description = '';
private $description = '';
/**
* Subject
*
* @var string
*/
private $_subject = '';
private $subject = '';
/**
* Keywords
*
* @var string
*/
private $_keywords = '';
private $keywords = '';
/**
* Category
*
* @var string
*/
private $_category = '';
private $category = '';
/**
* Manager
*
* @var string
*/
private $_manager = '';
private $manager = '';
/**
* Company
*
* @var string
*/
private $_company = 'Microsoft Corporation';
private $company = 'Microsoft Corporation';
/**
* Custom Properties
*
* @var string
*/
private $_customProperties = array();
private $customProperties = array();
/**
@ -126,9 +126,9 @@ class PHPExcel_DocumentProperties
public function __construct()
{
// Initialise values
$this->_lastModifiedBy = $this->_creator;
$this->_created = time();
$this->_modified = time();
$this->lastModifiedBy = $this->creator;
$this->created = time();
$this->modified = time();
}
/**
@ -138,7 +138,7 @@ class PHPExcel_DocumentProperties
*/
public function getCreator()
{
return $this->_creator;
return $this->creator;
}
/**
@ -149,7 +149,7 @@ class PHPExcel_DocumentProperties
*/
public function setCreator($pValue = '')
{
$this->_creator = $pValue;
$this->creator = $pValue;
return $this;
}
@ -160,7 +160,7 @@ class PHPExcel_DocumentProperties
*/
public function getLastModifiedBy()
{
return $this->_lastModifiedBy;
return $this->lastModifiedBy;
}
/**
@ -171,7 +171,7 @@ class PHPExcel_DocumentProperties
*/
public function setLastModifiedBy($pValue = '')
{
$this->_lastModifiedBy = $pValue;
$this->lastModifiedBy = $pValue;
return $this;
}
@ -182,7 +182,7 @@ class PHPExcel_DocumentProperties
*/
public function getCreated()
{
return $this->_created;
return $this->created;
}
/**
@ -203,7 +203,7 @@ class PHPExcel_DocumentProperties
}
}
$this->_created = $pValue;
$this->created = $pValue;
return $this;
}
@ -214,7 +214,7 @@ class PHPExcel_DocumentProperties
*/
public function getModified()
{
return $this->_modified;
return $this->modified;
}
/**
@ -235,7 +235,7 @@ class PHPExcel_DocumentProperties
}
}
$this->_modified = $pValue;
$this->modified = $pValue;
return $this;
}
@ -246,7 +246,7 @@ class PHPExcel_DocumentProperties
*/
public function getTitle()
{
return $this->_title;
return $this->title;
}
/**
@ -257,7 +257,7 @@ class PHPExcel_DocumentProperties
*/
public function setTitle($pValue = '')
{
$this->_title = $pValue;
$this->title = $pValue;
return $this;
}
@ -268,7 +268,7 @@ class PHPExcel_DocumentProperties
*/
public function getDescription()
{
return $this->_description;
return $this->description;
}
/**
@ -279,7 +279,7 @@ class PHPExcel_DocumentProperties
*/
public function setDescription($pValue = '')
{
$this->_description = $pValue;
$this->description = $pValue;
return $this;
}
@ -290,7 +290,7 @@ class PHPExcel_DocumentProperties
*/
public function getSubject()
{
return $this->_subject;
return $this->subject;
}
/**
@ -301,7 +301,7 @@ class PHPExcel_DocumentProperties
*/
public function setSubject($pValue = '')
{
$this->_subject = $pValue;
$this->subject = $pValue;
return $this;
}
@ -312,7 +312,7 @@ class PHPExcel_DocumentProperties
*/
public function getKeywords()
{
return $this->_keywords;
return $this->keywords;
}
/**
@ -323,7 +323,7 @@ class PHPExcel_DocumentProperties
*/
public function setKeywords($pValue = '')
{
$this->_keywords = $pValue;
$this->keywords = $pValue;
return $this;
}
@ -334,7 +334,7 @@ class PHPExcel_DocumentProperties
*/
public function getCategory()
{
return $this->_category;
return $this->category;
}
/**
@ -345,7 +345,7 @@ class PHPExcel_DocumentProperties
*/
public function setCategory($pValue = '')
{
$this->_category = $pValue;
$this->category = $pValue;
return $this;
}
@ -356,7 +356,7 @@ class PHPExcel_DocumentProperties
*/
public function getCompany()
{
return $this->_company;
return $this->company;
}
/**
@ -367,7 +367,7 @@ class PHPExcel_DocumentProperties
*/
public function setCompany($pValue = '')
{
$this->_company = $pValue;
$this->company = $pValue;
return $this;
}
@ -378,7 +378,7 @@ class PHPExcel_DocumentProperties
*/
public function getManager()
{
return $this->_manager;
return $this->manager;
}
/**
@ -389,7 +389,7 @@ class PHPExcel_DocumentProperties
*/
public function setManager($pValue = '')
{
$this->_manager = $pValue;
$this->manager = $pValue;
return $this;
}
@ -400,7 +400,7 @@ class PHPExcel_DocumentProperties
*/
public function getCustomProperties()
{
return array_keys($this->_customProperties);
return array_keys($this->customProperties);
}
/**
@ -411,7 +411,7 @@ class PHPExcel_DocumentProperties
*/
public function isCustomPropertySet($propertyName)
{
return isset($this->_customProperties[$propertyName]);
return isset($this->customProperties[$propertyName]);
}
/**
@ -422,8 +422,8 @@ class PHPExcel_DocumentProperties
*/
public function getCustomPropertyValue($propertyName)
{
if (isset($this->_customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['value'];
if (isset($this->customProperties[$propertyName])) {
return $this->customProperties[$propertyName]['value'];
}
}
@ -436,8 +436,8 @@ class PHPExcel_DocumentProperties
*/
public function getCustomPropertyType($propertyName)
{
if (isset($this->_customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['type'];
if (isset($this->customProperties[$propertyName])) {
return $this->customProperties[$propertyName]['type'];
}
}
@ -475,7 +475,7 @@ class PHPExcel_DocumentProperties
}
}
$this->_customProperties[$propertyName] = array(
$this->customProperties[$propertyName] = array(
'value' => $propertyValue,
'type' => $propertyType
);

View File

@ -32,14 +32,14 @@ class PHPExcel_HashTable
*
* @var array
*/
public $_items = array();
protected $items = array();
/**
* HashTable key map
*
* @var array
*/
public $_keyMap = array();
protected $keyMap = array();
/**
* Create a new PHPExcel_HashTable
@ -84,9 +84,9 @@ class PHPExcel_HashTable
public function add(PHPExcel_IComparable $pSource = null)
{
$hash = $pSource->getHashCode();
if (!isset($this->_items[$hash])) {
$this->_items[$hash] = $pSource;
$this->_keyMap[count($this->_items) - 1] = $hash;
if (!isset($this->items[$hash])) {
$this->items[$hash] = $pSource;
$this->keyMap[count($this->items) - 1] = $hash;
}
}
@ -99,20 +99,20 @@ class PHPExcel_HashTable
public function remove(PHPExcel_IComparable $pSource = null)
{
$hash = $pSource->getHashCode();
if (isset($this->_items[$hash])) {
unset($this->_items[$hash]);
if (isset($this->items[$hash])) {
unset($this->items[$hash]);
$deleteKey = -1;
foreach ($this->_keyMap as $key => $value) {
foreach ($this->keyMap as $key => $value) {
if ($deleteKey >= 0) {
$this->_keyMap[$key - 1] = $value;
$this->keyMap[$key - 1] = $value;
}
if ($value == $hash) {
$deleteKey = $key;
}
}
unset($this->_keyMap[count($this->_keyMap) - 1]);
unset($this->keyMap[count($this->keyMap) - 1]);
}
}
@ -122,8 +122,8 @@ class PHPExcel_HashTable
*/
public function clear()
{
$this->_items = array();
$this->_keyMap = array();
$this->items = array();
$this->keyMap = array();
}
/**
@ -133,7 +133,7 @@ class PHPExcel_HashTable
*/
public function count()
{
return count($this->_items);
return count($this->items);
}
/**
@ -144,7 +144,7 @@ class PHPExcel_HashTable
*/
public function getIndexForHashCode($pHashCode = '')
{
return array_search($pHashCode, $this->_keyMap);
return array_search($pHashCode, $this->keyMap);
}
/**
@ -156,8 +156,8 @@ class PHPExcel_HashTable
*/
public function getByIndex($pIndex = 0)
{
if (isset($this->_keyMap[$pIndex])) {
return $this->getByHashCode($this->_keyMap[$pIndex]);
if (isset($this->keyMap[$pIndex])) {
return $this->getByHashCode($this->keyMap[$pIndex]);
}
return null;
@ -172,8 +172,8 @@ class PHPExcel_HashTable
*/
public function getByHashCode($pHashCode = '')
{
if (isset($this->_items[$pHashCode])) {
return $this->_items[$pHashCode];
if (isset($this->items[$pHashCode])) {
return $this->items[$pHashCode];
}
return null;
@ -186,7 +186,7 @@ class PHPExcel_HashTable
*/
public function toArray()
{
return $this->_items;
return $this->items;
}
/**

View File

@ -43,7 +43,7 @@ class PHPExcel_IOFactory
* @access private
* @static
*/
private static $_searchLocations = array(
private static $searchLocations = array(
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ),
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' )
);
@ -55,7 +55,7 @@ class PHPExcel_IOFactory
* @access private
* @static
*/
private static $_autoResolveClasses = array(
private static $autoResolveClasses = array(
'Excel2007',
'Excel5',
'Excel2003XML',
@ -82,7 +82,7 @@ class PHPExcel_IOFactory
*/
public static function getSearchLocations()
{
return self::$_searchLocations;
return self::$searchLocations;
}
/**
@ -96,7 +96,7 @@ class PHPExcel_IOFactory
public static function setSearchLocations($value)
{
if (is_array($value)) {
self::$_searchLocations = $value;
self::$searchLocations = $value;
} else {
throw new PHPExcel_Reader_Exception('Invalid parameter passed.');
}
@ -113,7 +113,7 @@ class PHPExcel_IOFactory
*/
public static function addSearchLocation($type = '', $location = '', $classname = '')
{
self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname );
self::$searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname );
}
/**
@ -132,7 +132,7 @@ class PHPExcel_IOFactory
$searchType = 'IWriter';
// Include class
foreach (self::$_searchLocations as $searchLocation) {
foreach (self::$searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $writerType, $searchLocation['class']);
@ -162,7 +162,7 @@ class PHPExcel_IOFactory
$searchType = 'IReader';
// Include class
foreach (self::$_searchLocations as $searchLocation) {
foreach (self::$searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $readerType, $searchLocation['class']);
@ -273,8 +273,8 @@ class PHPExcel_IOFactory
}
// If we reach here then "lucky guess" didn't give any result
// Try walking through all the options in self::$_autoResolveClasses
foreach (self::$_autoResolveClasses as $autoResolveClass) {
// Try walking through all the options in self::$autoResolveClasses
foreach (self::$autoResolveClasses as $autoResolveClass) {
// Ignore our original guess, we know that won't work
if ($autoResolveClass !== $extensionType) {
$reader = self::createReader($autoResolveClass);

View File

@ -32,35 +32,35 @@ class PHPExcel_NamedRange
*
* @var string
*/
private $_name;
private $name;
/**
* Worksheet on which the named range can be resolved
*
* @var PHPExcel_Worksheet
*/
private $_worksheet;
private $worksheet;
/**
* Range of the referenced cells
*
* @var string
*/
private $_range;
private $range;
/**
* Is the named range local? (i.e. can only be used on $this->_worksheet)
* Is the named range local? (i.e. can only be used on $this->worksheet)
*
* @var bool
*/
private $_localOnly;
private $localOnly;
/**
* Scope
*
* @var PHPExcel_Worksheet
*/
private $_scope;
private $scope;
/**
* Create a new NamedRange
@ -80,12 +80,11 @@ class PHPExcel_NamedRange
}
// Set local members
$this->_name = $pName;
$this->_worksheet = $pWorksheet;
$this->_range = $pRange;
$this->_localOnly = $pLocalOnly;
$this->_scope = ($pLocalOnly == true) ?
(($pScope == null) ? $pWorksheet : $pScope) : null;
$this->name = $pName;
$this->worksheet = $pWorksheet;
$this->range = $pRange;
$this->localOnly = $pLocalOnly;
$this->scope = ($pLocalOnly == true) ? (($pScope == null) ? $pWorksheet : $pScope) : null;
}
/**
@ -95,7 +94,7 @@ class PHPExcel_NamedRange
*/
public function getName()
{
return $this->_name;
return $this->name;
}
/**
@ -108,21 +107,21 @@ class PHPExcel_NamedRange
{
if ($value !== null) {
// Old title
$oldTitle = $this->_name;
$oldTitle = $this->name;
// Re-attach
if ($this->_worksheet !== null) {
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet);
if ($this->worksheet !== null) {
$this->worksheet->getParent()->removeNamedRange($this->name, $this->worksheet);
}
$this->_name = $value;
$this->name = $value;
if ($this->_worksheet !== null) {
$this->_worksheet->getParent()->addNamedRange($this);
if ($this->worksheet !== null) {
$this->worksheet->getParent()->addNamedRange($this);
}
// New title
$newTitle = $this->_name;
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle);
$newTitle = $this->name;
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle);
}
return $this;
}
@ -134,7 +133,7 @@ class PHPExcel_NamedRange
*/
public function getWorksheet()
{
return $this->_worksheet;
return $this->worksheet;
}
/**
@ -146,7 +145,7 @@ class PHPExcel_NamedRange
public function setWorksheet(PHPExcel_Worksheet $value = null)
{
if ($value !== null) {
$this->_worksheet = $value;
$this->worksheet = $value;
}
return $this;
}
@ -158,7 +157,7 @@ class PHPExcel_NamedRange
*/
public function getRange()
{
return $this->_range;
return $this->range;
}
/**
@ -170,7 +169,7 @@ class PHPExcel_NamedRange
public function setRange($value = null)
{
if ($value !== null) {
$this->_range = $value;
$this->range = $value;
}
return $this;
}
@ -182,7 +181,7 @@ class PHPExcel_NamedRange
*/
public function getLocalOnly()
{
return $this->_localOnly;
return $this->localOnly;
}
/**
@ -193,8 +192,8 @@ class PHPExcel_NamedRange
*/
public function setLocalOnly($value = false)
{
$this->_localOnly = $value;
$this->_scope = $value ? $this->_worksheet : null;
$this->localOnly = $value;
$this->scope = $value ? $this->worksheet : null;
return $this;
}
@ -205,7 +204,7 @@ class PHPExcel_NamedRange
*/
public function getScope()
{
return $this->_scope;
return $this->scope;
}
/**
@ -216,8 +215,8 @@ class PHPExcel_NamedRange
*/
public function setScope(PHPExcel_Worksheet $value = null)
{
$this->_scope = $value;
$this->_localOnly = ($value == null) ? false : true;
$this->scope = $value;
$this->localOnly = ($value == null) ? false : true;
return $this;
}

View File

@ -50,7 +50,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private
* @var string
*/
private $_inputEncoding = 'UTF-8';
private $inputEncoding = 'UTF-8';
/**
* Delimiter
@ -58,7 +58,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private
* @var string
*/
private $_delimiter = ',';
private $delimiter = ',';
/**
* Enclosure
@ -66,7 +66,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private
* @var string
*/
private $_enclosure = '"';
private $enclosure = '"';
/**
* Sheet index to read
@ -74,7 +74,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private
* @var int
*/
private $_sheetIndex = 0;
private $sheetIndex = 0;
/**
* Load rows contiguously
@ -82,20 +82,21 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private
* @var int
*/
private $_contiguous = false;
private $contiguous = false;
/**
* Row counter for loading rows contiguously
*
* @var int
*/
private $_contiguousRow = -1;
private $contiguousRow = -1;
/**
* Create a new PHPExcel_Reader_CSV
*/
public function __construct() {
public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
}
@ -106,7 +107,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/
protected function _isValidFormat()
{
return TRUE;
return true;
}
/**
@ -116,7 +117,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/
public function setInputEncoding($pValue = 'UTF-8')
{
$this->_inputEncoding = $pValue;
$this->inputEncoding = $pValue;
return $this;
}
@ -127,7 +128,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/
public function getInputEncoding()
{
return $this->_inputEncoding;
return $this->inputEncoding;
}
/**
@ -138,7 +139,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
{
rewind($this->_fileHandle);
switch ($this->_inputEncoding) {
switch ($this->inputEncoding) {
case 'UTF-8':
fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ?
fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0);
@ -175,7 +176,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Open file
$this->_openFile($pFilename);
if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle);
fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
}
$fileHandle = $this->_fileHandle;
@ -183,7 +184,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Skip BOM, if any
$this->_skipBOM();
$escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure );
$escapeEnclosures = array( "\\" . $this->enclosure, $this->enclosure . $this->enclosure );
$worksheetInfo = array();
$worksheetInfo[0]['worksheetName'] = 'Worksheet';
@ -193,7 +194,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
$worksheetInfo[0]['totalColumns'] = 0;
// Loop through each line of the file in turn
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
$worksheetInfo[0]['totalRows']++;
$worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1);
}
@ -239,7 +240,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Open file
$this->_openFile($pFilename);
if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle);
fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
}
$fileHandle = $this->_fileHandle;
@ -248,32 +249,32 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
$this->_skipBOM();
// Create new PHPExcel object
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
$objPHPExcel->createSheet();
}
$sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex);
$sheet = $objPHPExcel->setActiveSheetIndex($this->sheetIndex);
$escapeEnclosures = array( "\\" . $this->_enclosure,
$this->_enclosure . $this->_enclosure
$escapeEnclosures = array( "\\" . $this->enclosure,
$this->enclosure . $this->enclosure
);
// Set our starting row based on whether we're in contiguous mode or not
$currentRow = 1;
if ($this->_contiguous) {
$currentRow = ($this->_contiguousRow == -1) ? $sheet->getHighestRow(): $this->_contiguousRow;
if ($this->contiguous) {
$currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow(): $this->contiguousRow;
}
// Loop through each line of the file in turn
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
$columnLetter = 'A';
foreach ($rowData as $rowDatum) {
if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
// Unescape enclosures
$rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum);
$rowDatum = str_replace($escapeEnclosures, $this->enclosure, $rowDatum);
// Convert encoding if necessary
if ($this->_inputEncoding !== 'UTF-8') {
$rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->_inputEncoding);
if ($this->inputEncoding !== 'UTF-8') {
$rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
}
// Set cell value
@ -287,8 +288,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Close file
fclose($fileHandle);
if ($this->_contiguous) {
$this->_contiguousRow = $currentRow;
if ($this->contiguous) {
$this->contiguousRow = $currentRow;
}
ini_set('auto_detect_line_endings', $lineEnding);
@ -302,8 +303,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*
* @return string
*/
public function getDelimiter() {
return $this->_delimiter;
public function getDelimiter()
{
return $this->delimiter;
}
/**
@ -312,8 +314,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param string $pValue Delimiter, defaults to ,
* @return PHPExcel_Reader_CSV
*/
public function setDelimiter($pValue = ',') {
$this->_delimiter = $pValue;
public function setDelimiter($pValue = ',')
{
$this->delimiter = $pValue;
return $this;
}
@ -322,8 +325,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*
* @return string
*/
public function getEnclosure() {
return $this->_enclosure;
public function getEnclosure()
{
return $this->enclosure;
}
/**
@ -332,11 +336,12 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param string $pValue Enclosure, defaults to "
* @return PHPExcel_Reader_CSV
*/
public function setEnclosure($pValue = '"') {
public function setEnclosure($pValue = '"')
{
if ($pValue == '') {
$pValue = '"';
}
$this->_enclosure = $pValue;
$this->enclosure = $pValue;
return $this;
}
@ -345,8 +350,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*
* @return integer
*/
public function getSheetIndex() {
return $this->_sheetIndex;
public function getSheetIndex()
{
return $this->sheetIndex;
}
/**
@ -355,8 +361,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param integer $pValue Sheet index
* @return PHPExcel_Reader_CSV
*/
public function setSheetIndex($pValue = 0) {
$this->_sheetIndex = $pValue;
public function setSheetIndex($pValue = 0)
{
$this->sheetIndex = $pValue;
return $this;
}
@ -365,11 +372,11 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*
* @param boolean $contiguous
*/
public function setContiguous($contiguous = FALSE)
public function setContiguous($contiguous = false)
{
$this->_contiguous = (bool) $contiguous;
$this->contiguous = (bool) $contiguous;
if (!$contiguous) {
$this->_contiguousRow = -1;
$this->contiguousRow = -1;
}
return $this;
@ -380,8 +387,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*
* @return boolean
*/
public function getContiguous() {
return $this->_contiguous;
public function getContiguous()
{
return $this->contiguous;
}
}

View File

@ -52,7 +52,8 @@ class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
* @param $worksheetName Optional worksheet name
* @return boolean
*/
public function readCell($column, $row, $worksheetName = '') {
public function readCell($column, $row, $worksheetName = '')
{
return true;
}
}

View File

@ -1,6 +1,16 @@
<?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel
* PHPExcel_Reader_Excel2003XML
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Excel2003XML
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{
/**
@ -49,15 +41,14 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
*
* @var array
*/
protected $_styles = array();
protected $styles = array();
/**
* Character set used in the file
*
* @var string
*/
protected $_charSet = 'UTF-8';
protected $charSet = 'UTF-8';
/**
* Create a new PHPExcel_Reader_Excel2003XML
@ -112,9 +103,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// Retrieve charset encoding
if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) {
$this->_charSet = strtoupper($matches[1]);
$this->charSet = strtoupper($matches[1]);
}
// echo 'Character Set is ', $this->_charSet,'<br />';
// echo 'Character Set is ', $this->charSet,'<br />';
return $valid;
}
@ -144,7 +135,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$xml_ss = $xml->children($namespaces['ss']);
foreach ($xml_ss->Worksheet as $worksheet) {
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
$worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet);
$worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
}
return $worksheetNames;
@ -239,7 +230,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
return $this->loadIntoExisting($pFilename, $objPHPExcel);
}
protected static function identifyFixedStyleValue($styleList,&$styleAttributeValue)
protected static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
{
$styleAttributeValue = strtolower($styleAttributeValue);
foreach ($styleList as $style) {
@ -337,40 +328,40 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
if (isset($xml->DocumentProperties[0])) {
foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
switch ($propertyName) {
case 'Title' :
$docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet));
case 'Title':
$docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->charSet));
break;
case 'Subject' :
$docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet));
case 'Subject':
$docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->charSet));
break;
case 'Author' :
$docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet));
case 'Author':
$docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->charSet));
break;
case 'Created' :
case 'Created':
$creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate);
break;
case 'LastAuthor' :
$docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet));
case 'LastAuthor':
$docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->charSet));
break;
case 'LastSaved' :
case 'LastSaved':
$lastSaveDate = strtotime($propertyValue);
$docProps->setModified($lastSaveDate);
break;
case 'Company' :
$docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet));
case 'Company':
$docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->charSet));
break;
case 'Category' :
$docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet));
case 'Category':
$docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->charSet));
break;
case 'Manager' :
$docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet));
case 'Manager':
$docProps->setManager(self::_convertStringEncoding($propertyValue, $this->charSet));
break;
case 'Keywords' :
$docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet));
case 'Keywords':
$docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->charSet));
break;
case 'Description' :
$docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet));
case 'Description':
$docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->charSet));
break;
}
}
@ -378,26 +369,26 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
if (isset($xml->CustomDocumentProperties)) {
foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
$propertyAttributes = $propertyValue->attributes($namespaces['dt']);
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName);
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName);
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN;
switch ((string) $propertyAttributes) {
case 'string' :
case 'string':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
$propertyValue = trim($propertyValue);
break;
case 'boolean' :
case 'boolean':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
$propertyValue = (bool) $propertyValue;
break;
case 'integer' :
case 'integer':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER;
$propertyValue = intval($propertyValue);
break;
case 'float' :
case 'float':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
$propertyValue = floatval($propertyValue);
break;
case 'dateTime.tz' :
case 'dateTime.tz':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
$propertyValue = strtotime(trim($propertyValue));
break;
@ -411,125 +402,125 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$styleID = (string) $style_ss['ID'];
// echo 'Style ID = '.$styleID.'<br />';
if ($styleID == 'Default') {
$this->_styles['Default'] = array();
$this->styles['Default'] = array();
} else {
$this->_styles[$styleID] = $this->_styles['Default'];
$this->styles[$styleID] = $this->styles['Default'];
}
foreach ($style as $styleType => $styleData) {
$styleAttributes = $styleData->attributes($namespaces['ss']);
// echo $styleType.'<br />';
switch ($styleType) {
case 'Alignment' :
case 'Alignment':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = (string) $styleAttributeValue;
switch ($styleAttributeKey) {
case 'Vertical' :
case 'Vertical':
if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
$this->styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
}
break;
case 'Horizontal' :
case 'Horizontal':
if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
$this->styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
}
break;
case 'WrapText' :
$this->_styles[$styleID]['alignment']['wrap'] = true;
case 'WrapText':
$this->styles[$styleID]['alignment']['wrap'] = true;
break;
}
}
break;
case 'Borders' :
case 'Borders':
foreach ($styleData->Border as $borderStyle) {
$borderAttributes = $borderStyle->attributes($namespaces['ss']);
$thisBorder = array();
foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) {
// echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
switch ($borderStyleKey) {
case 'LineStyle' :
case 'LineStyle':
$thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
// $thisBorder['style'] = $borderStyleValue;
break;
case 'Weight' :
case 'Weight':
// $thisBorder['style'] = $borderStyleValue;
break;
case 'Position' :
case 'Position':
$borderPosition = strtolower($borderStyleValue);
break;
case 'Color' :
$borderColour = substr($borderStyleValue,1);
case 'Color':
$borderColour = substr($borderStyleValue, 1);
$thisBorder['color']['rgb'] = $borderColour;
break;
}
}
if (!empty($thisBorder)) {
if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) {
$this->_styles[$styleID]['borders'][$borderPosition] = $thisBorder;
$this->styles[$styleID]['borders'][$borderPosition] = $thisBorder;
}
}
}
break;
case 'Font' :
case 'Font':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = (string) $styleAttributeValue;
switch ($styleAttributeKey) {
case 'FontName' :
$this->_styles[$styleID]['font']['name'] = $styleAttributeValue;
case 'FontName':
$this->styles[$styleID]['font']['name'] = $styleAttributeValue;
break;
case 'Size' :
$this->_styles[$styleID]['font']['size'] = $styleAttributeValue;
case 'Size':
$this->styles[$styleID]['font']['size'] = $styleAttributeValue;
break;
case 'Color' :
$this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue,1);
case 'Color':
$this->styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1);
break;
case 'Bold' :
$this->_styles[$styleID]['font']['bold'] = true;
case 'Bold':
$this->styles[$styleID]['font']['bold'] = true;
break;
case 'Italic' :
$this->_styles[$styleID]['font']['italic'] = true;
case 'Italic':
$this->styles[$styleID]['font']['italic'] = true;
break;
case 'Underline' :
case 'Underline':
if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['font']['underline'] = $styleAttributeValue;
$this->styles[$styleID]['font']['underline'] = $styleAttributeValue;
}
break;
}
}
break;
case 'Interior' :
case 'Interior':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
switch ($styleAttributeKey) {
case 'Color' :
$this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue,1);
case 'Color':
$this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1);
break;
}
}
break;
case 'NumberFormat' :
case 'NumberFormat':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
switch ($styleAttributeValue) {
case 'Short Date' :
case 'Short Date':
$styleAttributeValue = 'dd/mm/yyyy';
break;
}
if ($styleAttributeValue > '') {
$this->_styles[$styleID]['numberformat']['code'] = $styleAttributeValue;
$this->styles[$styleID]['numberformat']['code'] = $styleAttributeValue;
}
}
break;
case 'Protection' :
case 'Protection':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
}
break;
}
}
// print_r($this->_styles[$styleID]);
// print_r($this->styles[$styleID]);
// echo '<hr />';
}
// echo '<hr />';
@ -551,11 +542,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$objPHPExcel->createSheet();
$objPHPExcel->setActiveSheetIndex($worksheetID);
if (isset($worksheet_ss['Name'])) {
$worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet);
$worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
// formula cells... during the load, all formulae should be correct, and we're simply bringing
// the worksheet name in line with the formula, not the reverse
$objPHPExcel->getActiveSheet()->setTitle($worksheetName,false);
$objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
}
$columnID = 'A';
@ -640,26 +631,26 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
const TYPE_INLINE = 'inlineStr';
const TYPE_ERROR = 'e';
*/
case 'String' :
$cellValue = self::_convertStringEncoding($cellValue, $this->_charSet);
case 'String':
$cellValue = self::_convertStringEncoding($cellValue, $this->charSet);
$type = PHPExcel_Cell_DataType::TYPE_STRING;
break;
case 'Number' :
case 'Number':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$cellValue = (float) $cellValue;
if (floor($cellValue) == $cellValue) {
$cellValue = (integer) $cellValue;
}
break;
case 'Boolean' :
case 'Boolean':
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
$cellValue = ($cellValue != 0);
break;
case 'DateTime' :
case 'DateTime':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue));
break;
case 'Error' :
case 'Error':
$type = PHPExcel_Cell_DataType::TYPE_ERROR;
break;
}
@ -669,15 +660,15 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// echo 'FORMULA<br />';
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
if (substr($cellDataFormula,0,3) == 'of:') {
$cellDataFormula = substr($cellDataFormula,3);
if (substr($cellDataFormula, 0, 3) == 'of:') {
$cellDataFormula = substr($cellDataFormula, 3);
// echo 'Before: ', $cellDataFormula,'<br />';
$temp = explode('"', $cellDataFormula);
$key = false;
foreach ($temp as &$value) {
// Only replace in alternate array entries (i.e. non-quoted blocks)
if ($key = !$key) {
$value = str_replace(array('[.','.',']'),'', $value);
$value = str_replace(array('[.', '.', ']'), '', $value);
}
}
} else {
@ -688,7 +679,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
foreach ($temp as &$value) {
// Only replace in alternate array entries (i.e. non-quoted blocks)
if ($key = !$key) {
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE);
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
// through the formula from left to right. Reversing means that we work right to left.through
// the formula
@ -703,7 +694,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
}
// Bracketed R references are relative to the current row
if ($rowReference{0} == '[') {
$rowReference = $rowID + trim($rowReference,'[]');
$rowReference = $rowID + trim($rowReference, '[]');
}
$columnReference = $cellReference[4][0];
// Empty C reference is the current column
@ -712,10 +703,10 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
}
// Bracketed C references are relative to the current column
if ($columnReference{0} == '[') {
$columnReference = $columnNumber + trim($columnReference,'[]');
$columnReference = $columnNumber + trim($columnReference, '[]');
}
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0]));
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
}
}
}
@ -749,20 +740,20 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// echo $annotation,'<br />';
$annotation = strip_tags($node);
// echo 'Annotation: ', $annotation,'<br />';
$objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::_convertStringEncoding($author , $this->_charSet))->setText($this->_parseRichText($annotation) );
$objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::_convertStringEncoding($author, $this->charSet))->setText($this->_parseRichText($annotation));
}
if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
$style = (string) $cell_ss['StyleID'];
// echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
if ((isset($this->_styles[$style])) && (!empty($this->_styles[$style]))) {
if ((isset($this->styles[$style])) && (!empty($this->styles[$style]))) {
// echo 'Cell '.$columnID.$rowID.'<br />';
// print_r($this->_styles[$style]);
// print_r($this->styles[$style]);
// echo '<br />';
if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(null);
}
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]);
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styles[$style]);
}
}
++$columnID;
@ -807,7 +798,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
{
$value = new PHPExcel_RichText();
$value->createText(self::_convertStringEncoding($is, $this->_charSet));
$value->createText(self::_convertStringEncoding($is, $this->charSet));
return $value;
}

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,8 @@
*/
class PHPExcel_Reader_Excel2007_Chart
{
private static function _getAttribute($component, $name, $format) {
private static function getAttribute($component, $name, $format)
{
$attributes = $component->attributes();
if (isset($attributes[$name])) {
if ($format == 'string') {
@ -48,24 +49,25 @@ class PHPExcel_Reader_Excel2007_Chart
}
}
return null;
} // function _getAttribute()
}
private static function _readColor($color, $background=false) {
private static function readColor($color, $background = false)
{
if (isset($color["rgb"])) {
return (string)$color["rgb"];
} else if (isset($color["indexed"])) {
} elseif (isset($color["indexed"])) {
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
}
}
public static function readChart($chartElements, $chartName) {
public static function readChart($chartElements, $chartName)
{
$namespacesChartMeta = $chartElements->getNamespaces(true);
$chartElementsC = $chartElements->children($namespacesChartMeta['c']);
$XaxisLabel = $YaxisLabel = $legend = $title = NULL;
$dispBlanksAs = $plotVisOnly = NULL;
$XaxisLabel = $YaxisLabel = $legend = $title = null;
$dispBlanksAs = $plotVisOnly = null;
foreach ($chartElementsC as $chartElementKey => $chartElement) {
switch ($chartElementKey) {
@ -79,99 +81,99 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
switch ($chartDetailKey) {
case "layout":
$plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'plotArea');
$plotAreaLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea');
break;
case "catAx":
if (isset($chartDetail->title)) {
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat');
$XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
}
break;
case "dateAx":
if (isset($chartDetail->title)) {
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat');
$XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
}
break;
case "valAx":
if (isset($chartDetail->title)) {
$YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat');
$YaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
}
break;
case "barChart":
case "bar3DChart":
$barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$barDirection = self::getAttribute($chartDetail->barDir, 'val', 'string');
$plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotDirection($barDirection);
$plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail);
$plotAttributes = self::readChartAttributes($chartDetail);
break;
case "lineChart":
case "line3DChart":
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::_readChartAttributes($chartDetail);
$plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::readChartAttributes($chartDetail);
break;
case "areaChart":
case "area3DChart":
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::_readChartAttributes($chartDetail);
$plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::readChartAttributes($chartDetail);
break;
case "doughnutChart":
case "pieChart":
case "pie3DChart":
$explosion = isset($chartDetail->ser->explosion);
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($explosion);
$plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail);
$plotAttributes = self::readChartAttributes($chartDetail);
break;
case "scatterChart":
$scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$scatterStyle = self::getAttribute($chartDetail->scatterStyle, 'val', 'string');
$plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($scatterStyle);
$plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail);
$plotAttributes = self::readChartAttributes($chartDetail);
break;
case "bubbleChart":
$bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$bubbleScale = self::getAttribute($chartDetail->bubbleScale, 'val', 'integer');
$plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($bubbleScale);
$plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail);
$plotAttributes = self::readChartAttributes($chartDetail);
break;
case "radarChart":
$radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$radarStyle = self::getAttribute($chartDetail->radarStyle, 'val', 'string');
$plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($radarStyle);
$plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail);
$plotAttributes = self::readChartAttributes($chartDetail);
break;
case "surfaceChart":
case "surface3DChart":
$wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$wireFrame = self::getAttribute($chartDetail->wireframe, 'val', 'boolean');
$plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($wireFrame);
$plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail);
$plotAttributes = self::readChartAttributes($chartDetail);
break;
case "stockChart":
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::_readChartAttributes($plotAreaLayout);
$plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::readChartAttributes($plotAreaLayout);
break;
}
}
if ($plotAreaLayout == NULL) {
if ($plotAreaLayout == null) {
$plotAreaLayout = new PHPExcel_Chart_Layout();
}
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries);
self::_setChartAttributes($plotAreaLayout, $plotAttributes);
self::setChartAttributes($plotAreaLayout, $plotAttributes);
break;
case "plotVisOnly":
$plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string');
$plotVisOnly = self::getAttribute($chartDetails, 'val', 'string');
break;
case "dispBlanksAs":
$dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string');
$dispBlanksAs = self::getAttribute($chartDetails, 'val', 'string');
break;
case "title":
$title = self::_chartTitle($chartDetails, $namespacesChartMeta,'title');
$title = self::chartTitle($chartDetails, $namespacesChartMeta, 'title');
break;
case "legend":
$legendPos = 'r';
@ -180,13 +182,13 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
switch ($chartDetailKey) {
case "legendPos":
$legendPos = self::_getAttribute($chartDetail, 'val', 'string');
$legendPos = self::getAttribute($chartDetail, 'val', 'string');
break;
case "overlay":
$legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean');
$legendOverlay = self::getAttribute($chartDetail, 'val', 'boolean');
break;
case "layout":
$legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'legend');
$legendLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend');
break;
}
}
@ -199,10 +201,10 @@ class PHPExcel_Reader_Excel2007_Chart
$chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel);
return $chart;
} // function readChart()
}
private static function _chartTitle($titleDetails, $namespacesChartMeta, $type) {
private static function chartTitle($titleDetails, $namespacesChartMeta, $type)
{
$caption = array();
$titleLayout = null;
foreach ($titleDetails as $titleDetailKey => $chartDetail) {
@ -213,21 +215,21 @@ class PHPExcel_Reader_Excel2007_Chart
switch ($titleKey) {
case "p":
$titleDetailPart = $titleDetail->children($namespacesChartMeta['a']);
$caption[] = self::_parseRichText($titleDetailPart);
$caption[] = self::parseRichText($titleDetailPart);
}
}
break;
case "layout":
$titleLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta);
$titleLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta);
break;
}
}
return new PHPExcel_Chart_Title($caption, $titleLayout);
} // function _chartTitle()
}
private static function _chartLayoutDetails($chartDetail, $namespacesChartMeta) {
private static function chartLayoutDetails($chartDetail, $namespacesChartMeta)
{
if (!isset($chartDetail->manualLayout)) {
return null;
}
@ -237,15 +239,15 @@ class PHPExcel_Reader_Excel2007_Chart
}
$layout = array();
foreach ($details as $detailKey => $detail) {
// echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL;
$layout[$detailKey] = self::_getAttribute($detail, 'val', 'string');
// echo $detailKey, ' => ',self::getAttribute($detail, 'val', 'string'),PHP_EOL;
$layout[$detailKey] = self::getAttribute($detail, 'val', 'string');
}
return new PHPExcel_Chart_Layout($layout);
} // function _chartLayoutDetails()
}
private static function _chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) {
$multiSeriesType = NULL;
private static function chartDataSeries($chartDetail, $namespacesChartMeta, $plotType)
{
$multiSeriesType = null;
$smoothLine = false;
$seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array();
@ -253,77 +255,79 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
switch ($seriesDetailKey) {
case "grouping":
$multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string');
$multiSeriesType = self::getAttribute($chartDetail->grouping, 'val', 'string');
break;
case "ser":
$marker = NULL;
$marker = null;
foreach ($seriesDetails as $seriesKey => $seriesDetail) {
switch ($seriesKey) {
case "idx":
$seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer');
$seriesIndex = self::getAttribute($seriesDetail, 'val', 'integer');
break;
case "order":
$seriesOrder = self::_getAttribute($seriesDetail, 'val', 'integer');
$seriesOrder = self::getAttribute($seriesDetail, 'val', 'integer');
$plotOrder[$seriesIndex] = $seriesOrder;
break;
case "tx":
$seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
$seriesLabel[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
break;
case "marker":
$marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string');
$marker = self::getAttribute($seriesDetail->symbol, 'val', 'string');
break;
case "smooth":
$smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean');
$smoothLine = self::getAttribute($seriesDetail, 'val', 'boolean');
break;
case "cat":
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
$seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
break;
case "val":
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
$seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
break;
case "xVal":
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
$seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
break;
case "yVal":
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
$seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
break;
}
}
}
}
return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine);
} // function _chartDataSeries()
}
private static function _chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false) {
private static function chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false)
{
if (isset($seriesDetail->strRef)) {
$seriesSource = (string) $seriesDetail->strRef->f;
$seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s');
$seriesData = self::chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's');
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->numRef)) {
$seriesSource = (string) $seriesDetail->numRef->f;
$seriesData = self::_chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
$seriesData = self::chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlStrRef)) {
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s');
$seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's');
$seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlNumRef)) {
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s');
$seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's');
$seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
}
return null;
} // function _chartDataSeriesValueSet()
}
private static function _chartDataSeriesValues($seriesValueSet, $dataType='n') {
private static function chartDataSeriesValues($seriesValueSet, $dataType = 'n')
{
$seriesVal = array();
$formatCode = '';
$pointCount = 0;
@ -331,13 +335,13 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) {
switch ($seriesValueIdx) {
case 'ptCount':
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
$pointCount = self::getAttribute($seriesValue, 'val', 'integer');
break;
case 'formatCode':
$formatCode = (string) $seriesValue;
break;
case 'pt':
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer');
$pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
if ($dataType == 's') {
$seriesVal[$pointVal] = (string) $seriesValue->v;
} else {
@ -348,17 +352,18 @@ class PHPExcel_Reader_Excel2007_Chart
}
if (empty($seriesVal)) {
$seriesVal = NULL;
$seriesVal = null;
}
return array( 'formatCode' => $formatCode,
return array(
'formatCode' => $formatCode,
'pointCount' => $pointCount,
'dataValues' => $seriesVal
);
} // function _chartDataSeriesValues()
}
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType='n') {
private static function chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n')
{
$seriesVal = array();
$formatCode = '';
$pointCount = 0;
@ -367,13 +372,13 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($seriesLevel as $seriesValueIdx => $seriesValue) {
switch ($seriesValueIdx) {
case 'ptCount':
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
$pointCount = self::getAttribute($seriesValue, 'val', 'integer');
break;
case 'formatCode':
$formatCode = (string) $seriesValue;
break;
case 'pt':
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer');
$pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
if ($dataType == 's') {
$seriesVal[$pointVal][] = (string) $seriesValue->v;
} else {
@ -384,45 +389,47 @@ class PHPExcel_Reader_Excel2007_Chart
}
}
return array( 'formatCode' => $formatCode,
return array(
'formatCode' => $formatCode,
'pointCount' => $pointCount,
'dataValues' => $seriesVal
);
} // function _chartDataSeriesValuesMultiLevel()
}
private static function _parseRichText($titleDetailPart = null) {
private static function parseRichText($titleDetailPart = null)
{
$value = new PHPExcel_RichText();
foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
if (isset($titleDetailElement->t)) {
$objText = $value->createTextRun( (string) $titleDetailElement->t );
$objText = $value->createTextRun((string) $titleDetailElement->t);
}
if (isset($titleDetailElement->rPr)) {
if (isset($titleDetailElement->rPr->rFont["val"])) {
$objText->getFont()->setName((string) $titleDetailElement->rPr->rFont["val"]);
}
$fontSize = (self::_getAttribute($titleDetailElement->rPr, 'sz', 'integer'));
$fontSize = (self::getAttribute($titleDetailElement->rPr, 'sz', 'integer'));
if (!is_null($fontSize)) {
$objText->getFont()->setSize(floor($fontSize / 100));
}
$fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string'));
$fontColor = (self::getAttribute($titleDetailElement->rPr, 'color', 'string'));
if (!is_null($fontColor)) {
$objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($fontColor) ) );
$objText->getFont()->setColor(new PHPExcel_Style_Color(self::readColor($fontColor)));
}
$bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean');
$bold = self::getAttribute($titleDetailElement->rPr, 'b', 'boolean');
if (!is_null($bold)) {
$objText->getFont()->setBold($bold);
}
$italic = self::_getAttribute($titleDetailElement->rPr, 'i', 'boolean');
$italic = self::getAttribute($titleDetailElement->rPr, 'i', 'boolean');
if (!is_null($italic)) {
$objText->getFont()->setItalic($italic);
}
$baseline = self::_getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
$baseline = self::getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
if (!is_null($baseline)) {
if ($baseline > 0) {
$objText->getFont()->setSuperScript(true);
@ -431,7 +438,7 @@ class PHPExcel_Reader_Excel2007_Chart
}
}
$underscore = (self::_getAttribute($titleDetailElement->rPr, 'u', 'string'));
$underscore = (self::getAttribute($titleDetailElement->rPr, 'u', 'string'));
if (!is_null($underscore)) {
if ($underscore == 'sng') {
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
@ -442,7 +449,7 @@ class PHPExcel_Reader_Excel2007_Chart
}
}
$strikethrough = (self::_getAttribute($titleDetailElement->rPr, 's', 'string'));
$strikethrough = (self::getAttribute($titleDetailElement->rPr, 's', 'string'));
if (!is_null($strikethrough)) {
if ($strikethrough == 'noStrike') {
$objText->getFont()->setStrikethrough(false);
@ -456,62 +463,62 @@ class PHPExcel_Reader_Excel2007_Chart
return $value;
}
private static function _readChartAttributes($chartDetail) {
private static function readChartAttributes($chartDetail)
{
$plotAttributes = array();
if (isset($chartDetail->dLbls)) {
if (isset($chartDetail->dLbls->howLegendKey)) {
$plotAttributes['showLegendKey'] = self::_getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string');
$plotAttributes['showLegendKey'] = self::getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string');
}
if (isset($chartDetail->dLbls->showVal)) {
$plotAttributes['showVal'] = self::_getAttribute($chartDetail->dLbls->showVal, 'val', 'string');
$plotAttributes['showVal'] = self::getAttribute($chartDetail->dLbls->showVal, 'val', 'string');
}
if (isset($chartDetail->dLbls->showCatName)) {
$plotAttributes['showCatName'] = self::_getAttribute($chartDetail->dLbls->showCatName, 'val', 'string');
$plotAttributes['showCatName'] = self::getAttribute($chartDetail->dLbls->showCatName, 'val', 'string');
}
if (isset($chartDetail->dLbls->showSerName)) {
$plotAttributes['showSerName'] = self::_getAttribute($chartDetail->dLbls->showSerName, 'val', 'string');
$plotAttributes['showSerName'] = self::getAttribute($chartDetail->dLbls->showSerName, 'val', 'string');
}
if (isset($chartDetail->dLbls->showPercent)) {
$plotAttributes['showPercent'] = self::_getAttribute($chartDetail->dLbls->showPercent, 'val', 'string');
$plotAttributes['showPercent'] = self::getAttribute($chartDetail->dLbls->showPercent, 'val', 'string');
}
if (isset($chartDetail->dLbls->showBubbleSize)) {
$plotAttributes['showBubbleSize'] = self::_getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string');
$plotAttributes['showBubbleSize'] = self::getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string');
}
if (isset($chartDetail->dLbls->showLeaderLines)) {
$plotAttributes['showLeaderLines'] = self::_getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string');
$plotAttributes['showLeaderLines'] = self::getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string');
}
}
return $plotAttributes;
}
private static function _setChartAttributes($plotArea, $plotAttributes)
private static function setChartAttributes($plotArea, $plotAttributes)
{
foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
switch ($plotAttributeKey) {
case 'showLegendKey' :
case 'showLegendKey':
$plotArea->setShowLegendKey($plotAttributeValue);
break;
case 'showVal' :
case 'showVal':
$plotArea->setShowVal($plotAttributeValue);
break;
case 'showCatName' :
case 'showCatName':
$plotArea->setShowCatName($plotAttributeValue);
break;
case 'showSerName' :
case 'showSerName':
$plotArea->setShowSerName($plotAttributeValue);
break;
case 'showPercent' :
case 'showPercent':
$plotArea->setShowPercent($plotAttributeValue);
break;
case 'showBubbleSize' :
case 'showBubbleSize':
$plotArea->setShowBubbleSize($plotAttributeValue);
break;
case 'showLeaderLines' :
case 'showLeaderLines':
$plotArea->setShowLeaderLines($plotAttributeValue);
break;
}
}
}
}

View File

@ -40,21 +40,21 @@ class PHPExcel_Reader_Excel2007_Theme
*
* @var string
*/
private $_themeName;
private $themeName;
/**
* Colour Scheme Name
*
* @var string
*/
private $_colourSchemeName;
private $colourSchemeName;
/**
* Colour Map indexed by position
*
* @var array of string
*/
private $_colourMapValues;
private $colourMapValues;
/**
@ -62,7 +62,7 @@ class PHPExcel_Reader_Excel2007_Theme
*
* @var array of string
*/
private $_colourMap;
private $colourMap;
/**
@ -72,9 +72,9 @@ class PHPExcel_Reader_Excel2007_Theme
public function __construct($themeName, $colourSchemeName, $colourMap)
{
// Initialise values
$this->_themeName = $themeName;
$this->_colourSchemeName = $colourSchemeName;
$this->_colourMap = $colourMap;
$this->themeName = $themeName;
$this->colourSchemeName = $colourSchemeName;
$this->colourMap = $colourMap;
}
/**
@ -84,7 +84,7 @@ class PHPExcel_Reader_Excel2007_Theme
*/
public function getThemeName()
{
return $this->_themeName;
return $this->themeName;
}
/**
@ -92,8 +92,9 @@ class PHPExcel_Reader_Excel2007_Theme
*
* @return string
*/
public function getColourSchemeName() {
return $this->_colourSchemeName;
public function getColourSchemeName()
{
return $this->colourSchemeName;
}
/**
@ -101,9 +102,10 @@ class PHPExcel_Reader_Excel2007_Theme
*
* @return string
*/
public function getColourByIndex($index=0) {
if (isset($this->_colourMap[$index])) {
return $this->_colourMap[$index];
public function getColourByIndex($index = 0)
{
if (isset($this->colourMap[$index])) {
return $this->colourMap[$index];
}
return null;
}
@ -111,7 +113,8 @@ class PHPExcel_Reader_Excel2007_Theme
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Reader_Excel5_Escher
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Reader_Excel5_Escher
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel5_Escher
{
const DGGCONTAINER = 0xF000;
@ -58,28 +51,28 @@ class PHPExcel_Reader_Excel5_Escher
*
* @var string
*/
private $_data;
private $data;
/**
* Size in bytes of the Escher stream data
*
* @var int
*/
private $_dataSize;
private $dataSize;
/**
* Current position of stream pointer in Escher stream data
*
* @var int
*/
private $_pos;
private $pos;
/**
* The object to be returned by the reader. Modified during load.
*
* @var mixed
*/
private $_object;
private $object;
/**
* Create a new PHPExcel_Reader_Excel5_Escher instance
@ -88,7 +81,7 @@ class PHPExcel_Reader_Excel5_Escher
*/
public function __construct($object)
{
$this->_object = $object;
$this->object = $object;
}
/**
@ -98,80 +91,117 @@ class PHPExcel_Reader_Excel5_Escher
*/
public function load($data)
{
$this->_data = $data;
$this->data = $data;
// total byte size of Excel data (workbook global substream + sheet substreams)
$this->_dataSize = strlen($this->_data);
$this->dataSize = strlen($this->data);
$this->_pos = 0;
$this->pos = 0;
// Parse Escher stream
while ($this->_pos < $this->_dataSize) {
while ($this->pos < $this->dataSize) {
// offset: 2; size: 2: Record Type
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2);
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos + 2);
switch ($fbt) {
case self::DGGCONTAINER: $this->_readDggContainer(); break;
case self::DGG: $this->_readDgg(); break;
case self::BSTORECONTAINER: $this->_readBstoreContainer(); break;
case self::BSE: $this->_readBSE(); break;
case self::BLIPJPEG: $this->_readBlipJPEG(); break;
case self::BLIPPNG: $this->_readBlipPNG(); break;
case self::OPT: $this->_readOPT(); break;
case self::TERTIARYOPT: $this->_readTertiaryOPT(); break;
case self::SPLITMENUCOLORS: $this->_readSplitMenuColors(); break;
case self::DGCONTAINER: $this->_readDgContainer(); break;
case self::DG: $this->_readDg(); break;
case self::SPGRCONTAINER: $this->_readSpgrContainer(); break;
case self::SPCONTAINER: $this->_readSpContainer(); break;
case self::SPGR: $this->_readSpgr(); break;
case self::SP: $this->_readSp(); break;
case self::CLIENTTEXTBOX: $this->_readClientTextbox(); break;
case self::CLIENTANCHOR: $this->_readClientAnchor(); break;
case self::CLIENTDATA: $this->_readClientData(); break;
default: $this->_readDefault(); break;
case self::DGGCONTAINER:
$this->readDggContainer();
break;
case self::DGG:
$this->readDgg();
break;
case self::BSTORECONTAINER:
$this->readBstoreContainer();
break;
case self::BSE:
$this->readBSE();
break;
case self::BLIPJPEG:
$this->readBlipJPEG();
break;
case self::BLIPPNG:
$this->readBlipPNG();
break;
case self::OPT:
$this->readOPT();
break;
case self::TERTIARYOPT:
$this->readTertiaryOPT();
break;
case self::SPLITMENUCOLORS:
$this->readSplitMenuColors();
break;
case self::DGCONTAINER:
$this->readDgContainer();
break;
case self::DG:
$this->readDg();
break;
case self::SPGRCONTAINER:
$this->readSpgrContainer();
break;
case self::SPCONTAINER:
$this->readSpContainer();
break;
case self::SPGR:
$this->readSpgr();
break;
case self::SP:
$this->readSp();
break;
case self::CLIENTTEXTBOX:
$this->readClientTextbox();
break;
case self::CLIENTANCHOR:
$this->readClientAnchor();
break;
case self::CLIENTDATA:
$this->readClientData();
break;
default:
$this->readDefault();
break;
}
}
return $this->_object;
return $this->object;
}
/**
* Read a generic record
*/
private function _readDefault()
private function readDefault()
{
// offset 0; size: 2; recVer and recInstance
$verInstance = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos);
$verInstance = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos);
// offset: 2; size: 2: Record Type
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2);
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos + 2);
// bit: 0-3; mask: 0x000F; recVer
$recVer = (0x000F & $verInstance) >> 0;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
}
/**
* Read DggContainer record (Drawing Group Container)
*/
private function _readDggContainer()
private function readDggContainer()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
// record is a container, read contents
$dggContainer = new PHPExcel_Shared_Escher_DggContainer();
$this->_object->setDggContainer($dggContainer);
$this->object->setDggContainer($dggContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($dggContainer);
$reader->load($recordData);
}
@ -179,29 +209,29 @@ class PHPExcel_Reader_Excel5_Escher
/**
* Read Dgg record (Drawing Group)
*/
private function _readDgg()
private function readDgg()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
}
/**
* Read BstoreContainer record (Blip Store Container)
*/
private function _readBstoreContainer()
private function readBstoreContainer()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
// record is a container, read contents
$bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer();
$this->_object->setBstoreContainer($bstoreContainer);
$this->object->setBstoreContainer($bstoreContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer);
$reader->load($recordData);
}
@ -209,22 +239,22 @@ class PHPExcel_Reader_Excel5_Escher
/**
* Read BSE record
*/
private function _readBSE()
private function readBSE()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
$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);
$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;
$this->pos += 8 + $length;
// add BSE to BstoreContainer
$BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
$this->_object->addBSE($BSE);
$this->object->addBSE($BSE);
$BSE->setBLIPType($recInstance);
@ -275,18 +305,18 @@ class PHPExcel_Reader_Excel5_Escher
/**
* Read BlipJPEG record. Holds raw JPEG image data
*/
private function _readBlipJPEG()
private function readBlipJPEG()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
$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);
$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;
$this->pos += 8 + $length;
$pos = 0;
@ -310,24 +340,24 @@ class PHPExcel_Reader_Excel5_Escher
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($data);
$this->_object->setBlip($blip);
$this->object->setBlip($blip);
}
/**
* Read BlipPNG record. Holds raw PNG image data
*/
private function _readBlipPNG()
private function readBlipPNG()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
$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);
$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;
$this->pos += 8 + $length;
$pos = 0;
@ -351,71 +381,71 @@ class PHPExcel_Reader_Excel5_Escher
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($data);
$this->_object->setBlip($blip);
$this->object->setBlip($blip);
}
/**
* Read OPT record. This record may occur within DggContainer record or SpContainer
*/
private function _readOPT()
private function readOPT()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
$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);
$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;
$this->pos += 8 + $length;
$this->_readOfficeArtRGFOPTE($recordData, $recInstance);
$this->readOfficeArtRGFOPTE($recordData, $recInstance);
}
/**
* Read TertiaryOPT record
*/
private function _readTertiaryOPT()
private function readTertiaryOPT()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
$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);
$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;
$this->pos += 8 + $length;
}
/**
* Read SplitMenuColors record
*/
private function _readSplitMenuColors()
private function readSplitMenuColors()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
}
/**
* Read DgContainer record (Drawing Container)
*/
private function _readDgContainer()
private function readDgContainer()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
// record is a container, read contents
$dgContainer = new PHPExcel_Shared_Escher_DgContainer();
$this->_object->setDgContainer($dgContainer);
$this->object->setDgContainer($dgContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($dgContainer);
$escher = $reader->load($recordData);
}
@ -423,37 +453,37 @@ class PHPExcel_Reader_Excel5_Escher
/**
* Read Dg record (Drawing)
*/
private function _readDg()
private function readDg()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
}
/**
* Read SpgrContainer record (Shape Group Container)
*/
private function _readSpgrContainer()
private function readSpgrContainer()
{
// context is either context DgContainer or SpgrContainer
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
// record is a container, read contents
$spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer();
if ($this->_object instanceof PHPExcel_Shared_Escher_DgContainer) {
if ($this->object instanceof PHPExcel_Shared_Escher_DgContainer) {
// DgContainer
$this->_object->setSpgrContainer($spgrContainer);
$this->object->setSpgrContainer($spgrContainer);
} else {
// SpgrContainer
$this->_object->addChild($spgrContainer);
$this->object->addChild($spgrContainer);
}
$reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer);
@ -463,17 +493,17 @@ class PHPExcel_Reader_Excel5_Escher
/**
* Read SpContainer record (Shape Container)
*/
private function _readSpContainer()
private function readSpContainer()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length);
// add spContainer to spgrContainer
$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
$this->_object->addChild($spContainer);
$this->object->addChild($spContainer);
// move stream pointer to next record
$this->_pos += 8 + $length;
$this->pos += 8 + $length;
// record is a container, read contents
$reader = new PHPExcel_Reader_Excel5_Escher($spContainer);
@ -483,59 +513,59 @@ class PHPExcel_Reader_Excel5_Escher
/**
* Read Spgr record (Shape Group)
*/
private function _readSpgr()
private function readSpgr()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
}
/**
* Read Sp record (Shape)
*/
private function _readSp()
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;
$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);
$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;
$this->pos += 8 + $length;
}
/**
* Read ClientTextbox record
*/
private function _readClientTextbox()
private function readClientTextbox()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
$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);
$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;
$this->pos += 8 + $length;
}
/**
* Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet
*/
private function _readClientAnchor()
private function readClientAnchor()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
// offset: 2; size: 2; upper-left corner column index (0-based)
$c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2);
@ -562,34 +592,34 @@ class PHPExcel_Reader_Excel5_Escher
$endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16);
// set the start coordinates
$this->_object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1));
$this->object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1));
// set the start offsetX
$this->_object->setStartOffsetX($startOffsetX);
$this->object->setStartOffsetX($startOffsetX);
// set the start offsetY
$this->_object->setStartOffsetY($startOffsetY);
$this->object->setStartOffsetY($startOffsetY);
// set the end coordinates
$this->_object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1));
$this->object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1));
// set the end offsetX
$this->_object->setEndOffsetX($endOffsetX);
$this->object->setEndOffsetX($endOffsetX);
// set the end offsetY
$this->_object->setEndOffsetY($endOffsetY);
$this->object->setEndOffsetY($endOffsetY);
}
/**
* Read ClientData record
*/
private function _readClientData()
private function readClientData()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
$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;
$this->pos += 8 + $length;
}
/**
@ -598,8 +628,8 @@ class PHPExcel_Reader_Excel5_Escher
* @param string $data Binary data
* @param int $n Number of properties
*/
private function _readOfficeArtRGFOPTE($data, $n) {
private function readOfficeArtRGFOPTE($data, $n)
{
$splicedComplexData = substr($data, 6 * $n);
// loop through property-value pairs
@ -633,8 +663,7 @@ class PHPExcel_Reader_Excel5_Escher
$value = $op;
}
$this->_object->setOPT($opidOpid, $value);
$this->object->setOPT($opidOpid, $value);
}
}
}

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Reader_Excel5_MD5
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Reader_Excel5_MD5
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel5_MD5
{
// Context
@ -41,7 +33,6 @@ class PHPExcel_Reader_Excel5_MD5
private $c;
private $d;
/**
* MD5 stream constructor
*/
@ -50,7 +41,6 @@ class PHPExcel_Reader_Excel5_MD5
$this->reset();
}
/**
* Reset the MD5 stream context
*/
@ -62,7 +52,6 @@ class PHPExcel_Reader_Excel5_MD5
$this->d = 0x10325476;
}
/**
* Get MD5 stream context
*
@ -82,7 +71,6 @@ class PHPExcel_Reader_Excel5_MD5
return $s;
}
/**
* Add data to context
*
@ -180,31 +168,26 @@ class PHPExcel_Reader_Excel5_MD5
$this->d = ($this->d + $D) & 0xffffffff;
}
private static function F($X, $Y, $Z)
{
return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
}
private static function G($X, $Y, $Z)
{
return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
}
private static function H($X, $Y, $Z)
{
return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
}
private static function I($X, $Y, $Z)
{
return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
}
private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
{
$A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
@ -212,7 +195,6 @@ class PHPExcel_Reader_Excel5_MD5
$A = ($B + $A) & 0xffffffff;
}
private static function rotate($decimal, $bits)
{
$binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Reader_Excel5_RC4
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,20 +25,12 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Reader_Excel5_RC4
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel5_RC4
{
// Context
var $s = array();
var $i = 0;
var $j = 0;
protected $s = array();
protected $i = 0;
protected $j = 0;
/**
* RC4 stream decryption/encryption constrcutor

View File

@ -1,6 +1,16 @@
<?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel
* PHPExcel_Reader_Gnumeric
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Gnumeric
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{
/**
@ -49,27 +41,26 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
*
* @var array
*/
private $_styles = array();
private $styles = array();
/**
* Shared Expressions
*
* @var array
*/
private $_expressions = array();
private $_referenceHelper = null;
private $expressions = array();
private $referenceHelper = null;
/**
* Create a new PHPExcel_Reader_Gnumeric
*/
public function __construct() {
public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
$this->referenceHelper = PHPExcel_ReferenceHelper::getInstance();
}
/**
* Can the current PHPExcel_Reader_IReader read the file?
*
@ -101,7 +92,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return true;
}
/**
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
*
@ -116,10 +106,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
}
$xml = new XMLReader();
$xml->xml(
$this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions()
);
$xml->setParserProperty(2,true);
$xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$xml->setParserProperty(2, true);
$worksheetNames = array();
while ($xml->read()) {
@ -135,7 +123,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $worksheetNames;
}
/**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
*
@ -150,10 +137,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
}
$xml = new XMLReader();
$xml->xml(
$this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions()
);
$xml->setParserProperty(2,true);
$xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$xml->setParserProperty(2, true);
$worksheetInfo = array();
while ($xml->read()) {
@ -188,8 +173,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $worksheetInfo;
}
private function _gzfileGetContents($filename) {
private function _gzfileGetContents($filename)
{
$file = @gzopen($filename, 'rb');
if ($file !== false) {
$data = '';
@ -201,7 +186,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $data;
}
/**
* Loads PHPExcel from file
*
@ -218,7 +202,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $this->loadIntoExisting($pFilename, $objPHPExcel);
}
/**
* Loads PHPExcel from file into PHPExcel instance
*
@ -258,7 +241,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$officeDocMetaXML = $officeDocXML->meta;
foreach ($officeDocMetaXML as $officePropertyData) {
$officePropertyDC = array();
if (isset($namespacesMeta['dc'])) {
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
@ -266,22 +248,22 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
foreach ($officePropertyDC as $propertyName => $propertyValue) {
$propertyValue = (string) $propertyValue;
switch ($propertyName) {
case 'title' :
case 'title':
$docProps->setTitle(trim($propertyValue));
break;
case 'subject' :
case 'subject':
$docProps->setSubject(trim($propertyValue));
break;
case 'creator' :
case 'creator':
$docProps->setCreator(trim($propertyValue));
$docProps->setLastModifiedBy(trim($propertyValue));
break;
case 'date' :
case 'date':
$creationDate = strtotime(trim($propertyValue));
$docProps->setCreated($creationDate);
$docProps->setModified($creationDate);
break;
case 'description' :
case 'description':
$docProps->setDescription(trim($propertyValue));
break;
}
@ -294,28 +276,28 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$attributes = $propertyValue->attributes($namespacesMeta['meta']);
$propertyValue = (string) $propertyValue;
switch ($propertyName) {
case 'keyword' :
case 'keyword':
$docProps->setKeywords(trim($propertyValue));
break;
case 'initial-creator' :
case 'initial-creator':
$docProps->setCreator(trim($propertyValue));
$docProps->setLastModifiedBy(trim($propertyValue));
break;
case 'creation-date' :
case 'creation-date':
$creationDate = strtotime(trim($propertyValue));
$docProps->setCreated($creationDate);
$docProps->setModified($creationDate);
break;
case 'user-defined' :
case 'user-defined':
list(, $attrName) = explode(':', $attributes['name']);
switch ($attrName) {
case 'publisher' :
case 'publisher':
$docProps->setCompany(trim($propertyValue));
break;
case 'category' :
case 'category':
$docProps->setCategory(trim($propertyValue));
break;
case 'manager' :
case 'manager':
$docProps->setManager(trim($propertyValue));
break;
}
@ -328,26 +310,26 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$propertyName = $summaryItem->name;
$propertyValue = $summaryItem->{'val-string'};
switch ($propertyName) {
case 'title' :
case 'title':
$docProps->setTitle(trim($propertyValue));
break;
case 'comments' :
case 'comments':
$docProps->setDescription(trim($propertyValue));
break;
case 'keywords' :
case 'keywords':
$docProps->setKeywords(trim($propertyValue));
break;
case 'category' :
case 'category':
$docProps->setCategory(trim($propertyValue));
break;
case 'manager' :
case 'manager':
$docProps->setManager(trim($propertyValue));
break;
case 'author' :
case 'author':
$docProps->setCreator(trim($propertyValue));
$docProps->setLastModifiedBy(trim($propertyValue));
break;
case 'company' :
case 'company':
$docProps->setCompany(trim($propertyValue));
break;
}
@ -370,35 +352,35 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula
// cells... during the load, all formulae should be correct, and we're simply bringing the worksheet
// name in line with the formula, not the reverse
$objPHPExcel->getActiveSheet()->setTitle($worksheetName,false);
$objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) {
if (isset($sheet->PrintInformation->Margins)) {
foreach ($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) {
foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) {
$marginAttributes = $margin->attributes();
$marginSize = 72 / 100; // Default
switch ($marginAttributes['PrefUnit']) {
case 'mm' :
case 'mm':
$marginSize = intval($marginAttributes['Points']) / 100;
break;
}
switch ($key) {
case 'top' :
case 'top':
$objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
break;
case 'bottom' :
case 'bottom':
$objPHPExcel->getActiveSheet()->getPageMargins()->setBottom($marginSize);
break;
case 'left' :
case 'left':
$objPHPExcel->getActiveSheet()->getPageMargins()->setLeft($marginSize);
break;
case 'right' :
case 'right':
$objPHPExcel->getActiveSheet()->getPageMargins()->setRight($marginSize);
break;
case 'header' :
case 'header':
$objPHPExcel->getActiveSheet()->getPageMargins()->setHeader($marginSize);
break;
case 'footer' :
case 'footer':
$objPHPExcel->getActiveSheet()->getPageMargins()->setFooter($marginSize);
break;
}
@ -411,13 +393,17 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$row = (int) $cellAttributes->Row + 1;
$column = (int) $cellAttributes->Col;
if ($row > $maxRow) $maxRow = $row;
if ($column > $maxCol) $maxCol = $column;
if ($row > $maxRow) {
$maxRow = $row;
}
if ($column > $maxCol) {
$maxCol = $column;
}
$column = PHPExcel_Cell::stringFromColumnIndex($column);
// Read cell?
if ($this->getReadFilter() !== NULL) {
if ($this->getReadFilter() !== null) {
if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
continue;
}
@ -431,60 +417,53 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
if ($ExprID > '') {
if (((string) $cell) > '') {
$this->_expressions[$ExprID] = array( 'column' => $cellAttributes->Col,
$this->expressions[$ExprID] = array(
'column' => $cellAttributes->Col,
'row' => $cellAttributes->Row,
'formula' => (string) $cell
);
// echo 'NEW EXPRESSION ', $ExprID,'<br />';
} else {
$expression = $this->_expressions[$ExprID];
$expression = $this->expressions[$ExprID];
$cell = $this->_referenceHelper->updateFormulaReferences( $expression['formula'],
'A1',
$cellAttributes->Col - $expression['column'],
$cellAttributes->Row - $expression['row'],
$worksheetName
);
$cell = $this->referenceHelper->updateFormulaReferences($expression['formula'], 'A1', $cellAttributes->Col - $expression['column'], $cellAttributes->Row - $expression['row'], $worksheetName);
// echo 'SHARED EXPRESSION ', $ExprID,'<br />';
// echo 'New Value is ', $cell,'<br />';
}
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
} else {
switch ($ValueType) {
case '10' : // NULL
case '10': // NULL
$type = PHPExcel_Cell_DataType::TYPE_NULL;
break;
case '20' : // Boolean
case '20': // Boolean
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
$cell = ($cell == 'TRUE') ? True : False;
$cell = ($cell == 'TRUE') ? true: false;
break;
case '30' : // Integer
case '30': // Integer
$cell = intval($cell);
case '40' : // Float
case '40': // Float
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
break;
case '50' : // Error
case '50': // Error
$type = PHPExcel_Cell_DataType::TYPE_ERROR;
break;
case '60' : // String
case '60': // String
$type = PHPExcel_Cell_DataType::TYPE_STRING;
break;
case '70' : // Cell Range
case '80' : // Array
case '70': // Cell Range
case '80': // Array
}
}
$objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type);
}
if ((!$this->_readDataOnly) && (isset($sheet->Objects))) {
foreach ($sheet->Objects->children('gnm',TRUE) as $key => $comment) {
foreach ($sheet->Objects->children('gnm', true) as $key => $comment) {
$commentAttributes = $comment->attributes();
// Only comment objects are handled at the moment
if ($commentAttributes->Text) {
$objPHPExcel->getActiveSheet()->getComment( (string)$commentAttributes->ObjectBound )
->setAuthor( (string)$commentAttributes->Author )
->setText($this->_parseRichText((string)$commentAttributes->Text) );
$objPHPExcel->getActiveSheet()->getComment((string)$commentAttributes->ObjectBound)->setAuthor((string)$commentAttributes->Author)->setText($this->_parseRichText((string)$commentAttributes->Text));
}
}
}
@ -494,7 +473,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$styleAttributes = $styleRegion->attributes();
if (($styleAttributes['startRow'] <= $maxRow) &&
($styleAttributes['startCol'] <= $maxCol)) {
$startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']);
$startRow = $styleAttributes['startRow'] + 1;
@ -517,44 +495,44 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// If _readDataOnly is false, we set all formatting information
if (!$this->_readDataOnly) {
switch ($styleAttributes['HAlign']) {
case '1' :
case '1':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
break;
case '2' :
case '2':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
break;
case '4' :
case '4':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_RIGHT;
break;
case '8' :
case '8':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER;
break;
case '16' :
case '64' :
case '16':
case '64':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS;
break;
case '32' :
case '32':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY;
break;
}
switch ($styleAttributes['VAlign']) {
case '1' :
case '1':
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
break;
case '2' :
case '2':
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
break;
case '4' :
case '4':
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_CENTER;
break;
case '8' :
case '8':
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_JUSTIFY;
break;
}
$styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? True : False;
$styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? True : False;
$styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? true : false;
$styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false;
$styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0;
$RGB = self::_parseGnumericColour($styleAttributes["Fore"]);
@ -566,64 +544,64 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$RGB2 = self::_parseGnumericColour($styleAttributes["PatternColor"]);
$styleArray['fill']['endcolor']['rgb'] = $RGB2;
switch ($shade) {
case '1' :
case '1':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
break;
case '2' :
case '2':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR;
break;
case '3' :
case '3':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_PATH;
break;
case '4' :
case '4':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN;
break;
case '5' :
case '5':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY;
break;
case '6' :
case '6':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID;
break;
case '7' :
case '7':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL;
break;
case '8' :
case '8':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS;
break;
case '9' :
case '9':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKUP;
break;
case '10' :
case '10':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL;
break;
case '11' :
case '11':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625;
break;
case '12' :
case '12':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY125;
break;
case '13' :
case '13':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN;
break;
case '14' :
case '14':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY;
break;
case '15' :
case '15':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID;
break;
case '16' :
case '16':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL;
break;
case '17' :
case '17':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS;
break;
case '18' :
case '18':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP;
break;
case '19' :
case '19':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL;
break;
case '20' :
case '20':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY;
break;
}
@ -634,32 +612,32 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// echo '<br />';
$styleArray['font']['name'] = (string) $styleRegion->Style->Font;
$styleArray['font']['size'] = intval($fontAttributes['Unit']);
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? True : False;
$styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? True : False;
$styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? True : False;
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false;
$styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false;
$styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false;
switch ($fontAttributes['Underline']) {
case '1' :
case '1':
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
break;
case '2' :
case '2':
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLE;
break;
case '3' :
case '3':
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING;
break;
case '4' :
case '4':
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING;
break;
default :
default:
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE;
break;
}
switch ($fontAttributes['Script']) {
case '1' :
$styleArray['font']['superScript'] = True;
case '1':
$styleArray['font']['superScript'] = true;
break;
case '-1' :
$styleArray['font']['subScript'] = True;
case '-1':
$styleArray['font']['subScript'] = true;
break;
}
@ -761,7 +739,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// Handle Merged Cells in this worksheet
if (isset($sheet->MergedRegions)) {
foreach ($sheet->MergedRegions->Merge as $mergeCells) {
if (strpos($mergeCells,':') !== FALSE) {
if (strpos($mergeCells, ':') !== false) {
$objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
}
}
@ -780,20 +758,18 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
}
$range = explode('!', $range);
$range[0] = trim($range[0],"'");;
$range[0] = trim($range[0], "'");
if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
$extractedRange = str_replace('$', '', $range[1]);
$objPHPExcel->addNamedRange( new PHPExcel_NamedRange($name, $worksheet, $extractedRange) );
$objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange));
}
}
}
// Return
return $objPHPExcel;
}
private static function _parseBorderAttributes($borderAttributes)
{
$styleArray = array();
@ -804,54 +780,54 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
}
switch ($borderAttributes["Style"]) {
case '0' :
case '0':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_NONE;
break;
case '1' :
case '1':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case '2' :
case '2':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
break;
case '4' :
case '4':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED;
break;
case '5' :
case '5':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_THICK;
break;
case '6' :
case '6':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DOUBLE;
break;
case '7' :
case '7':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED;
break;
case '9' :
case '9':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT;
break;
case '10' :
case '10':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT;
break;
case '11' :
case '11':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOTDOT;
break;
case '12' :
case '12':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
break;
case '13' :
case '13':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
break;
case '3' :
case '3':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT;
break;
case '8' :
case '8':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED;
break;
}
return $styleArray;
}
private function _parseRichText($is = '') {
private function _parseRichText($is = '')
{
$value = new PHPExcel_RichText();
$value->createText($is);
@ -859,15 +835,14 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $value;
}
private static function _parseGnumericColour($gnmColour) {
private static function _parseGnumericColour($gnmColour)
{
list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
$gnmR = substr(str_pad($gnmR,4,'0',STR_PAD_RIGHT),0,2);
$gnmG = substr(str_pad($gnmG,4,'0',STR_PAD_RIGHT),0,2);
$gnmB = substr(str_pad($gnmB,4,'0',STR_PAD_RIGHT),0,2);
$gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2);
$gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2);
$gnmB = substr(str_pad($gnmB, 4, '0', STR_PAD_RIGHT), 0, 2);
$RGB = $gnmR.$gnmG.$gnmB;
// echo 'Excel Colour: ', $RGB,'<br />';
return $RGB;
}
}

View File

@ -1,6 +1,16 @@
<?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel
* PHPExcel_Reader_OOCalc
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_OOCalc
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{
/**
@ -49,17 +41,16 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
*
* @var array
*/
private $_styles = array();
private $styles = array();
/**
* Create a new PHPExcel_Reader_OOCalc
*/
public function __construct() {
public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
}
/**
* Can the current PHPExcel_Reader_IReader read the file?
*
@ -77,7 +68,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$zipClass = PHPExcel_Settings::getZipClass();
// Check if zip class exists
// if (!class_exists($zipClass, FALSE)) {
// if (!class_exists($zipClass, false)) {
// throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled");
// }
@ -109,7 +100,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return ($mimeType === 'application/vnd.oasis.opendocument.spreadsheet');
}
return FALSE;
return false;
}
@ -137,18 +128,19 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$xml = new XMLReader();
$res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$xml->setParserProperty(2,true);
$xml->setParserProperty(2, true);
// Step into the first level of content of the XML
$xml->read();
while ($xml->read()) {
// Quickly jump through to the office:body node
while ($xml->name !== 'office:body') {
if ($xml->isEmptyElement)
if ($xml->isEmptyElement) {
$xml->read();
else
} else {
$xml->next();
}
}
// Now read each node until we find our first table:table node
while ($xml->read()) {
if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) {
@ -164,7 +156,6 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $worksheetNames;
}
/**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
*
@ -189,18 +180,19 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$xml = new XMLReader();
$res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$xml->setParserProperty(2,true);
$xml->setParserProperty(2, true);
// Step into the first level of content of the XML
$xml->read();
while ($xml->read()) {
// Quickly jump through to the office:body node
while ($xml->name !== 'office:body') {
if ($xml->isEmptyElement)
if ($xml->isEmptyElement) {
$xml->read();
else
} else {
$xml->next();
}
}
// Now read each node until we find our first table:table node
while ($xml->read()) {
if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) {
@ -289,7 +281,6 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $worksheetInfo;
}
/**
* Loads PHPExcel from file
*
@ -306,8 +297,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $this->loadIntoExisting($pFilename, $objPHPExcel);
}
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
private static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
{
$styleAttributeValue = strtolower($styleAttributeValue);
foreach ($styleList as $style) {
if ($styleAttributeValue == strtolower($style)) {
@ -318,7 +309,6 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return false;
}
/**
* Loads PHPExcel from file into PHPExcel instance
*
@ -361,22 +351,22 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
foreach ($officePropertyDC as $propertyName => $propertyValue) {
$propertyValue = (string) $propertyValue;
switch ($propertyName) {
case 'title' :
case 'title':
$docProps->setTitle($propertyValue);
break;
case 'subject' :
case 'subject':
$docProps->setSubject($propertyValue);
break;
case 'creator' :
case 'creator':
$docProps->setCreator($propertyValue);
$docProps->setLastModifiedBy($propertyValue);
break;
case 'date' :
case 'date':
$creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate);
$docProps->setModified($creationDate);
break;
case 'description' :
case 'description':
$docProps->setDescription($propertyValue);
break;
}
@ -389,36 +379,36 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
$propertyValue = (string) $propertyValue;
switch ($propertyName) {
case 'initial-creator' :
case 'initial-creator':
$docProps->setCreator($propertyValue);
break;
case 'keyword' :
case 'keyword':
$docProps->setKeywords($propertyValue);
break;
case 'creation-date' :
case 'creation-date':
$creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate);
break;
case 'user-defined' :
case 'user-defined':
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
foreach ($propertyValueAttributes as $key => $value) {
if ($key == 'name') {
$propertyValueName = (string) $value;
} elseif ($key == 'value-type') {
switch ($value) {
case 'date' :
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'date');
case 'date':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'date');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
break;
case 'boolean' :
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'bool');
case 'boolean':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'bool');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
break;
case 'float' :
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'r4');
case 'float':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'r4');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
break;
default :
default:
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
}
}
@ -462,7 +452,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
// formula cells... during the load, all formulae should be correct, and we're simply
// bringing the worksheet name in line with the formula, not the reverse
$objPHPExcel->getActiveSheet()->setTitle($worksheetName,false);
$objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
}
$rowID = 1;
@ -470,26 +460,23 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo '<b>'.$key.'</b><br />';
switch ($key) {
case 'table-header-rows':
foreach ($rowData as $key=>$cellData) {
foreach ($rowData as $key => $cellData) {
$rowData = $cellData;
break;
}
case 'table-row' :
case 'table-row':
$rowDataTableAttributes = $rowData->attributes($namespacesContent['table']);
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ?
$rowDataTableAttributes['number-rows-repeated'] : 1;
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowDataTableAttributes['number-rows-repeated'] : 1;
$columnID = 'A';
foreach ($rowData as $key => $cellData) {
if ($this->getReadFilter() !== NULL) {
if ($this->getReadFilter() !== null) {
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
continue;
}
}
// echo '<b>'.$columnID.$rowID.'</b><br />';
$cellDataText = (isset($namespacesContent['text'])) ?
$cellData->children($namespacesContent['text']) :
'';
$cellDataText = (isset($namespacesContent['text'])) ? $cellData->children($namespacesContent['text']) : '';
$cellDataOffice = $cellData->children($namespacesContent['office']);
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
$cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
@ -524,10 +511,9 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
}
}
$text = implode("\n", $textArray);
// echo $text,'<br />';
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
// echo $text, '<br />';
$objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setText($this->parseRichText($text));
// ->setAuthor( $author )
->setText($this->_parseRichText($text) );
}
if (isset($cellDataText->p)) {
@ -553,7 +539,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
switch ($cellDataOfficeAttributes['value-type']) {
case 'string' :
case 'string':
$type = PHPExcel_Cell_DataType::TYPE_STRING;
$dataValue = $allCellDataText;
if (isset($dataValue->a)) {
@ -562,11 +548,11 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$hyperlink = $cellXLinkAttributes['href'];
}
break;
case 'boolean' :
case 'boolean':
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
$dataValue = ($allCellDataText == 'TRUE') ? True : False;
$dataValue = ($allCellDataText == 'TRUE') ? true : false;
break;
case 'percentage' :
case 'percentage':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) {
@ -574,7 +560,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
}
$formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00;
break;
case 'currency' :
case 'currency':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) {
@ -582,17 +568,18 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
}
$formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
break;
case 'float' :
case 'float':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) {
if ($dataValue == (integer) $dataValue)
if ($dataValue == (integer) $dataValue) {
$dataValue = (integer) $dataValue;
else
} else {
$dataValue = (float) $dataValue;
}
}
break;
case 'date' :
case 'date':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
$dateObj->setTimeZone($timezoneObj);
@ -604,35 +591,35 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15;
}
break;
case 'time' :
case 'time':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':',sscanf($cellDataOfficeAttributes['time-value'],'PT%dH%dM%dS'))));
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS'))));
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
break;
}
// echo 'Data value is '.$dataValue.'<br />';
// if ($hyperlink !== NULL) {
// if ($hyperlink !== null) {
// echo 'Hyperlink is '.$hyperlink.'<br />';
// }
} else {
$type = PHPExcel_Cell_DataType::TYPE_NULL;
$dataValue = NULL;
$dataValue = null;
}
if ($hasCalculatedValue) {
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
// echo 'Formula: ', $cellDataFormula, PHP_EOL;
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1);
$cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=')+1);
$temp = explode('"', $cellDataFormula);
$tKey = false;
foreach ($temp as &$value) {
// Only replace in alternate array entries (i.e. non-quoted blocks)
if ($tKey = !$tKey) {
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui','$1!$2:$3', $value); // Cell range reference in another sheet
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui','$1!$2', $value); // Cell reference in another sheet
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui','$1:$2', $value); // Cell range reference
$value = preg_replace('/\[\.([^\.]+)\]/Ui','$1', $value); // Simple cell reference
$value = PHPExcel_Calculation::_translateSeparator(';',',', $value, $inBraces);
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui', '$1!$2:$3', $value); // Cell range reference in another sheet
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value); // Cell reference in another sheet
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value); // Cell range reference
$value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value); // Simple cell reference
$value = PHPExcel_Calculation::_translateSeparator(';', ',', $value, $inBraces);
}
}
unset($value);
@ -641,9 +628,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL;
}
$colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ?
$cellDataTableAttributes['number-columns-repeated'] : 1;
if ($type !== NULL) {
$colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? $cellDataTableAttributes['number-columns-repeated'] : 1;
if ($type !== null) {
for ($i = 0; $i < $colRepeats; ++$i) {
if ($i > 0) {
++$columnID;
@ -656,12 +642,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo 'Forumla result is '.$dataValue.'<br />';
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue);
}
if ($formatting !== NULL) {
if ($formatting !== null) {
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting);
} else {
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL);
}
if ($hyperlink !== NULL) {
if ($hyperlink !== null) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink);
}
}
@ -699,13 +685,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $objPHPExcel;
}
private function _parseRichText($is = '') {
private function parseRichText($is = '')
{
$value = new PHPExcel_RichText();
$value->createText($is);
return $value;
}
}

View File

@ -49,33 +49,34 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
*
* @var string
*/
private $_inputEncoding = 'ANSI';
private $inputEncoding = 'ANSI';
/**
* Sheet index to read
*
* @var int
*/
private $_sheetIndex = 0;
private $sheetIndex = 0;
/**
* Formats
*
* @var array
*/
private $_formats = array();
private $formats = array();
/**
* Format Count
*
* @var int
*/
private $_format = 0;
private $format = 0;
/**
* Create a new PHPExcel_Reader_SYLK
*/
public function __construct() {
public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
}
@ -92,16 +93,16 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// Count delimiters in file
$delimiterCount = substr_count($data, ';');
if ($delimiterCount < 1) {
return FALSE;
return false;
}
// Analyze first line looking for ID; signature
$lines = explode("\n", $data);
if (substr($lines[0],0,4) != 'ID;P') {
return FALSE;
if (substr($lines[0], 0, 4) != 'ID;P') {
return false;
}
return TRUE;
return true;
}
/**
@ -111,7 +112,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
*/
public function setInputEncoding($pValue = 'ANSI')
{
$this->_inputEncoding = $pValue;
$this->inputEncoding = $pValue;
return $this;
}
@ -122,7 +123,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
*/
public function getInputEncoding()
{
return $this->_inputEncoding;
return $this->inputEncoding;
}
/**
@ -136,7 +137,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// Open file
$this->_openFile($pFilename);
if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle);
fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
}
$fileHandle = $this->_fileHandle;
@ -154,7 +155,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// loop through one row (line) at a time in the file
$rowIndex = 0;
while (($rowData = fgets($fileHandle)) !== FALSE) {
while (($rowData = fgets($fileHandle)) !== false) {
$columnIndex = 0;
// convert SYLK encoded $rowData to UTF-8
@ -162,20 +163,20 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// explode each row at semicolons while taking into account that literal semicolon (;)
// is escaped like this (;;)
$rowData = explode("\t",str_replace('¤',';',str_replace(';',"\t",str_replace(';;','¤',rtrim($rowData)))));
$rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData)))));
$dataType = array_shift($rowData);
if ($dataType == 'C') {
// Read cell value data
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'C' :
case 'X' :
$columnIndex = substr($rowDatum,1) - 1;
case 'C':
case 'X':
$columnIndex = substr($rowDatum, 1) - 1;
break;
case 'R' :
case 'Y' :
$rowIndex = substr($rowDatum,1);
case 'R':
case 'Y':
$rowIndex = substr($rowDatum, 1);
break;
}
@ -223,17 +224,17 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// Open file
$this->_openFile($pFilename);
if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle);
fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
}
$fileHandle = $this->_fileHandle;
rewind($fileHandle);
// Create new PHPExcel
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
$objPHPExcel->createSheet();
}
$objPHPExcel->setActiveSheetIndex( $this->_sheetIndex );
$objPHPExcel->setActiveSheetIndex($this->sheetIndex);
$fromFormats = array('\-', '\ ');
$toFormats = array('-', ' ');
@ -243,14 +244,13 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$column = $row = '';
// 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
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
// explode each row at semicolons while taking into account that literal semicolon (;)
// is escaped like this (;;)
$rowData = explode("\t",str_replace('¤',';',str_replace(';',"\t",str_replace(';;','¤',rtrim($rowData)))));
$rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData)))));
$dataType = array_shift($rowData);
// Read shared styles
@ -258,56 +258,70 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$formatArray = array();
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats,substr($rowDatum,1));
case 'P':
$formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
break;
case 'E' :
case 'F' : $formatArray['font']['name'] = substr($rowDatum,1);
case 'E':
case 'F':
$formatArray['font']['name'] = substr($rowDatum, 1);
break;
case 'L' : $formatArray['font']['size'] = substr($rowDatum,1);
case 'L':
$formatArray['font']['size'] = substr($rowDatum, 1);
break;
case 'S' : $styleSettings = substr($rowDatum,1);
for ($i=0;$i<strlen($styleSettings);++$i) {
case 'S':
$styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) {
case 'I' : $formatArray['font']['italic'] = true;
case 'I':
$formatArray['font']['italic'] = true;
break;
case 'D' : $formatArray['font']['bold'] = true;
case 'D':
$formatArray['font']['bold'] = true;
break;
case 'T' : $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
case 'T':
$formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'B' : $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
case 'B':
$formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'L' : $formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
case 'L':
$formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'R' : $formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
case 'R':
$formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
}
}
break;
}
}
$this->_formats['P'.$this->_format++] = $formatArray;
$this->formats['P'.$this->format++] = $formatArray;
// Read cell value data
} elseif ($dataType == 'C') {
$hasCalculatedValue = false;
$cellData = $cellDataFormula = '';
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'C' :
case 'X' : $column = substr($rowDatum,1);
case 'C':
case 'X':
$column = substr($rowDatum, 1);
break;
case 'R' :
case 'Y' : $row = substr($rowDatum,1);
case 'R':
case 'Y':
$row = substr($rowDatum, 1);
break;
case 'K' : $cellData = substr($rowDatum,1);
case 'K':
$cellData = substr($rowDatum, 1);
break;
case 'E' : $cellDataFormula = '='.substr($rowDatum,1);
case 'E':
$cellDataFormula = '='.substr($rowDatum, 1);
// Convert R1C1 style references to A1 style references (but only when not quoted)
$temp = explode('"', $cellDataFormula);
$key = false;
foreach ($temp as &$value) {
// Only count/replace in alternate array entries
if ($key = !$key) {
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
// through the formula from left to right. Reversing means that we work right to left.through
// the formula
@ -317,17 +331,25 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
foreach ($cellReferences as $cellReference) {
$rowReference = $cellReference[2][0];
// Empty R reference is the current row
if ($rowReference == '') $rowReference = $row;
if ($rowReference == '') {
$rowReference = $row;
}
// Bracketed R references are relative to the current row
if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference,'[]');
if ($rowReference{0} == '[') {
$rowReference = $row + trim($rowReference, '[]');
}
$columnReference = $cellReference[4][0];
// Empty C reference is the current column
if ($columnReference == '') $columnReference = $column;
if ($columnReference == '') {
$columnReference = $column;
}
// Bracketed C references are relative to the current column
if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]');
if ($columnReference{0} == '[') {
$columnReference = $column + trim($columnReference, '[]');
}
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0]));
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
}
}
}
@ -339,12 +361,12 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
}
}
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
$cellData = PHPExcel_Calculation::_unwrapResult($cellData);
$cellData = PHPExcel_Calculation::unwrapResult($cellData);
// Set cell value
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
if ($hasCalculatedValue) {
$cellData = PHPExcel_Calculation::_unwrapResult($cellData);
$cellData = PHPExcel_Calculation::unwrapResult($cellData);
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
}
// Read cell formatting
@ -353,30 +375,41 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$styleData = array();
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'C' :
case 'X' : $column = substr($rowDatum,1);
case 'C':
case 'X':
$column = substr($rowDatum, 1);
break;
case 'R' :
case 'Y' : $row = substr($rowDatum,1);
case 'R':
case 'Y':
$row = substr($rowDatum, 1);
break;
case 'P' : $formatStyle = $rowDatum;
case 'P':
$formatStyle = $rowDatum;
break;
case 'W' : list($startCol, $endCol, $columnWidth) = explode(' ',substr($rowDatum,1));
case 'W':
list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1));
break;
case 'S' : $styleSettings = substr($rowDatum,1);
for ($i=0;$i<strlen($styleSettings);++$i) {
case 'S':
$styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) {
case 'I' : $styleData['font']['italic'] = true;
case 'I':
$styleData['font']['italic'] = true;
break;
case 'D' : $styleData['font']['bold'] = true;
case 'D':
$styleData['font']['bold'] = true;
break;
case 'T' : $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
case 'T':
$styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'B' : $styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
case 'B':
$styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'L' : $styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
case 'L':
$styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'R' : $styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
case 'R':
$styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
}
}
@ -385,8 +418,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
}
if (($formatStyle > '') && ($column > '') && ($row > '')) {
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
if (isset($this->_formats[$formatStyle])) {
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]);
if (isset($this->formats[$formatStyle])) {
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]);
}
}
if ((!empty($styleData)) && ($column > '') && ($row > '')) {
@ -409,11 +442,13 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
} else {
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'C' :
case 'X' : $column = substr($rowDatum,1);
case 'C':
case 'X':
$column = substr($rowDatum, 1);
break;
case 'R' :
case 'Y' : $row = substr($rowDatum,1);
case 'R':
case 'Y':
$row = substr($rowDatum, 1);
break;
}
}
@ -432,8 +467,9 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
*
* @return int
*/
public function getSheetIndex() {
return $this->_sheetIndex;
public function getSheetIndex()
{
return $this->sheetIndex;
}
/**
@ -442,9 +478,9 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
* @param int $pValue Sheet index
* @return PHPExcel_Reader_SYLK
*/
public function setSheetIndex($pValue = 0) {
$this->_sheetIndex = $pValue;
public function setSheetIndex($pValue = 0)
{
$this->sheetIndex = $pValue;
return $this;
}
}

View File

@ -39,7 +39,7 @@ class PHPExcel_ReferenceHelper
*
* @var PHPExcel_ReferenceHelper
*/
private static $_instance;
private static $instance;
/**
* Get an instance of this class
@ -48,11 +48,11 @@ class PHPExcel_ReferenceHelper
*/
public static function getInstance()
{
if (!isset(self::$_instance) || (self::$_instance === null)) {
self::$_instance = new PHPExcel_ReferenceHelper();
if (!isset(self::$instance) || (self::$instance === null)) {
self::$instance = new PHPExcel_ReferenceHelper();
}
return self::$_instance;
return self::$instance;
}
/**
@ -163,7 +163,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
protected function adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aBreaks = $pSheet->getBreaks();
($pNumCols > 0 || $pNumRows > 0) ?
@ -197,7 +197,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
protected function adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aComments = $pSheet->getComments();
$aNewComments = array(); // the new array of all comments
@ -224,7 +224,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
protected function adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
@ -248,7 +248,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
protected function adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aDataValidationCollection = $pSheet->getDataValidationCollection();
($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
@ -272,7 +272,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
protected function adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aMergeCells = $pSheet->getMergeCells();
$aNewMergeCells = array(); // the new array of all merge cells
@ -293,7 +293,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
protected function adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aProtectedCells = $pSheet->getProtectedCells();
($pNumCols > 0 || $pNumRows > 0) ?
@ -318,7 +318,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
protected function adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
if (!empty($aColumnDimensions)) {
@ -343,7 +343,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
if (!empty($aRowDimensions)) {
@ -513,28 +513,28 @@ class PHPExcel_ReferenceHelper
}
// Update worksheet: column dimensions
$this->_adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
$this->adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: row dimensions
$this->_adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
$this->adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: page breaks
$this->_adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
$this->adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: comments
$this->_adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
$this->adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: hyperlinks
$this->_adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
$this->adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: data validations
$this->_adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
$this->adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: merge cells
$this->_adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
$this->adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: protected cells
$this->_adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
$this->adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: autofilter
$autoFilter = $pSheet->getAutoFilter();
@ -662,7 +662,7 @@ class PHPExcel_ReferenceHelper
$toString .= $modified3.':'.$modified4;
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
$column = 100000;
$row = 10000000 + trim($match[3],'$');
$row = 10000000 + trim($match[3], '$');
$cellIndex = $column.$row;
$newCellTokens[$cellIndex] = preg_quote($toString);
@ -785,10 +785,10 @@ class PHPExcel_ReferenceHelper
// Is it a range or a single cell?
} elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) {
// Single cell
return $this->_updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows);
return $this->updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows);
} elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
// Range
return $this->_updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows);
return $this->updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows);
} else {
// Return original
return $pCellRange;
@ -833,7 +833,7 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell range
* @throws PHPExcel_Exception
*/
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
private function updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
// Update range
@ -843,13 +843,13 @@ class PHPExcel_ReferenceHelper
$jc = count($range[$i]);
for ($j = 0; $j < $jc; ++$j) {
if (ctype_alpha($range[$i][$j])) {
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
$r = PHPExcel_Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
$range[$i][$j] = $r[0];
} elseif (ctype_digit($range[$i][$j])) {
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
$r = PHPExcel_Cell::coordinateFromString($this->updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
$range[$i][$j] = $r[1];
} else {
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
$range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
}
}
}
@ -871,7 +871,7 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell reference
* @throws PHPExcel_Exception
*/
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
// Get coordinates of $pBefore

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_Escher
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Escher
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher
{
/**
@ -39,14 +32,14 @@ class PHPExcel_Shared_Escher
*
* @var PHPExcel_Shared_Escher_DggContainer
*/
private $_dggContainer;
private $dggContainer;
/**
* Drawing Container
*
* @var PHPExcel_Shared_Escher_DgContainer
*/
private $_dgContainer;
private $dgContainer;
/**
* Get Drawing Group Container
@ -55,7 +48,7 @@ class PHPExcel_Shared_Escher
*/
public function getDggContainer()
{
return $this->_dggContainer;
return $this->dggContainer;
}
/**
@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher
*/
public function setDggContainer($dggContainer)
{
return $this->_dggContainer = $dggContainer;
return $this->dggContainer = $dggContainer;
}
/**
@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher
*/
public function getDgContainer()
{
return $this->_dgContainer;
return $this->dgContainer;
}
/**
@ -85,6 +78,6 @@ class PHPExcel_Shared_Escher
*/
public function setDgContainer($dgContainer)
{
return $this->_dgContainer = $dgContainer;
return $this->dgContainer = $dgContainer;
}
}

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_Escher_DgContainer
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Escher_DgContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DgContainer
{
/**
@ -39,44 +32,44 @@ class PHPExcel_Shared_Escher_DgContainer
*
* @var int
*/
private $_dgId;
private $dgId;
/**
* Last shape index in this drawing
*
* @var int
*/
private $_lastSpId;
private $lastSpId;
private $_spgrContainer = null;
private $spgrContainer = null;
public function getDgId()
{
return $this->_dgId;
return $this->dgId;
}
public function setDgId($value)
{
$this->_dgId = $value;
$this->dgId = $value;
}
public function getLastSpId()
{
return $this->_lastSpId;
return $this->lastSpId;
}
public function setLastSpId($value)
{
$this->_lastSpId = $value;
$this->lastSpId = $value;
}
public function getSpgrContainer()
{
return $this->_spgrContainer;
return $this->spgrContainer;
}
public function setSpgrContainer($spgrContainer)
{
return $this->_spgrContainer = $spgrContainer;
return $this->spgrContainer = $spgrContainer;
}
}

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
{
/**
@ -39,14 +32,14 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/
private $_parent;
private $parent;
/**
* Shape Container collection
*
* @var array
*/
private $_children = array();
private $children = array();
/**
* Set parent Shape Group Container
@ -55,7 +48,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/
public function setParent($parent)
{
$this->_parent = $parent;
$this->parent = $parent;
}
/**
@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/
public function getParent()
{
return $this->_parent;
return $this->parent;
}
/**
@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/
public function addChild($child)
{
$this->_children[] = $child;
$this->children[] = $child;
$child->setParent($this);
}
@ -84,7 +77,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/
public function getChildren()
{
return $this->_children;
return $this->children;
}
/**
@ -96,7 +89,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
{
$allSpContainers = array();
foreach ($this->_children as $child) {
foreach ($this->children as $child) {
if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
$allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers());
} else {

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
{
/**
@ -39,84 +32,84 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/
private $_parent;
private $parent;
/**
* Is this a group shape?
*
* @var boolean
*/
private $_spgr = false;
private $spgr = false;
/**
* Shape type
*
* @var int
*/
private $_spType;
private $spType;
/**
* Shape flag
*
* @var int
*/
private $_spFlag;
private $spFlag;
/**
* Shape index (usually group shape has index 0, and the rest: 1,2,3...)
*
* @var boolean
*/
private $_spId;
private $spId;
/**
* Array of options
*
* @var array
*/
private $_OPT;
private $OPT;
/**
* Cell coordinates of upper-left corner of shape, e.g. 'A1'
*
* @var string
*/
private $_startCoordinates;
private $startCoordinates;
/**
* Horizontal offset of upper-left corner of shape measured in 1/1024 of column width
*
* @var int
*/
private $_startOffsetX;
private $startOffsetX;
/**
* Vertical offset of upper-left corner of shape measured in 1/256 of row height
*
* @var int
*/
private $_startOffsetY;
private $startOffsetY;
/**
* Cell coordinates of bottom-right corner of shape, e.g. 'B2'
*
* @var string
*/
private $_endCoordinates;
private $endCoordinates;
/**
* Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width
*
* @var int
*/
private $_endOffsetX;
private $endOffsetX;
/**
* Vertical offset of bottom-right corner of shape measured in 1/256 of row height
*
* @var int
*/
private $_endOffsetY;
private $endOffsetY;
/**
* Set parent Shape Group Container
@ -125,7 +118,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setParent($parent)
{
$this->_parent = $parent;
$this->parent = $parent;
}
/**
@ -135,7 +128,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getParent()
{
return $this->_parent;
return $this->parent;
}
/**
@ -145,7 +138,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setSpgr($value = false)
{
$this->_spgr = $value;
$this->spgr = $value;
}
/**
@ -155,7 +148,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getSpgr()
{
return $this->_spgr;
return $this->spgr;
}
/**
@ -165,7 +158,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setSpType($value)
{
$this->_spType = $value;
$this->spType = $value;
}
/**
@ -175,7 +168,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getSpType()
{
return $this->_spType;
return $this->spType;
}
/**
@ -185,7 +178,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setSpFlag($value)
{
$this->_spFlag = $value;
$this->spFlag = $value;
}
/**
@ -195,7 +188,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getSpFlag()
{
return $this->_spFlag;
return $this->spFlag;
}
/**
@ -205,7 +198,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setSpId($value)
{
$this->_spId = $value;
$this->spId = $value;
}
/**
@ -215,7 +208,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getSpId()
{
return $this->_spId;
return $this->spId;
}
/**
@ -226,7 +219,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setOPT($property, $value)
{
$this->_OPT[$property] = $value;
$this->OPT[$property] = $value;
}
/**
@ -237,8 +230,8 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getOPT($property)
{
if (isset($this->_OPT[$property])) {
return $this->_OPT[$property];
if (isset($this->OPT[$property])) {
return $this->OPT[$property];
}
return null;
}
@ -250,7 +243,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getOPTCollection()
{
return $this->_OPT;
return $this->OPT;
}
/**
@ -260,7 +253,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setStartCoordinates($value = 'A1')
{
$this->_startCoordinates = $value;
$this->startCoordinates = $value;
}
/**
@ -270,7 +263,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getStartCoordinates()
{
return $this->_startCoordinates;
return $this->startCoordinates;
}
/**
@ -280,7 +273,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setStartOffsetX($startOffsetX = 0)
{
$this->_startOffsetX = $startOffsetX;
$this->startOffsetX = $startOffsetX;
}
/**
@ -290,7 +283,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getStartOffsetX()
{
return $this->_startOffsetX;
return $this->startOffsetX;
}
/**
@ -300,7 +293,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setStartOffsetY($startOffsetY = 0)
{
$this->_startOffsetY = $startOffsetY;
$this->startOffsetY = $startOffsetY;
}
/**
@ -310,7 +303,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getStartOffsetY()
{
return $this->_startOffsetY;
return $this->startOffsetY;
}
/**
@ -320,7 +313,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setEndCoordinates($value = 'A1')
{
$this->_endCoordinates = $value;
$this->endCoordinates = $value;
}
/**
@ -330,7 +323,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getEndCoordinates()
{
return $this->_endCoordinates;
return $this->endCoordinates;
}
/**
@ -340,7 +333,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setEndOffsetX($endOffsetX = 0)
{
$this->_endOffsetX = $endOffsetX;
$this->endOffsetX = $endOffsetX;
}
/**
@ -350,7 +343,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getEndOffsetX()
{
return $this->_endOffsetX;
return $this->endOffsetX;
}
/**
@ -360,7 +353,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function setEndOffsetY($endOffsetY = 0)
{
$this->_endOffsetY = $endOffsetY;
$this->endOffsetY = $endOffsetY;
}
/**
@ -370,7 +363,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/
public function getEndOffsetY()
{
return $this->_endOffsetY;
return $this->endOffsetY;
}
/**

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_Escher_DggContainer
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Escher_DggContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer
{
/**
@ -39,42 +32,42 @@ class PHPExcel_Shared_Escher_DggContainer
*
* @var int
*/
private $_spIdMax;
private $spIdMax;
/**
* Total number of drawings saved
*
* @var int
*/
private $_cDgSaved;
private $cDgSaved;
/**
* Total number of shapes saved (including group shapes)
*
* @var int
*/
private $_cSpSaved;
private $cSpSaved;
/**
* BLIP Store Container
*
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/
private $_bstoreContainer;
private $bstoreContainer;
/**
* Array of options for the drawing group
*
* @var array
*/
private $_OPT = array();
private $OPT = array();
/**
* Array of identifier clusters containg information about the maximum shape identifiers
*
* @var array
*/
private $_IDCLs = array();
private $IDCLs = array();
/**
* Get maximum shape index of all shapes in all drawings (plus one)
@ -83,7 +76,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function getSpIdMax()
{
return $this->_spIdMax;
return $this->spIdMax;
}
/**
@ -93,7 +86,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function setSpIdMax($value)
{
$this->_spIdMax = $value;
$this->spIdMax = $value;
}
/**
@ -103,7 +96,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function getCDgSaved()
{
return $this->_cDgSaved;
return $this->cDgSaved;
}
/**
@ -113,7 +106,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function setCDgSaved($value)
{
$this->_cDgSaved = $value;
$this->cDgSaved = $value;
}
/**
@ -123,7 +116,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function getCSpSaved()
{
return $this->_cSpSaved;
return $this->cSpSaved;
}
/**
@ -133,7 +126,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function setCSpSaved($value)
{
$this->_cSpSaved = $value;
$this->cSpSaved = $value;
}
/**
@ -143,7 +136,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function getBstoreContainer()
{
return $this->_bstoreContainer;
return $this->bstoreContainer;
}
/**
@ -153,7 +146,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function setBstoreContainer($bstoreContainer)
{
$this->_bstoreContainer = $bstoreContainer;
$this->bstoreContainer = $bstoreContainer;
}
/**
@ -164,7 +157,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function setOPT($property, $value)
{
$this->_OPT[$property] = $value;
$this->OPT[$property] = $value;
}
/**
@ -175,8 +168,8 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function getOPT($property)
{
if (isset($this->_OPT[$property])) {
return $this->_OPT[$property];
if (isset($this->OPT[$property])) {
return $this->OPT[$property];
}
return null;
}
@ -188,7 +181,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function getIDCLs()
{
return $this->_IDCLs;
return $this->IDCLs;
}
/**
@ -198,6 +191,6 @@ class PHPExcel_Shared_Escher_DggContainer
*/
public function setIDCLs($pValue)
{
$this->_IDCLs = $pValue;
$this->IDCLs = $pValue;
}
}

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
{
/**
@ -39,7 +32,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*
* @var array
*/
private $_BSECollection = array();
private $BSECollection = array();
/**
* Add a BLIP Store Entry
@ -48,7 +41,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/
public function addBSE($BSE)
{
$this->_BSECollection[] = $BSE;
$this->BSECollection[] = $BSE;
$BSE->setParent($this);
}
@ -59,6 +52,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/
public function getBSECollection()
{
return $this->_BSECollection;
return $this->BSECollection;
}
}

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
{
const BLIPTYPE_ERROR = 0x00;
@ -57,14 +50,14 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/
private $_blip;
private $blip;
/**
* The BLIP type
*
* @var int
*/
private $_blipType;
private $blipType;
/**
* Set parent BLIP Store Entry Container
@ -83,7 +76,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/
public function getBlip()
{
return $this->_blip;
return $this->blip;
}
/**
@ -93,7 +86,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/
public function setBlip($blip)
{
$this->_blip = $blip;
$this->blip = $blip;
$blip->setParent($this);
}
@ -104,7 +97,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/
public function getBlipType()
{
return $this->_blipType;
return $this->blipType;
}
/**
@ -114,6 +107,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/
public function setBlipType($blipType)
{
$this->_blipType = $blipType;
$this->blipType = $blipType;
}
}

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
{
/**
@ -39,14 +32,14 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/
private $_parent;
private $parent;
/**
* Raw image data
*
* @var string
*/
private $_data;
private $data;
/**
* Get the raw image data
@ -55,7 +48,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/
public function getData()
{
return $this->_data;
return $this->data;
}
/**
@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/
public function setData($data)
{
$this->_data = $data;
$this->data = $data;
}
/**
@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/
public function setParent($parent)
{
$this->_parent = $parent;
$this->parent = $parent;
}
/**
@ -85,6 +78,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/
public function getParent()
{
return $this->_parent;
return $this->parent;
}
}

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Shared_Excel5
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Excel5
*
* @category PHPExcel
* @package PHPExcel_Shared
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Excel5
{
/**
@ -56,7 +49,7 @@ class PHPExcel_Shared_Excel5
$columnDimension = $columnDimensions[$col];
$width = $columnDimension->getWidth();
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
} else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
} elseif ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
// then we have default column dimension with explicit width
$defaultColumnDimension = $sheet->getDefaultColumnDimension();
$width = $defaultColumnDimension->getWidth();
@ -98,7 +91,7 @@ class PHPExcel_Shared_Excel5
$rowDimension = $rowDimensions[$row];
$rowHeight = $rowDimension->getRowHeight();
$pixelRowHeight = (int) ceil(4 * $rowHeight / 3); // here we assume Arial 10
} else if ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
} elseif ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
// then we have a default row dimension with explicit height
$defaultRowDimension = $sheet->getDefaultRowDimension();
$rowHeight = $defaultRowDimension->getRowHeight();

View File

@ -39,7 +39,7 @@ class PHPExcel_Shared_Font
const AUTOSIZE_METHOD_APPROX = 'approx';
const AUTOSIZE_METHOD_EXACT = 'exact';
private static $_autoSizeMethods = array(
private static $autoSizeMethods = array(
self::AUTOSIZE_METHOD_APPROX,
self::AUTOSIZE_METHOD_EXACT,
);
@ -196,7 +196,7 @@ class PHPExcel_Shared_Font
*/
public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX)
{
if (!in_array($pValue, self::$_autoSizeMethods)) {
if (!in_array($pValue, self::$autoSizeMethods)) {
return false;
}
self::$autoSizeMethod = $pValue;

View File

@ -15,8 +15,8 @@
* @author Michael Bommarito
* @version 1.2
*/
class CholeskyDecomposition {
class CholeskyDecomposition
{
/**
* Decomposition storage
* @var array
@ -38,21 +38,21 @@ class CholeskyDecomposition {
*/
private $isspd = true;
/**
* CholeskyDecomposition
*
* Class constructor - decomposes symmetric positive definite matrix
* @param mixed Matrix square symmetric positive definite matrix
*/
public function __construct($A = null) {
public function __construct($A = null)
{
if ($A instanceof Matrix) {
$this->L = $A->getArray();
$this->m = $A->getRowDimension();
for($i = 0; $i < $this->m; ++$i) {
for($j = $i; $j < $this->m; ++$j) {
for($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) {
for ($i = 0; $i < $this->m; ++$i) {
for ($j = $i; $j < $this->m; ++$j) {
for ($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) {
$sum -= $this->L[$i][$k] * $this->L[$j][$k];
}
if ($i == $j) {
@ -77,35 +77,35 @@ class CholeskyDecomposition {
}
} // function __construct()
/**
* Is the matrix symmetric and positive definite?
*
* @return boolean
*/
public function isSPD() {
public function isSPD()
{
return $this->isspd;
} // function isSPD()
/**
* getL
*
* Return triangular factor.
* @return Matrix Lower triangular matrix
*/
public function getL() {
public function getL()
{
return new Matrix($this->L);
} // function getL()
/**
* Solve A*X = B
*
* @param $B Row-equal matrix
* @return Matrix L * L' * X = B
*/
public function solve($B = null) {
public function solve($B = null)
{
if ($B instanceof Matrix) {
if ($B->getRowDimension() == $this->m) {
if ($this->isspd) {
@ -145,5 +145,4 @@ class CholeskyDecomposition {
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
}
} // function solve()
} // class CholeskyDecomposition
}

View File

@ -21,8 +21,8 @@
* @license PHP v3.0
* @version 1.1
*/
class EigenvalueDecomposition {
class EigenvalueDecomposition
{
/**
* Row and column dimension (square matrix).
* @var int
@ -67,13 +67,13 @@ class EigenvalueDecomposition {
private $cdivr;
private $cdivi;
/**
* Symmetric Householder reduction to tridiagonal form.
*
* @access private
*/
private function tred2 () {
private function tred2()
{
// This is derived from the Algol procedures tred2 by
// Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
// Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
@ -171,7 +171,6 @@ class EigenvalueDecomposition {
$this->e[0] = 0.0;
}
/**
* Symmetric tridiagonal QL algorithm.
*
@ -182,22 +181,24 @@ class EigenvalueDecomposition {
*
* @access private
*/
private function tql2() {
private function tql2()
{
for ($i = 1; $i < $this->n; ++$i) {
$this->e[$i-1] = $this->e[$i];
}
$this->e[$this->n-1] = 0.0;
$f = 0.0;
$tst1 = 0.0;
$eps = pow(2.0,-52.0);
$eps = pow(2.0, -52.0);
for ($l = 0; $l < $this->n; ++$l) {
// Find small subdiagonal element
$tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l]));
$m = $l;
while ($m < $this->n) {
if (abs($this->e[$m]) <= $eps * $tst1)
if (abs($this->e[$m]) <= $eps * $tst1) {
break;
}
++$m;
}
// If m == l, $this->d[l] is an eigenvalue,
@ -211,14 +212,16 @@ class EigenvalueDecomposition {
$g = $this->d[$l];
$p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]);
$r = hypo($p, 1.0);
if ($p < 0)
if ($p < 0) {
$r *= -1;
}
$this->d[$l] = $this->e[$l] / ($p + $r);
$this->d[$l+1] = $this->e[$l] * ($p + $r);
$dl1 = $this->d[$l+1];
$h = $g - $this->d[$l];
for ($i = $l + 2; $i < $this->n; ++$i)
for ($i = $l + 2; $i < $this->n; ++$i) {
$this->d[$i] -= $h;
}
$f += $h;
// Implicit QL transformation.
$p = $this->d[$m];
@ -277,7 +280,6 @@ class EigenvalueDecomposition {
}
}
/**
* Nonsymmetric reduction to Hessenberg form.
*
@ -288,7 +290,8 @@ class EigenvalueDecomposition {
*
* @access private
*/
private function orthes () {
private function orthes()
{
$low = 0;
$high = $this->n-1;
@ -364,13 +367,13 @@ class EigenvalueDecomposition {
}
}
/**
* Performs complex division.
*
* @access private
*/
private function cdiv($xr, $xi, $yr, $yi) {
private function cdiv($xr, $xi, $yr, $yi)
{
if (abs($yr) > abs($yi)) {
$r = $yi / $yr;
$d = $yr + $r * $yi;
@ -384,7 +387,6 @@ class EigenvalueDecomposition {
}
}
/**
* Nonsymmetric reduction from Hessenberg to real Schur form.
*
@ -395,7 +397,8 @@ class EigenvalueDecomposition {
*
* @access private
*/
private function hqr2 () {
private function hqr2()
{
// Initialize
$nn = $this->n;
$n = $nn - 1;
@ -408,7 +411,7 @@ class EigenvalueDecomposition {
$norm = 0.0;
for ($i = 0; $i < $nn; ++$i) {
if (($i < $low) OR ($i > $high)) {
if (($i < $low) or ($i > $high)) {
$this->d[$i] = $this->H[$i][$i];
$this->e[$i] = 0.0;
}
@ -441,7 +444,7 @@ class EigenvalueDecomposition {
--$n;
$iter = 0;
// Two roots found
} else if ($l == $n-1) {
} elseif ($l == $n-1) {
$w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
$p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0;
$q = $p * $p + $w;
@ -477,7 +480,7 @@ class EigenvalueDecomposition {
$this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z;
}
// Column modification
for ($i = 0; $i <= n; ++$i) {
for ($i = 0; $i <= $n; ++$i) {
$z = $this->H[$i][$n-1];
$this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n];
$this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z;
@ -684,7 +687,7 @@ class EigenvalueDecomposition {
}
}
// Complex vector
} else if ($q < 0) {
} elseif ($q < 0) {
$l = $n-1;
// Last vector component imaginary so matrix is triangular
if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) {
@ -738,7 +741,7 @@ class EigenvalueDecomposition {
}
}
// Overflow control
$t = max(abs($this->H[$i][$n-1]),abs($this->H[$i][$n]));
$t = max(abs($this->H[$i][$n-1]), abs($this->H[$i][$n]));
if (($eps * $t) * $t > 1) {
for ($j = $i; $j <= $n; ++$j) {
$this->H[$j][$n-1] = $this->H[$j][$n-1] / $t;
@ -771,7 +774,6 @@ class EigenvalueDecomposition {
}
} // end hqr2
/**
* Constructor: Check for symmetry, then construct the eigenvalue decomposition
*
@ -779,7 +781,8 @@ class EigenvalueDecomposition {
* @param A Square matrix
* @return Structure to access D and V.
*/
public function __construct($Arg) {
public function __construct($Arg)
{
$this->A = $Arg->getArray();
$this->n = $Arg->getColumnDimension();
@ -806,47 +809,47 @@ class EigenvalueDecomposition {
}
}
/**
* Return the eigenvector matrix
*
* @access public
* @return V
*/
public function getV() {
public function getV()
{
return new Matrix($this->V, $this->n, $this->n);
}
/**
* Return the real parts of the eigenvalues
*
* @access public
* @return real(diag(D))
*/
public function getRealEigenvalues() {
public function getRealEigenvalues()
{
return $this->d;
}
/**
* Return the imaginary parts of the eigenvalues
*
* @access public
* @return imag(diag(D))
*/
public function getImagEigenvalues() {
public function getImagEigenvalues()
{
return $this->e;
}
/**
* Return the block diagonal eigenvalue matrix
*
* @access public
* @return D
*/
public function getD() {
public function getD()
{
for ($i = 0; $i < $this->n; ++$i) {
$D[$i] = array_fill(0, $this->n, 0.0);
$D[$i][$i] = $this->d[$i];
@ -858,5 +861,4 @@ class EigenvalueDecomposition {
}
return new Matrix($D);
}
} // class EigenvalueDecomposition
}

View File

@ -18,8 +18,8 @@
* @version 1.1
* @license PHP v3.0
*/
class PHPExcel_Shared_JAMA_LUDecomposition {
class PHPExcel_Shared_JAMA_LUDecomposition
{
const MatrixSingularException = "Can only perform operation on singular matrix.";
const MatrixSquareException = "Mismatched Row dimension";
@ -53,14 +53,14 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
*/
private $piv = array();
/**
* LU Decomposition constructor.
*
* @param $A Rectangular matrix
* @return Structure to access L, U and piv.
*/
public function __construct($A) {
public function __construct($A)
{
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
// Use a "left-looking", dot-product, Crout/Doolittle algorithm.
$this->LU = $A->getArray();
@ -119,13 +119,13 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
}
} // function __construct()
/**
* Get lower triangular factor.
*
* @return array Lower triangular factor
*/
public function getL() {
public function getL()
{
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
if ($i > $j) {
@ -140,13 +140,13 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($L);
} // function getL()
/**
* Get upper triangular factor.
*
* @return array Upper triangular factor
*/
public function getU() {
public function getU()
{
for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
if ($i <= $j) {
@ -159,33 +159,33 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($U);
} // function getU()
/**
* Return pivot permutation vector.
*
* @return array Pivot vector
*/
public function getPivot() {
public function getPivot()
{
return $this->piv;
} // function getPivot()
/**
* Alias for getPivot
*
* @see getPivot
*/
public function getDoublePivot() {
public function getDoublePivot()
{
return $this->getPivot();
} // function getDoublePivot()
/**
* Is the matrix nonsingular?
*
* @return true if U, and hence A, is nonsingular.
*/
public function isNonsingular() {
public function isNonsingular()
{
for ($j = 0; $j < $this->n; ++$j) {
if ($this->LU[$j][$j] == 0) {
return false;
@ -194,13 +194,13 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
return true;
} // function isNonsingular()
/**
* Count determinants
*
* @return array d matrix deterninat
*/
public function det() {
public function det()
{
if ($this->m == $this->n) {
$d = $this->pivsign;
for ($j = 0; $j < $this->n; ++$j) {
@ -212,7 +212,6 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
}
} // function det()
/**
* Solve A*X = B
*
@ -221,7 +220,8 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
* @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree.
* @PHPExcel_Calculation_Exception RuntimeException Matrix is singular.
*/
public function solve($B) {
public function solve($B)
{
if ($B->getRowDimension() == $this->m) {
if ($this->isNonsingular()) {
// Copy right hand side with pivoting
@ -254,5 +254,4 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
throw new PHPExcel_Calculation_Exception(self::MatrixSquareException);
}
} // function solve()
} // class PHPExcel_Shared_JAMA_LUDecomposition
}

View File

@ -24,9 +24,8 @@ if (!defined('PHPEXCEL_ROOT')) {
* @license PHP v3.0
* @see http://math.nist.gov/javanumerics/jama/
*/
class PHPExcel_Shared_JAMA_Matrix {
class PHPExcel_Shared_JAMA_Matrix
{
const PolymorphicArgumentException = "Invalid argument pattern for polymorphic function.";
const ArgumentTypeException = "Invalid argument type.";
const ArgumentBoundsException = "Invalid argument range.";
@ -57,13 +56,13 @@ class PHPExcel_Shared_JAMA_Matrix {
*/
private $n;
/**
* Polymorphic constructor
*
* As PHP has no support for polymorphic constructors, we hack our own sort of polymorphism using func_num_args, func_get_arg, and gettype. In essence, we're just implementing a simple RTTI filter and calling the appropriate constructor.
*/
public function __construct() {
public function __construct()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
@ -96,8 +95,8 @@ class PHPExcel_Shared_JAMA_Matrix {
$this->n = 0;
}
if (($this->m * $this->n) == count($args[0])) {
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$this->A[$i][$j] = $args[0][$i + $j * $this->m];
}
}
@ -114,37 +113,36 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function __construct()
/**
* getArray
*
* @return array Matrix array
*/
public function getArray() {
public function getArray()
{
return $this->A;
} // function getArray()
/**
* getRowDimension
*
* @return int Row dimension
*/
public function getRowDimension() {
public function getRowDimension()
{
return $this->m;
} // function getRowDimension()
/**
* getColumnDimension
*
* @return int Column dimension
*/
public function getColumnDimension() {
public function getColumnDimension()
{
return $this->n;
} // function getColumnDimension()
/**
* get
*
@ -153,11 +151,11 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $j Column position
* @return mixed Element (int/float/double)
*/
public function get($i = null, $j = null) {
public function get($i = null, $j = null)
{
return $this->A[$i][$j];
} // function get()
/**
* getMatrix
*
@ -168,7 +166,8 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $jF Final column index
* @return Matrix Submatrix
*/
public function getMatrix() {
public function getMatrix()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
@ -177,11 +176,19 @@ class PHPExcel_Shared_JAMA_Matrix {
//A($i0...; $j0...)
case 'integer,integer':
list($i0, $j0) = $args;
if ($i0 >= 0) { $m = $this->m - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if ($j0 >= 0) { $n = $this->n - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if ($i0 >= 0) {
$m = $this->m - $i0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if ($j0 >= 0) {
$n = $this->n - $j0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = $i0; $i < $this->m; ++$i) {
for($j = $j0; $j < $this->n; ++$j) {
for ($i = $i0; $i < $this->m; ++$i) {
for ($j = $j0; $j < $this->n; ++$j) {
$R->set($i, $j, $this->A[$i][$j]);
}
}
@ -190,11 +197,19 @@ class PHPExcel_Shared_JAMA_Matrix {
//A($i0...$iF; $j0...$jF)
case 'integer,integer,integer,integer':
list($i0, $iF, $j0, $jF) = $args;
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
$m = $iF - $i0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) {
$n = $jF - $j0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1);
for($i = $i0; $i <= $iF; ++$i) {
for($j = $j0; $j <= $jF; ++$j) {
for ($i = $i0; $i <= $iF; ++$i) {
for ($j = $j0; $j <= $jF; ++$j) {
$R->set($i - $i0, $j - $j0, $this->A[$i][$j]);
}
}
@ -203,11 +218,19 @@ class PHPExcel_Shared_JAMA_Matrix {
//$R = array of row indices; $C = array of column indices
case 'array,array':
list($RL, $CL) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (count($RL) > 0) {
$m = count($RL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (count($CL) > 0) {
$n = count($CL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = 0; $i < $m; ++$i) {
for($j = 0; $j < $n; ++$j) {
for ($i = 0; $i < $m; ++$i) {
for ($j = 0; $j < $n; ++$j) {
$R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]);
}
}
@ -216,11 +239,19 @@ class PHPExcel_Shared_JAMA_Matrix {
//$RL = array of row indices; $CL = array of column indices
case 'array,array':
list($RL, $CL) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (count($RL) > 0) {
$m = count($RL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (count($CL) > 0) {
$n = count($CL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = 0; $i < $m; ++$i) {
for($j = 0; $j < $n; ++$j) {
for ($i = 0; $i < $m; ++$i) {
for ($j = 0; $j < $n; ++$j) {
$R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]);
}
}
@ -229,11 +260,19 @@ class PHPExcel_Shared_JAMA_Matrix {
//A($i0...$iF); $CL = array of column indices
case 'integer,integer,array':
list($i0, $iF, $CL) = $args;
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
$m = $iF - $i0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (count($CL) > 0) {
$n = count($CL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = $i0; $i < $iF; ++$i) {
for($j = 0; $j < $n; ++$j) {
for ($i = $i0; $i < $iF; ++$i) {
for ($j = 0; $j < $n; ++$j) {
$R->set($i - $i0, $j, $this->A[$RL[$i]][$j]);
}
}
@ -242,11 +281,19 @@ class PHPExcel_Shared_JAMA_Matrix {
//$RL = array of row indices
case 'array,integer,integer':
list($RL, $j0, $jF) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
if (count($RL) > 0) {
$m = count($RL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) {
$n = $jF - $j0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n+1);
for($i = 0; $i < $m; ++$i) {
for($j = $j0; $j <= $jF; ++$j) {
for ($i = 0; $i < $m; ++$i) {
for ($j = $j0; $j <= $jF; ++$j) {
$R->set($i, $j - $j0, $this->A[$RL[$i]][$j]);
}
}
@ -261,7 +308,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function getMatrix()
/**
* checkMatrixDimensions
*
@ -269,7 +315,8 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param Matrix $B Matrix B
* @return boolean
*/
public function checkMatrixDimensions($B = null) {
public function checkMatrixDimensions($B = null)
{
if ($B instanceof PHPExcel_Shared_JAMA_Matrix) {
if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) {
return true;
@ -281,8 +328,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function checkMatrixDimensions()
/**
* set
*
@ -292,12 +337,12 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $c Int/float/double value
* @return mixed Element (int/float/double)
*/
public function set($i = null, $j = null, $c = null) {
public function set($i = null, $j = null, $c = null)
{
// Optimized set version just has this
$this->A[$i][$j] = $c;
} // function set()
/**
* identity
*
@ -306,11 +351,11 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $n Column dimension
* @return Matrix Identity matrix
*/
public function identity($m = null, $n = null) {
public function identity($m = null, $n = null)
{
return $this->diagonal($m, $n, 1);
} // function identity()
/**
* diagonal
*
@ -320,15 +365,15 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $c Diagonal value
* @return Matrix Diagonal matrix
*/
public function diagonal($m = null, $n = null, $c = 1) {
public function diagonal($m = null, $n = null, $c = 1)
{
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = 0; $i < $m; ++$i) {
for ($i = 0; $i < $m; ++$i) {
$R->set($i, $i, $c);
}
return $R;
} // function diagonal()
/**
* getMatrixByRow
*
@ -337,7 +382,8 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $iF Final row index
* @return Matrix Submatrix
*/
public function getMatrixByRow($i0 = null, $iF = null) {
public function getMatrixByRow($i0 = null, $iF = null)
{
if (is_int($i0)) {
if (is_int($iF)) {
return $this->getMatrix($i0, 0, $iF + 1, $this->n);
@ -349,7 +395,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function getMatrixByRow()
/**
* getMatrixByCol
*
@ -358,7 +403,8 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $iF Final column index
* @return Matrix Submatrix
*/
public function getMatrixByCol($j0 = null, $jF = null) {
public function getMatrixByCol($j0 = null, $jF = null)
{
if (is_int($j0)) {
if (is_int($jF)) {
return $this->getMatrix(0, $j0, $this->m, $jF + 1);
@ -370,50 +416,49 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function getMatrixByCol()
/**
* transpose
*
* Tranpose matrix
* @return Matrix Transposed matrix
*/
public function transpose() {
public function transpose()
{
$R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$R->set($j, $i, $this->A[$i][$j]);
}
}
return $R;
} // function transpose()
/**
* trace
*
* Sum of diagonal elements
* @return float Sum of diagonal elements
*/
public function trace() {
public function trace()
{
$s = 0;
$n = min($this->m, $this->n);
for($i = 0; $i < $n; ++$i) {
for ($i = 0; $i < $n; ++$i) {
$s += $this->A[$i][$i];
}
return $s;
} // function trace()
/**
* uminus
*
* Unary minus matrix -A
* @return Matrix Unary minus matrix
*/
public function uminus() {
public function uminus()
{
} // function uminus()
/**
* plus
*
@ -421,14 +466,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Sum
*/
public function plus() {
public function plus()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -438,8 +488,8 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]);
}
}
@ -449,7 +499,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function plus()
/**
* plusEquals
*
@ -457,14 +506,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Sum
*/
public function plusEquals() {
public function plusEquals()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -474,16 +528,16 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
$validValues = True;
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$validValues = true;
$value = $M->get($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]);
}
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"');
$value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
}
if ($validValues) {
@ -499,7 +553,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function plusEquals()
/**
* minus
*
@ -507,14 +560,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Sum
*/
public function minus() {
public function minus()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -524,8 +582,8 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$M->set($i, $j, $M->get($i, $j) - $this->A[$i][$j]);
}
}
@ -535,7 +593,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function minus()
/**
* minusEquals
*
@ -543,14 +600,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Sum
*/
public function minusEquals() {
public function minusEquals()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -560,16 +622,16 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
$validValues = True;
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$validValues = true;
$value = $M->get($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]);
}
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"');
$value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
}
if ($validValues) {
@ -585,7 +647,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function minusEquals()
/**
* arrayTimes
*
@ -594,14 +655,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Matrix Cij
*/
public function arrayTimes() {
public function arrayTimes()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -611,8 +677,8 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$M->set($i, $j, $M->get($i, $j) * $this->A[$i][$j]);
}
}
@ -622,7 +688,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function arrayTimes()
/**
* arrayTimesEquals
*
@ -631,14 +696,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Matrix Aij
*/
public function arrayTimesEquals() {
public function arrayTimesEquals()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -648,16 +718,16 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
$validValues = True;
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$validValues = true;
$value = $M->get($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]);
}
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"');
$value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
}
if ($validValues) {
@ -673,7 +743,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function arrayTimesEquals()
/**
* arrayRightDivide
*
@ -682,14 +751,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param Matrix $B Matrix B
* @return Matrix Division result
*/
public function arrayRightDivide() {
public function arrayRightDivide()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -699,16 +773,16 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
$validValues = True;
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$validValues = true;
$value = $M->get($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]);
}
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"');
$value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
}
if ($validValues) {
@ -738,14 +812,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Matrix Aij
*/
public function arrayRightDivideEquals() {
public function arrayRightDivideEquals()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -755,8 +834,8 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$this->A[$i][$j] = $this->A[$i][$j] / $M->get($i, $j);
}
}
@ -775,14 +854,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param Matrix $B Matrix B
* @return Matrix Division result
*/
public function arrayLeftDivide() {
public function arrayLeftDivide()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -792,8 +876,8 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$M->set($i, $j, $M->get($i, $j) / $this->A[$i][$j]);
}
}
@ -812,14 +896,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Matrix Aij
*/
public function arrayLeftDivideEquals() {
public function arrayLeftDivideEquals()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -829,8 +918,8 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$this->A[$i][$j] = $M->get($i, $j) / $this->A[$i][$j];
}
}
@ -848,24 +937,29 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $n Matrix/Array/Scalar
* @return Matrix Product
*/
public function times() {
public function times()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $B = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$B = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
if ($this->n == $B->m) {
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
for($j = 0; $j < $B->n; ++$j) {
for ($j = 0; $j < $B->n; ++$j) {
for ($k = 0; $k < $this->n; ++$k) {
$Bcolj[$k] = $B->A[$k][$j];
}
for($i = 0; $i < $this->m; ++$i) {
for ($i = 0; $i < $this->m; ++$i) {
$Arowi = $this->A[$i];
$s = 0;
for($k = 0; $k < $this->n; ++$k) {
for ($k = 0; $k < $this->n; ++$k) {
$s += $Arowi[$k] * $Bcolj[$k];
}
$C->A[$i][$j] = $s;
@ -880,10 +974,10 @@ class PHPExcel_Shared_JAMA_Matrix {
$B = new PHPExcel_Shared_JAMA_Matrix($args[0]);
if ($this->n == $B->m) {
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
for($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) {
for ($i = 0; $i < $C->m; ++$i) {
for ($j = 0; $j < $C->n; ++$j) {
$s = "0";
for($k = 0; $k < $C->n; ++$k) {
for ($k = 0; $k < $C->n; ++$k) {
$s += $this->A[$i][$k] * $B->A[$k][$j];
}
$C->A[$i][$j] = $s;
@ -897,8 +991,8 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
case 'integer':
$C = new PHPExcel_Shared_JAMA_Matrix($this->A);
for($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) {
for ($i = 0; $i < $C->m; ++$i) {
for ($j = 0; $j < $C->n; ++$j) {
$C->A[$i][$j] *= $args[0];
}
}
@ -906,8 +1000,8 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
case 'double':
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $this->n);
for($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) {
for ($i = 0; $i < $C->m; ++$i) {
for ($j = 0; $j < $C->n; ++$j) {
$C->A[$i][$j] = $args[0] * $this->A[$i][$j];
}
}
@ -915,8 +1009,8 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
case 'float':
$C = new PHPExcel_Shared_JAMA_Matrix($this->A);
for($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) {
for ($i = 0; $i < $C->m; ++$i) {
for ($j = 0; $j < $C->n; ++$j) {
$C->A[$i][$j] *= $args[0];
}
}
@ -931,7 +1025,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function times()
/**
* power
*
@ -939,14 +1032,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Sum
*/
public function power() {
public function power()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break;
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -956,16 +1054,16 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
$validValues = True;
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$validValues = true;
$value = $M->get($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]);
}
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"');
$value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
}
if ($validValues) {
@ -981,7 +1079,6 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function power()
/**
* concat
*
@ -989,14 +1086,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array
* @return Matrix Sum
*/
public function concat() {
public function concat()
{
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break;
@ -1005,9 +1107,9 @@ class PHPExcel_Shared_JAMA_Matrix {
break;
}
$this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
$this->A[$i][$j] = trim($this->A[$i][$j],'"').trim($M->get($i, $j),'"');
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"').trim($M->get($i, $j), '"');
}
}
return $this;
@ -1016,14 +1118,14 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function concat()
/**
* Solve A*X = B.
*
* @param Matrix $B Right hand side
* @return Matrix ... Solution if A is square, least squares solution otherwise
*/
public function solve($B) {
public function solve($B)
{
if ($this->m == $this->n) {
$LU = new PHPExcel_Shared_JAMA_LUDecomposition($this);
return $LU->solve($B);
@ -1033,24 +1135,24 @@ class PHPExcel_Shared_JAMA_Matrix {
}
} // function solve()
/**
* Matrix inverse or pseudoinverse.
*
* @return Matrix ... Inverse(A) if A is square, pseudoinverse otherwise.
*/
public function inverse() {
public function inverse()
{
return $this->solve($this->identity($this->m, $this->m));
} // function inverse()
/**
* det
*
* Calculate determinant
* @return float Determinant
*/
public function det() {
public function det()
{
$L = new PHPExcel_Shared_JAMA_LUDecomposition($this);
return $L->det();
} // function det()

View File

@ -16,8 +16,8 @@
* @license PHP v3.0
* @version 1.1
*/
class PHPExcel_Shared_JAMA_QRDecomposition {
class PHPExcel_Shared_JAMA_QRDecomposition
{
const MatrixRankException = "Can only perform operation on full-rank matrix.";
/**
@ -51,7 +51,8 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
* @param matrix $A Rectangular matrix
* @return Structure to access R and the Householder vectors and compute Q.
*/
public function __construct($A) {
public function __construct($A)
{
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
// Initialize.
$this->QR = $A->getArrayCopy();
@ -98,7 +99,8 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
*
* @return boolean true if R, and hence A, has full rank, else false.
*/
public function isFullRank() {
public function isFullRank()
{
for ($j = 0; $j < $this->n; ++$j) {
if ($this->Rdiag[$j] == 0) {
return false;
@ -107,13 +109,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return true;
} // function isFullRank()
/**
* Return the Householder vectors
*
* @return Matrix Lower trapezoidal matrix whose columns define the reflections
*/
public function getH() {
public function getH()
{
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
if ($i >= $j) {
@ -126,13 +128,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($H);
} // function getH()
/**
* Return the upper triangular factor
*
* @return Matrix upper triangular factor
*/
public function getR() {
public function getR()
{
for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
if ($i < $j) {
@ -147,13 +149,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($R);
} // function getR()
/**
* Generate and return the (economy-sized) orthogonal factor
*
* @return Matrix orthogonal factor
*/
public function getQ() {
public function getQ()
{
for ($k = $this->n-1; $k >= 0; --$k) {
for ($i = 0; $i < $this->m; ++$i) {
$Q[$i][$k] = 0.0;
@ -184,14 +186,14 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($Q);
} // function getQ()
/**
* Least squares solution of A*X = B
*
* @param Matrix $B A Matrix with as many rows as A and any number of columns.
* @return Matrix Matrix that minimizes the two norm of Q*R*X-B.
*/
public function solve($B) {
public function solve($B)
{
if ($B->getRowDimension() == $this->m) {
if ($this->isFullRank()) {
// Copy right hand side
@ -230,5 +232,4 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
}
} // function solve()
} // PHPExcel_Shared_JAMA_class QRDecomposition
}

View File

@ -17,8 +17,8 @@
* @license PHP v3.0
* @version 1.1
*/
class SingularValueDecomposition {
class SingularValueDecomposition
{
/**
* Internal storage of U.
* @var array
@ -49,7 +49,6 @@ class SingularValueDecomposition {
*/
private $n;
/**
* Construct the singular value decomposition
*
@ -58,8 +57,8 @@ class SingularValueDecomposition {
* @param $A Rectangular matrix
* @return Structure to access U, S and V.
*/
public function __construct($Arg) {
public function __construct($Arg)
{
// Initialize.
$A = $Arg->getArrayCopy();
$this->m = $Arg->getRowDimension();
@ -75,7 +74,6 @@ class SingularValueDecomposition {
// Reduce A to bidiagonal form, storing the diagonal elements
// in s and the super-diagonal elements in e.
for ($k = 0; $k < max($nct, $nrt); ++$k) {
if ($k < $nct) {
// Compute the transformation for the k-th column and
// place the k-th diagonal in s[$k].
@ -113,7 +111,7 @@ class SingularValueDecomposition {
}
}
if ($wantu AND ($k < $nct)) {
if ($wantu and ($k < $nct)) {
// Place the transformation in U for subsequent back
// multiplication.
for ($i = $k; $i < $this->m; ++$i) {
@ -139,7 +137,7 @@ class SingularValueDecomposition {
$e[$k+1] += 1.0;
}
$e[$k] = -$e[$k];
if (($k+1 < $this->m) AND ($e[$k] != 0.0)) {
if (($k+1 < $this->m) and ($e[$k] != 0.0)) {
// Apply the transformation.
for ($i = $k+1; $i < $this->m; ++$i) {
$work[$i] = 0.0;
@ -198,7 +196,7 @@ class SingularValueDecomposition {
$this->U[$i][$j] += $t * $this->U[$i][$k];
}
}
for ($i = $k; $i < $this->m; ++$i ) {
for ($i = $k; $i < $this->m; ++$i) {
$this->U[$i][$k] = -$this->U[$i][$k];
}
$this->U[$k][$k] = 1.0 + $this->U[$k][$k];
@ -217,7 +215,7 @@ class SingularValueDecomposition {
// If required, generate V.
if ($wantv) {
for ($k = $this->n - 1; $k >= 0; --$k) {
if (($k < $nrt) AND ($e[$k] != 0.0)) {
if (($k < $nrt) and ($e[$k] != 0.0)) {
for ($j = $k + 1; $j < $nu; ++$j) {
$t = 0;
for ($i = $k + 1; $i < $this->n; ++$i) {
@ -275,7 +273,7 @@ class SingularValueDecomposition {
}
if ($ks == $k) {
$kase = 3;
} else if ($ks == $p-1) {
} elseif ($ks == $p-1) {
$kase = 1;
} else {
$kase = 2;
@ -331,9 +329,7 @@ class SingularValueDecomposition {
// Perform one qr step.
case 3:
// Calculate the shift.
$scale = max(max(max(max(
abs($this->s[$p-1]),abs($this->s[$p-2])),abs($e[$p-2])),
abs($this->s[$k])), abs($e[$k]));
$scale = max(max(max(max(abs($this->s[$p-1]), abs($this->s[$p-2])), abs($e[$p-2])), abs($this->s[$k])), abs($e[$k]));
$sp = $this->s[$p-1] / $scale;
$spm1 = $this->s[$p-2] / $scale;
$epm1 = $e[$p-2] / $scale;
@ -408,14 +404,14 @@ class SingularValueDecomposition {
$t = $this->s[$k];
$this->s[$k] = $this->s[$k+1];
$this->s[$k+1] = $t;
if ($wantv AND ($k < $this->n - 1)) {
if ($wantv and ($k < $this->n - 1)) {
for ($i = 0; $i < $this->n; ++$i) {
$t = $this->V[$i][$k+1];
$this->V[$i][$k+1] = $this->V[$i][$k];
$this->V[$i][$k] = $t;
}
}
if ($wantu AND ($k < $this->m-1)) {
if ($wantu and ($k < $this->m-1)) {
for ($i = 0; $i < $this->m; ++$i) {
$t = $this->U[$i][$k+1];
$this->U[$i][$k+1] = $this->U[$i][$k];
@ -439,7 +435,8 @@ class SingularValueDecomposition {
* @access public
* @return U
*/
public function getU() {
public function getU()
{
return new Matrix($this->U, $this->m, min($this->m + 1, $this->n));
}
@ -450,7 +447,8 @@ class SingularValueDecomposition {
* @access public
* @return V
*/
public function getV() {
public function getV()
{
return new Matrix($this->V);
}
@ -461,7 +459,8 @@ class SingularValueDecomposition {
* @access public
* @return diagonal of S.
*/
public function getSingularValues() {
public function getSingularValues()
{
return $this->s;
}
@ -472,7 +471,8 @@ class SingularValueDecomposition {
* @access public
* @return S
*/
public function getS() {
public function getS()
{
for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$S[$i][$j] = 0.0;
@ -489,7 +489,8 @@ class SingularValueDecomposition {
* @access public
* @return max(S)
*/
public function norm2() {
public function norm2()
{
return $this->s[0];
}
@ -500,7 +501,8 @@ class SingularValueDecomposition {
* @access public
* @return max(S)/min(S)
*/
public function cond() {
public function cond()
{
return $this->s[0] / $this->s[min($this->m, $this->n) - 1];
}
@ -511,7 +513,8 @@ class SingularValueDecomposition {
* @access public
* @return Number of nonnegligible singular values.
*/
public function rank() {
public function rank()
{
$eps = pow(2.0, -52.0);
$tol = max($this->m, $this->n) * $this->s[0] * $eps;
$r = 0;
@ -522,5 +525,4 @@ class SingularValueDecomposition {
}
return $r;
}
} // class SingularValueDecomposition
}

View File

@ -67,7 +67,8 @@ $error['EN'][RowLengthException] = "All rows must have the same length.";
* Custom error handler
* @param int $num Error number
*/
function JAMAError($errorNumber = null) {
function JAMAError($errorNumber = null)
{
global $error;
if (isset($errorNumber)) {

View File

@ -11,7 +11,8 @@
*
* r = sqrt(a^2 + b^2) without under/overflow.
*/
function hypo($a, $b) {
function hypo($a, $b)
{
if (abs($a) > abs($b)) {
$r = $b / $a;
$r = abs($a) * sqrt(1 + $r * $r);

View File

@ -72,11 +72,12 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
if (is_resource($filename)) {
$this->_FILEH_ = $filename;
} else if ($filename == '-' || $filename == '') {
if ($this->_tmp_dir === null)
} elseif ($filename == '-' || $filename == '') {
if ($this->_tmp_dir === null) {
$this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir();
}
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
$this->_FILEH_ = fopen($this->_tmp_filename,"w+b");
$this->_FILEH_ = fopen($this->_tmp_filename, "w+b");
if ($this->_FILEH_ == false) {
throw new PHPExcel_Writer_Exception("Can't create temporary file.");
}
@ -199,7 +200,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
}
// Save Header
fwrite($FILE,
fwrite(
$FILE,
"\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
. "\x00\x00\x00\x00"
. "\x00\x00\x00\x00"
@ -222,9 +224,10 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
);
// Extra BDList Start, Count
if ($iBdCnt < $i1stBdL) {
fwrite($FILE,
fwrite(
$FILE,
pack("V", -2) // Extra BDList Start
. pack("V", 0) // Extra BDList Count
. pack("V", 0)// Extra BDList Count
);
} else {
fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
@ -258,9 +261,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
for ($i = 0; $i < $iCount; ++$i) {
if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) {
$raList[$i]->Size = $raList[$i]->_DataLen();
if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) ||
(($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data)))
{
if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) || (($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) {
// Write Data
//if (isset($raList[$i]->_PPS_FILE)) {
// $iLen = 0;
@ -366,7 +367,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
$iCnt = count($raList);
$iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
if ($iCnt % $iBCnt) {
fwrite($this->_FILEH_, str_repeat("\x00",($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE));
fwrite($this->_FILEH_, str_repeat("\x00", ($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE));
}
}

View File

@ -28,7 +28,8 @@
defined('IDENTIFIER_OLE') ||
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));
class PHPExcel_Shared_OLERead {
class PHPExcel_Shared_OLERead
{
private $data = '';
// OLE identifier
@ -272,7 +273,7 @@ class PHPExcel_Shared_OLERead {
// Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
$this->wrkbook = count($this->props) - 1;
} else if ($upName === 'ROOT ENTRY' || $upName === 'R') {
} elseif ($upName === 'ROOT ENTRY' || $upName === 'R') {
// Root entry
$this->rootentry = count($this->props) - 1;
}

View File

@ -319,7 +319,7 @@ class PclZip
// ----- Look for the optional second argument
if ($v_size == 2) {
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
} else if ($v_size > 2) {
} elseif ($v_size > 2) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
return 0;
}
@ -345,7 +345,7 @@ class PclZip
// ----- The list is a list of string names
$v_string_list = $p_filelist;
}
} else if (is_string($p_filelist)) {
} elseif (is_string($p_filelist)) {
// ----- Look if the $p_filelist is a string
// ----- Create a list from the string
$v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
@ -487,7 +487,7 @@ class PclZip
// ----- Look for the optional second argument
if ($v_size == 2) {
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
} else if ($v_size > 2) {
} elseif ($v_size > 2) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
@ -516,7 +516,7 @@ class PclZip
// ----- The list is a list of string names
$v_string_list = $p_filelist;
}
} else if (is_string($p_filelist)) {
} elseif (is_string($p_filelist)) {
// ----- Look if the $p_filelist is a string
// ----- Create a list from the string
$v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
@ -748,7 +748,7 @@ class PclZip
// ----- Look for the optional second argument
if ($v_size == 2) {
$v_remove_path = $v_arg_list[1];
} else if ($v_size > 2) {
} elseif ($v_size > 2) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
@ -903,7 +903,7 @@ class PclZip
// ----- Look for the optional second argument
if ($v_size == 2) {
$v_remove_path = $v_arg_list[1];
} else if ($v_size > 2) {
} elseif ($v_size > 2) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
@ -1122,7 +1122,7 @@ class PclZip
if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) {
// ----- Duplicate the archive
$v_result = $this->privDuplicate($p_archive->zipname);
} else if (is_string($p_archive)) {
} elseif (is_string($p_archive)) {
// ----- Look if the $p_archive is a string (so a filename)
// ----- Check that $p_archive is a valid zip file
// TBC : Should also check the archive format
@ -1176,7 +1176,7 @@ class PclZip
if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) {
// ----- Merge the archive
$v_result = $this->privMerge($p_archive_to_add);
} else if (is_string($p_archive_to_add)) {
} elseif (is_string($p_archive_to_add)) {
// ----- Look if the $p_archive_to_add is a string (so a filename)
// ----- Create a temporary archive
$v_object_archive = new PclZip($p_archive_to_add);
@ -1466,7 +1466,7 @@ class PclZip
// ----- Get the value
if (is_string($p_options_list[$i+1])) {
$v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
} else if (is_array($p_options_list[$i+1])) {
} elseif (is_array($p_options_list[$i+1])) {
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
} else {
// ----- Error log
@ -1548,9 +1548,9 @@ class PclZip
// ----- Parse items
$v_work_list = explode(",", $p_options_list[$i+1]);
} else if (is_integer($p_options_list[$i+1])) {
} elseif (is_integer($p_options_list[$i+1])) {
$v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
} else if (is_array($p_options_list[$i+1])) {
} elseif (is_array($p_options_list[$i+1])) {
$v_work_list = $p_options_list[$i+1];
} else {
// ----- Error log
@ -1895,16 +1895,16 @@ class PclZip
if (file_exists($v_descr['filename'])) {
if (@is_file($v_descr['filename'])) {
$v_descr['type'] = 'file';
} else if (@is_dir($v_descr['filename'])) {
} elseif (@is_dir($v_descr['filename'])) {
$v_descr['type'] = 'folder';
} else if (@is_link($v_descr['filename'])) {
} elseif (@is_link($v_descr['filename'])) {
// skip
continue;
} else {
// skip
continue;
}
} else if (isset($v_descr['content'])) {
} elseif (isset($v_descr['content'])) {
// ----- Look for string added as file
$v_descr['type'] = 'virtual_file';
} else {
@ -2412,12 +2412,12 @@ class PclZip
if ($p_filedescr['type']=='file') {
$p_header['external'] = 0x00000000;
$p_header['size'] = filesize($p_filename);
} else if ($p_filedescr['type']=='folder') {
} elseif ($p_filedescr['type']=='folder') {
// ----- Look for regular folder
$p_header['external'] = 0x00000010;
$p_header['mtime'] = filemtime($p_filename);
$p_header['size'] = filesize($p_filename);
} else if ($p_filedescr['type'] == 'virtual_file') {
} elseif ($p_filedescr['type'] == 'virtual_file') {
// ----- Look for virtual file
$p_header['external'] = 0x00000000;
$p_header['size'] = strlen($p_filedescr['content']);
@ -2426,7 +2426,7 @@ class PclZip
// ----- Look for filetime
if (isset($p_filedescr['mtime'])) {
$p_header['mtime'] = $p_filedescr['mtime'];
} else if ($p_filedescr['type'] == 'virtual_file') {
} elseif ($p_filedescr['type'] == 'virtual_file') {
$p_header['mtime'] = time();
} else {
$p_header['mtime'] = filemtime($p_filename);
@ -2526,7 +2526,7 @@ class PclZip
// ----- Write the compressed (or not) content
@fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
}
} else if ($p_filedescr['type'] == 'virtual_file') {
} elseif ($p_filedescr['type'] == 'virtual_file') {
// ----- Look for a virtual file (a file from string)
$v_content = $p_filedescr['content'];
@ -2556,7 +2556,7 @@ class PclZip
// ----- Write the compressed (or not) content
@fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
} else if ($p_filedescr['type'] == 'folder') {
} elseif ($p_filedescr['type'] == 'folder') {
// ----- Look for a directory
// ----- Look for directory last '/'
if (@substr($p_header['stored_filename'], -1) != '/') {
@ -2761,7 +2761,7 @@ class PclZip
// ----- Look for all path to remove
if ($p_remove_all_dir) {
$v_stored_filename = basename($p_filename);
} else if ($p_remove_dir != "") {
} elseif ($p_remove_dir != "") {
// ----- Look for partial path remove
if (substr($p_remove_dir, -1) != '/') {
$p_remove_dir .= "/";
@ -3136,12 +3136,12 @@ class PclZip
$v_extract = true;
}
}
}else if ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
} elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
// ----- Look for extract by preg rule
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
$v_extract = true;
}
} else if ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
} elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
// ----- Look for extract by index rule
// ----- Look if the index is in the list
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
@ -3167,7 +3167,6 @@ class PclZip
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
$this->privSwapBackMagicQuotes();
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is compressed by an unsupported compression method (".$v_header['compression'].") ");
@ -3249,9 +3248,8 @@ class PclZip
if ($v_result1 == 2) {
break;
}
}
} elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
// ----- Look for extraction in standard output
elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
// ----- Extracting the file in standard output
$v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
if ($v_result1 < 1) {
@ -3343,7 +3341,7 @@ class PclZip
// ----- Get the basename of the path
$p_entry['filename'] = basename($p_entry['filename']);
} else if ($p_remove_path != "") {
} elseif ($p_remove_path != "") {
// ----- Look for path to remove
if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) {
// ----- Change the file status
@ -3369,7 +3367,7 @@ class PclZip
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
$v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']);
if ($v_inclusion == 0) {
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,"Filename '".$p_entry['filename']."' is outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '".$p_entry['filename']."' is outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
return PclZip::errorCode();
}
@ -3410,7 +3408,6 @@ class PclZip
if (file_exists($p_entry['filename'])) {
// ----- Look if file is a directory
if (is_dir($p_entry['filename'])) {
// ----- Change the file status
$p_entry['status'] = "already_a_directory";
@ -3421,7 +3418,7 @@ class PclZip
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '".$p_entry['filename']."' is already used by an existing directory");
return PclZip::errorCode();
}
} else if (!is_writeable($p_entry['filename'])) {
} elseif (!is_writeable($p_entry['filename'])) {
// ----- Look if file is write protected
// ----- Change the file status
$p_entry['status'] = "write_protected";
@ -3433,7 +3430,7 @@ class PclZip
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '".$p_entry['filename']."' exists and is write protected");
return PclZip::errorCode();
}
} else if (filemtime($p_entry['filename']) > $p_entry['mtime']) {
} elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) {
// ----- Look if the extracted file is older
// ----- Change the file status
if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) {
@ -3454,16 +3451,13 @@ class PclZip
// ----- Check the directory availability and create it if necessary
if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
$v_dir_to_check = $p_entry['filename'];
}
else if (!strstr($p_entry['filename'], "/")) {
} elseif (!strstr($p_entry['filename'], "/")) {
$v_dir_to_check = "";
}
else {
} else {
$v_dir_to_check = dirname($p_entry['filename']);
}
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
// ----- Change the file status
$p_entry['status'] = "path_creation_fail";
@ -3530,7 +3524,6 @@ class PclZip
$v_file_content = @gzinflate($v_buffer);
unset($v_buffer);
if ($v_file_content === false) {
// ----- Change the file status
// TBC
$p_entry['status'] = "error";
@ -3540,7 +3533,6 @@ class PclZip
// ----- Opening destination file
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
// ----- Change the file status
$p_entry['status'] = "write_error";
@ -3723,7 +3715,6 @@ class PclZip
if (!(($p_entry['external']&0x00000010)==0x00000010)) {
// ----- Look for not compressed file
if ($p_entry['compressed_size'] == $p_entry['size']) {
// ----- Read the file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
@ -3731,7 +3722,6 @@ class PclZip
echo $v_buffer;
unset($v_buffer);
} else {
// ----- Read the compressed file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
@ -3830,11 +3820,9 @@ class PclZip
// ----- Look for not compressed file
// if ($p_entry['compressed_size'] == $p_entry['size'])
if ($p_entry['compression'] == 0) {
// ----- Reading the file
$p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
} else {
// ----- Reading the file
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
@ -4037,8 +4025,7 @@ class PclZip
// ----- Get comment
if ($p_header['comment_len'] != 0) {
$p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
}
else {
} else {
$p_header['comment'] = '';
}
@ -4171,8 +4158,9 @@ class PclZip
// ----- Go back to the maximum possible size of the Central Dir End Record
if (!$v_found) {
$v_maximum_size = 65557; // 0xFFFF + 22;
if ($v_maximum_size > $v_size)
if ($v_maximum_size > $v_size) {
$v_maximum_size = $v_size;
}
@fseek($this->zip_fd, $v_size-$v_maximum_size);
if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) {
// ----- Error log
@ -4196,8 +4184,7 @@ class PclZip
$v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
// ----- Compare the bytes
if ($v_bytes == 0x504b0506)
{
if ($v_bytes == 0x504b0506) {
$v_pos++;
break;
}
@ -4342,31 +4329,17 @@ class PclZip
} elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
$v_found = true;
}
}
} elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
// ----- Look for a filename
elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
$v_found = true;
}
}
}
// ----- Look for extract by ereg rule
// ereg() is deprecated with PHP 5.3
/*
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
$v_found = true;
}
}
*/
else if ((isset($p_options[PCLZIP_OPT_BY_PREG]))
} elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
// ----- Look for extract by preg rule
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
$v_found = true;
}
} else if ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
} elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
// ----- Look for extract by index rule
// ----- Look if the index is in the list
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
@ -4376,7 +4349,6 @@ class PclZip
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
$j_start = $j+1;
}
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
break;
}
@ -4523,7 +4495,7 @@ class PclZip
// ----- Destroy the temporary archive
unset($v_temp_zip);
} else if ($v_central_dir['entries'] != 0) {
} elseif ($v_central_dir['entries'] != 0) {
// ----- Remove every files : reset the file
$this->privCloseFd();
@ -4608,7 +4580,6 @@ class PclZip
// ----- Look if the archive_to_add exists
if (!is_file($p_archive_to_add->zipname)) {
// ----- Nothing to merge, so merge is a success
$v_result = 1;
@ -4618,7 +4589,6 @@ class PclZip
// ----- Look if the archive exists
if (!is_file($this->zipname)) {
// ----- Do a duplicate
$v_result = $this->privDuplicate($p_archive_to_add->zipname);
@ -4781,7 +4751,6 @@ class PclZip
// ----- Look if the $p_archive_filename exists
if (!is_file($p_archive_filename)) {
// ----- Nothing to duplicate, so duplicate is a success.
$v_result = 1;
@ -4946,9 +4915,9 @@ function PclZipUtilPathReduction($p_dir)
if ($v_list[$i] == ".") {
// ----- Ignore this directory
// Should be the first $i=0, but no check is done
} else if ($v_list[$i] == "..") {
} elseif ($v_list[$i] == "..") {
$v_skip++;
} else if ($v_list[$i] == "") {
} elseif ($v_list[$i] == "") {
// ----- First '/' i.e. root slash
if ($i == 0) {
$v_result = "/".$v_result;
@ -4958,7 +4927,7 @@ function PclZipUtilPathReduction($p_dir)
$v_result = $p_dir;
$v_skip = 0;
}
} else if ($i == (sizeof($v_list)-1)) {
} elseif ($i == (sizeof($v_list)-1)) {
// ----- Last '/' i.e. indicates a directory
$v_result = $v_list[$i];
} else {
@ -4970,8 +4939,7 @@ function PclZipUtilPathReduction($p_dir)
// ----- Look for item to skip
if ($v_skip > 0) {
$v_skip--;
}
else {
} else {
$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
}
}
@ -5051,13 +5019,17 @@ function PclZipUtilPathInclusion($p_dir, $p_path)
// ----- Look if everything seems to be the same
if ($v_result) {
// ----- Skip all the empty items
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) {
$j++;
}
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) {
$i++;
}
if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
// ----- There are exactly the same
$v_result = 2;
} else if ($i < $v_list_dir_size) {
} elseif ($i < $v_list_dir_size) {
// ----- The path is shorter than the dir
$v_result = 0;
}
@ -5090,21 +5062,21 @@ function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0)
@fwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size;
}
} else if ($p_mode==1) {
} elseif ($p_mode==1) {
while ($p_size != 0) {
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
$v_buffer = @gzread($p_src, $v_read_size);
@fwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size;
}
} else if ($p_mode==2) {
} elseif ($p_mode==2) {
while ($p_size != 0) {
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
$v_buffer = @fread($p_src, $v_read_size);
@gzwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size;
}
} else if ($p_mode==3) {
} elseif ($p_mode==3) {
while ($p_size != 0) {
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
$v_buffer = @gzread($p_src, $v_read_size);
@ -5139,7 +5111,7 @@ function PclZipUtilRename($p_src, $p_dest)
// ----- Try to copy & unlink the src
if (!@copy($p_src, $p_dest)) {
$v_result = 0;
} else if (!@unlink($p_src)) {
} elseif (!@unlink($p_src)) {
$v_result = 0;
}
}
@ -5160,7 +5132,6 @@ function PclZipUtilRename($p_src, $p_dest)
// --------------------------------------------------------------------------------
function PclZipUtilOptionText($p_option)
{
$v_list = get_defined_constants();
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
$v_prefix = substr($v_key, 0, 10);
@ -5194,10 +5165,9 @@ function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true)
$p_path = substr($p_path, $v_position+1);
}
// ----- Change potential windows directory separator
if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
$p_path = strtr($p_path, '\\', '/');
}
}
return $p_path;
}
// --------------------------------------------------------------------------------

View File

@ -504,7 +504,7 @@ class PHPExcel_Shared_String
if ($from == 'UTF-16LE') {
return self::utf16_decode($value, false);
} else if ($from == 'UTF-16BE') {
} elseif ($from == 'UTF-16BE') {
return self::utf16_decode($value);
}
// else, no conversion

View File

@ -131,7 +131,7 @@ class PHPExcel_Shared_ZipStreamWrapper
* @param int $count maximum number of bytes to read
* @return string
*/
function stream_read($count)
public function stream_read($count)
{
$ret = substr($this->_data, $this->_position, $count);
$this->_position += strlen($ret);

View File

@ -138,7 +138,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression
* @param boolean $const
*/
function __construct($yValues, $xValues = array(), $const = true)
public function __construct($yValues, $xValues = array(), $const = true)
{
if (parent::__construct($yValues, $xValues) !== false) {
$this->_exponential_regression($yValues, $xValues, $const);

View File

@ -100,7 +100,7 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression
* @param boolean $const
*/
function __construct($yValues, $xValues = array(), $const = true)
public function __construct($yValues, $xValues = array(), $const = true)
{
if (parent::__construct($yValues, $xValues) !== false) {
$this->_linear_regression($yValues, $xValues, $const);

View File

@ -108,7 +108,7 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression
* @param boolean $const
*/
function __construct($yValues, $xValues = array(), $const = true)
public function __construct($yValues, $xValues = array(), $const = true)
{
if (parent::__construct($yValues, $xValues) !== false) {
$this->_logarithmic_regression($yValues, $xValues, $const);

View File

@ -213,7 +213,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression
* @param boolean $const
*/
function __construct($order, $yValues, $xValues = array(), $const = true)
public function __construct($order, $yValues, $xValues = array(), $const = true)
{
if (parent::__construct($yValues, $xValues) !== false) {
if ($order < $this->_valueCount) {

View File

@ -138,7 +138,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression
* @param boolean $const
*/
function __construct($yValues, $xValues = array(), $const = true)
public function __construct($yValues, $xValues = array(), $const = true)
{
if (parent::__construct($yValues, $xValues) !== false) {
$this->_power_regression($yValues, $xValues, $const);

View File

@ -153,4 +153,4 @@ class trendClass
return false;
}
} // function calculate()
} // class trendClass
}

View File

@ -358,7 +358,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
// Selection type, inspect
if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) {
$selectionType = 'COLUMN';
} else if (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) {
} elseif (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) {
$selectionType = 'ROW';
} else {
$selectionType = 'CELL';

View File

@ -391,7 +391,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* Code to execute when this worksheet is unset()
*
*/
function __destruct()
public function __destruct()
{
PHPExcel_Calculation::getInstance($this->_parent)->clearCalculationCacheForWorksheet($this->_title);
@ -2265,9 +2265,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
if (strpos($pCellCoordinate, ':') !== false || strpos($pCellCoordinate, ',') !== false) {
throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells.');
} else if (strpos($pCellCoordinate, '$') !== false) {
} elseif (strpos($pCellCoordinate, '$') !== false) {
throw new PHPExcel_Exception('Cell coordinate string must not be absolute.');
} else if ($pCellCoordinate == '') {
} elseif ($pCellCoordinate == '') {
throw new PHPExcel_Exception('Cell coordinate can not be zero-length string.');
} else {
// Check if we already have a comment for this cell.

View File

@ -25,14 +25,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Worksheet_ColumnDimension
class PHPExcel_Worksheet_ColumnDimension extends PHPExcel_Worksheet_Dimension
{
/**
* Column index
*
* @var int
*/
private $_columnIndex;
private $columnIndex;
/**
* Column width
@ -41,42 +41,14 @@ class PHPExcel_Worksheet_ColumnDimension
*
* @var double
*/
private $_width = -1;
private $width = -1;
/**
* Auto size?
*
* @var bool
*/
private $_autoSize = false;
/**
* Visible?
*
* @var bool
*/
private $_visible = true;
/**
* Outline level
*
* @var int
*/
private $_outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $_collapsed = false;
/**
* Index to cellXf
*
* @var int
*/
private $_xfIndex;
private $autoSize = false;
/**
* Create a new PHPExcel_Worksheet_ColumnDimension
@ -86,10 +58,10 @@ class PHPExcel_Worksheet_ColumnDimension
public function __construct($pIndex = 'A')
{
// Initialise values
$this->_columnIndex = $pIndex;
$this->columnIndex = $pIndex;
// set default index to cellXf
$this->_xfIndex = 0;
// set dimension as unformatted by default
parent::__construct(0);
}
/**
@ -99,7 +71,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/
public function getColumnIndex()
{
return $this->_columnIndex;
return $this->columnIndex;
}
/**
@ -110,7 +82,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/
public function setColumnIndex($pValue)
{
$this->_columnIndex = $pValue;
$this->columnIndex = $pValue;
return $this;
}
@ -121,7 +93,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/
public function getWidth()
{
return $this->_width;
return $this->width;
}
/**
@ -132,7 +104,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/
public function setWidth($pValue = -1)
{
$this->_width = $pValue;
$this->width = $pValue;
return $this;
}
@ -143,7 +115,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/
public function getAutoSize()
{
return $this->_autoSize;
return $this->autoSize;
}
/**
@ -154,117 +126,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/
public function setAutoSize($pValue = false)
{
$this->_autoSize = $pValue;
$this->autoSize = $pValue;
return $this;
}
/**
* Get Visible
*
* @return bool
*/
public function getVisible()
{
return $this->_visible;
}
/**
* Set Visible
*
* @param bool $pValue
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setVisible($pValue = true)
{
$this->_visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
* @return int
*/
public function getOutlineLevel()
{
return $this->_outlineLevel;
}
/**
* Set Outline Level
*
* Value must be between 0 and 7
*
* @param int $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setOutlineLevel($pValue)
{
if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
}
$this->_outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
* @return bool
*/
public function getCollapsed()
{
return $this->_collapsed;
}
/**
* Set Collapsed
*
* @param bool $pValue
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setCollapsed($pValue = true)
{
$this->_collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
* @return int
*/
public function getXfIndex()
{
return $this->_xfIndex;
}
/**
* Set index to cellXf
*
* @param int $pValue
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setXfIndex($pValue = 0)
{
$this->_xfIndex = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}

View File

@ -0,0 +1,178 @@
<?php
/**
* PHPExcel_Worksheet_Dimension
*
* Copyright (c) 2006 - 2015 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
abstract class PHPExcel_Worksheet_Dimension
{
/**
* Visible?
*
* @var bool
*/
private $visible = true;
/**
* Outline level
*
* @var int
*/
private $outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $collapsed = false;
/**
* Index to cellXf. Null value means row has no explicit cellXf format.
*
* @var int|null
*/
private $xfIndex;
/**
* Create a new PHPExcel_Worksheet_Dimension
*
* @param int $pIndex Numeric row index
*/
public function __construct($initialValue = null)
{
// set dimension as unformatted by default
$this->xfIndex = $initialValue;
}
/**
* Get Visible
*
* @return bool
*/
public function getVisible()
{
return $this->visible;
}
/**
* Set Visible
*
* @param bool $pValue
* @return PHPExcel_Worksheet_Dimension
*/
public function setVisible($pValue = true)
{
$this->visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
* @return int
*/
public function getOutlineLevel()
{
return $this->outlineLevel;
}
/**
* Set Outline Level
*
* Value must be between 0 and 7
*
* @param int $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Dimension
*/
public function setOutlineLevel($pValue)
{
if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
}
$this->outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
* @return bool
*/
public function getCollapsed()
{
return $this->collapsed;
}
/**
* Set Collapsed
*
* @param bool $pValue
* @return PHPExcel_Worksheet_Dimension
*/
public function setCollapsed($pValue = true)
{
$this->collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
* @return int
*/
public function getXfIndex()
{
return $this->xfIndex;
}
/**
* Set index to cellXf
*
* @param int $pValue
* @return PHPExcel_Worksheet_Dimension
*/
public function setXfIndex($pValue = 0)
{
$this->xfIndex = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}

View File

@ -166,7 +166,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function isProtectionEnabled()
public function isProtectionEnabled()
{
return $this->_sheet ||
$this->_objects ||
@ -191,7 +191,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSheet()
public function getSheet()
{
return $this->_sheet;
}
@ -202,7 +202,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSheet($pValue = false)
public function setSheet($pValue = false)
{
$this->_sheet = $pValue;
return $this;
@ -213,7 +213,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getObjects()
public function getObjects()
{
return $this->_objects;
}
@ -224,7 +224,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setObjects($pValue = false)
public function setObjects($pValue = false)
{
$this->_objects = $pValue;
return $this;
@ -235,7 +235,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getScenarios()
public function getScenarios()
{
return $this->_scenarios;
}
@ -246,7 +246,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setScenarios($pValue = false)
public function setScenarios($pValue = false)
{
$this->_scenarios = $pValue;
return $this;
@ -257,7 +257,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatCells()
public function getFormatCells()
{
return $this->_formatCells;
}
@ -268,7 +268,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatCells($pValue = false)
public function setFormatCells($pValue = false)
{
$this->_formatCells = $pValue;
return $this;
@ -279,7 +279,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatColumns()
public function getFormatColumns()
{
return $this->_formatColumns;
}
@ -290,7 +290,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatColumns($pValue = false)
public function setFormatColumns($pValue = false)
{
$this->_formatColumns = $pValue;
return $this;
@ -301,7 +301,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatRows()
public function getFormatRows()
{
return $this->_formatRows;
}
@ -312,7 +312,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatRows($pValue = false)
public function setFormatRows($pValue = false)
{
$this->_formatRows = $pValue;
return $this;
@ -323,7 +323,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertColumns()
public function getInsertColumns()
{
return $this->_insertColumns;
}
@ -334,7 +334,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertColumns($pValue = false)
public function setInsertColumns($pValue = false)
{
$this->_insertColumns = $pValue;
return $this;
@ -345,7 +345,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertRows()
public function getInsertRows()
{
return $this->_insertRows;
}
@ -356,7 +356,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertRows($pValue = false)
public function setInsertRows($pValue = false)
{
$this->_insertRows = $pValue;
return $this;
@ -367,7 +367,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertHyperlinks()
public function getInsertHyperlinks()
{
return $this->_insertHyperlinks;
}
@ -378,7 +378,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertHyperlinks($pValue = false)
public function setInsertHyperlinks($pValue = false)
{
$this->_insertHyperlinks = $pValue;
return $this;
@ -389,7 +389,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getDeleteColumns()
public function getDeleteColumns()
{
return $this->_deleteColumns;
}
@ -400,7 +400,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteColumns($pValue = false)
public function setDeleteColumns($pValue = false)
{
$this->_deleteColumns = $pValue;
return $this;
@ -411,7 +411,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getDeleteRows()
public function getDeleteRows()
{
return $this->_deleteRows;
}
@ -422,7 +422,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteRows($pValue = false)
public function setDeleteRows($pValue = false)
{
$this->_deleteRows = $pValue;
return $this;
@ -433,7 +433,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSelectLockedCells()
public function getSelectLockedCells()
{
return $this->_selectLockedCells;
}
@ -444,7 +444,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectLockedCells($pValue = false)
public function setSelectLockedCells($pValue = false)
{
$this->_selectLockedCells = $pValue;
return $this;
@ -455,7 +455,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSort()
public function getSort()
{
return $this->_sort;
}
@ -466,7 +466,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSort($pValue = false)
public function setSort($pValue = false)
{
$this->_sort = $pValue;
return $this;
@ -477,7 +477,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getAutoFilter()
public function getAutoFilter()
{
return $this->_autoFilter;
}
@ -488,7 +488,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setAutoFilter($pValue = false)
public function setAutoFilter($pValue = false)
{
$this->_autoFilter = $pValue;
return $this;
@ -499,7 +499,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getPivotTables()
public function getPivotTables()
{
return $this->_pivotTables;
}
@ -510,7 +510,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setPivotTables($pValue = false)
public function setPivotTables($pValue = false)
{
$this->_pivotTables = $pValue;
return $this;
@ -521,7 +521,7 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSelectUnlockedCells()
public function getSelectUnlockedCells()
{
return $this->_selectUnlockedCells;
}
@ -532,7 +532,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectUnlockedCells($pValue = false)
public function setSelectUnlockedCells($pValue = false)
{
$this->_selectUnlockedCells = $pValue;
return $this;
@ -543,7 +543,7 @@ class PHPExcel_Worksheet_Protection
*
* @return string
*/
function getPassword()
public function getPassword()
{
return $this->_password;
}
@ -555,7 +555,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection
*/
function setPassword($pValue = '', $pAlreadyHashed = false)
public function setPassword($pValue = '', $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);

View File

@ -25,14 +25,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Worksheet_RowDimension
class PHPExcel_Worksheet_RowDimension extends PHPExcel_Worksheet_Dimension
{
/**
* Row index
*
* @var int
*/
private $_rowIndex;
private $rowIndex;
/**
* Row height (in pt)
@ -41,42 +41,14 @@ class PHPExcel_Worksheet_RowDimension
*
* @var double
*/
private $_rowHeight = -1;
private $height = -1;
/**
* ZeroHeight for Row?
*
* @var bool
*/
private $_zeroHeight = false;
/**
* Visible?
*
* @var bool
*/
private $_visible = true;
/**
* Outline level
*
* @var int
*/
private $_outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $_collapsed = false;
/**
* Index to cellXf. Null value means row has no explicit cellXf format.
*
* @var int|null
*/
private $_xfIndex;
private $zeroHeight = false;
/**
* Create a new PHPExcel_Worksheet_RowDimension
@ -86,10 +58,10 @@ class PHPExcel_Worksheet_RowDimension
public function __construct($pIndex = 0)
{
// Initialise values
$this->_rowIndex = $pIndex;
$this->rowIndex = $pIndex;
// set row dimension as unformatted by default
$this->_xfIndex = null;
// set dimension as unformatted by default
parent::__construct(null);
}
/**
@ -99,7 +71,7 @@ class PHPExcel_Worksheet_RowDimension
*/
public function getRowIndex()
{
return $this->_rowIndex;
return $this->rowIndex;
}
/**
@ -110,7 +82,7 @@ class PHPExcel_Worksheet_RowDimension
*/
public function setRowIndex($pValue)
{
$this->_rowIndex = $pValue;
$this->rowIndex = $pValue;
return $this;
}
@ -121,7 +93,7 @@ class PHPExcel_Worksheet_RowDimension
*/
public function getRowHeight()
{
return $this->_rowHeight;
return $this->height;
}
/**
@ -132,7 +104,7 @@ class PHPExcel_Worksheet_RowDimension
*/
public function setRowHeight($pValue = -1)
{
$this->_rowHeight = $pValue;
$this->height = $pValue;
return $this;
}
@ -143,7 +115,7 @@ class PHPExcel_Worksheet_RowDimension
*/
public function getZeroHeight()
{
return $this->_zeroHeight;
return $this->zeroHeight;
}
/**
@ -154,117 +126,7 @@ class PHPExcel_Worksheet_RowDimension
*/
public function setZeroHeight($pValue = false)
{
$this->_zeroHeight = $pValue;
$this->zeroHeight = $pValue;
return $this;
}
/**
* Get Visible
*
* @return bool
*/
public function getVisible()
{
return $this->_visible;
}
/**
* Set Visible
*
* @param bool $pValue
* @return PHPExcel_Worksheet_RowDimension
*/
public function setVisible($pValue = true)
{
$this->_visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
* @return int
*/
public function getOutlineLevel()
{
return $this->_outlineLevel;
}
/**
* Set Outline Level
*
* Value must be between 0 and 7
*
* @param int $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_RowDimension
*/
public function setOutlineLevel($pValue)
{
if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
}
$this->_outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
* @return bool
*/
public function getCollapsed()
{
return $this->_collapsed;
}
/**
* Set Collapsed
*
* @param bool $pValue
* @return PHPExcel_Worksheet_RowDimension
*/
public function setCollapsed($pValue = true)
{
$this->_collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
* @return int
*/
public function getXfIndex()
{
return $this->_xfIndex;
}
/**
* Set index to cellXf
*
* @param int $pValue
* @return PHPExcel_Worksheet_RowDimension
*/
public function setXfIndex($pValue = 0)
{
$this->_xfIndex = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Worksheet_SheetView
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Worksheet_SheetView
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Worksheet_SheetView
{
@ -54,7 +46,7 @@ class PHPExcel_Worksheet_SheetView
*
* @var int
*/
private $_zoomScale = 100;
private $zoomScale = 100;
/**
* ZoomScaleNormal
@ -63,7 +55,7 @@ class PHPExcel_Worksheet_SheetView
*
* @var int
*/
private $_zoomScaleNormal = 100;
private $zoomScaleNormal = 100;
/**
* View
@ -72,7 +64,7 @@ class PHPExcel_Worksheet_SheetView
*
* @var string
*/
private $_sheetviewType = self::SHEETVIEW_NORMAL;
private $sheetviewType = self::SHEETVIEW_NORMAL;
/**
* Create a new PHPExcel_Worksheet_SheetView
@ -88,7 +80,7 @@ class PHPExcel_Worksheet_SheetView
*/
public function getZoomScale()
{
return $this->_zoomScale;
return $this->zoomScale;
}
/**
@ -105,7 +97,7 @@ class PHPExcel_Worksheet_SheetView
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
// but it is apparently still able to handle any scale >= 1
if (($pValue >= 1) || is_null($pValue)) {
$this->_zoomScale = $pValue;
$this->zoomScale = $pValue;
} else {
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
}
@ -119,7 +111,7 @@ class PHPExcel_Worksheet_SheetView
*/
public function getZoomScaleNormal()
{
return $this->_zoomScaleNormal;
return $this->zoomScaleNormal;
}
/**
@ -134,7 +126,7 @@ class PHPExcel_Worksheet_SheetView
public function setZoomScaleNormal($pValue = 100)
{
if (($pValue >= 1) || is_null($pValue)) {
$this->_zoomScaleNormal = $pValue;
$this->zoomScaleNormal = $pValue;
} else {
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
}
@ -148,7 +140,7 @@ class PHPExcel_Worksheet_SheetView
*/
public function getView()
{
return $this->_sheetviewType;
return $this->sheetviewType;
}
/**
@ -170,7 +162,7 @@ class PHPExcel_Worksheet_SheetView
$pValue = self::SHEETVIEW_NORMAL;
}
if (in_array($pValue, self::$_sheetViewTypes)) {
$this->_sheetviewType = $pValue;
$this->sheetviewType = $pValue;
} else {
throw new PHPExcel_Exception("Invalid sheetview layout type.");
}

View File

@ -32,49 +32,49 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*
* @var PHPExcel
*/
private $_phpExcel;
private $phpExcel;
/**
* Delimiter
*
* @var string
*/
private $_delimiter = ',';
private $delimiter = ',';
/**
* Enclosure
*
* @var string
*/
private $_enclosure = '"';
private $enclosure = '"';
/**
* Line ending
*
* @var string
*/
private $_lineEnding = PHP_EOL;
private $lineEnding = PHP_EOL;
/**
* Sheet index to write
*
* @var int
*/
private $_sheetIndex = 0;
private $sheetIndex = 0;
/**
* Whether to write a BOM (for UTF8).
*
* @var boolean
*/
private $_useBOM = false;
private $useBOM = false;
/**
* Whether to write a fully Excel compatible CSV file.
*
* @var boolean
*/
private $_excelCompatibility = false;
private $excelCompatibility = false;
/**
* Create a new PHPExcel_Writer_CSV
@ -83,7 +83,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function __construct(PHPExcel $phpExcel)
{
$this->_phpExcel = $phpExcel;
$this->phpExcel = $phpExcel;
}
/**
@ -95,10 +95,10 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
public function save($pFilename = null)
{
// Fetch sheet
$sheet = $this->_phpExcel->getSheet($this->_sheetIndex);
$sheet = $this->phpExcel->getSheet($this->sheetIndex);
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
@ -108,13 +108,13 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
}
if ($this->_excelCompatibility) {
if ($this->excelCompatibility) {
fwrite($fileHandle, "\xEF\xBB\xBF"); // Enforce UTF-8 BOM Header
$this->setEnclosure('"'); // Set enclosure to "
$this->setDelimiter(";"); // Set delimiter to a semi-colon
$this->setLineEnding("\r\n");
fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->_lineEnding);
} elseif ($this->_useBOM) {
fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->lineEnding);
} elseif ($this->useBOM) {
// Write the UTF-8 BOM code if required
fwrite($fileHandle, "\xEF\xBB\xBF");
}
@ -135,7 +135,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
fclose($fileHandle);
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
}
/**
@ -145,7 +145,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function getDelimiter()
{
return $this->_delimiter;
return $this->delimiter;
}
/**
@ -156,7 +156,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function setDelimiter($pValue = ',')
{
$this->_delimiter = $pValue;
$this->delimiter = $pValue;
return $this;
}
@ -167,7 +167,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function getEnclosure()
{
return $this->_enclosure;
return $this->enclosure;
}
/**
@ -181,7 +181,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
if ($pValue == '') {
$pValue = null;
}
$this->_enclosure = $pValue;
$this->enclosure = $pValue;
return $this;
}
@ -192,7 +192,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function getLineEnding()
{
return $this->_lineEnding;
return $this->lineEnding;
}
/**
@ -203,7 +203,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function setLineEnding($pValue = PHP_EOL)
{
$this->_lineEnding = $pValue;
$this->lineEnding = $pValue;
return $this;
}
@ -214,7 +214,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function getUseBOM()
{
return $this->_useBOM;
return $this->useBOM;
}
/**
@ -225,7 +225,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function setUseBOM($pValue = false)
{
$this->_useBOM = $pValue;
$this->useBOM = $pValue;
return $this;
}
@ -236,7 +236,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function getExcelCompatibility()
{
return $this->_excelCompatibility;
return $this->excelCompatibility;
}
/**
@ -248,7 +248,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function setExcelCompatibility($pValue = false)
{
$this->_excelCompatibility = $pValue;
$this->excelCompatibility = $pValue;
return $this;
}
@ -259,7 +259,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function getSheetIndex()
{
return $this->_sheetIndex;
return $this->sheetIndex;
}
/**
@ -270,7 +270,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/
public function setSheetIndex($pValue = 0)
{
$this->_sheetIndex = $pValue;
$this->sheetIndex = $pValue;
return $this;
}
@ -292,21 +292,21 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
foreach ($pValues as $element) {
// Escape enclosures
$element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element);
$element = str_replace($this->enclosure, $this->enclosure . $this->enclosure, $element);
// Add delimiter
if ($writeDelimiter) {
$line .= $this->_delimiter;
$line .= $this->delimiter;
} else {
$writeDelimiter = true;
}
// Add enclosed string
$line .= $this->_enclosure . $element . $this->_enclosure;
$line .= $this->enclosure . $element . $this->enclosure;
}
// Add line ending
$line .= $this->_lineEnding;
$line .= $this->lineEnding;
// Write to file
fwrite($pFileHandle, $line);

View File

@ -368,7 +368,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
}
$objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
} else if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
} elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
ob_start();
call_user_func(
$this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(),

View File

@ -145,7 +145,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
$mimeType = $this->_getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath());
} else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
} elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension);
$extension = $extension[1];

View File

@ -123,7 +123,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
}
$objWriter->writeRawData($textToWrite);
$objWriter->endElement();
} else if ($textElement instanceof PHPExcel_RichText) {
} elseif ($textElement instanceof PHPExcel_RichText) {
$this->writeRichText($objWriter, $textElement);
}
@ -184,7 +184,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$objWriter->startElement($prefix.'vertAlign');
if ($element->getFont()->getSuperScript()) {
$objWriter->writeAttribute('val', 'superscript');
} else if ($element->getFont()->getSubScript()) {
} elseif ($element->getFont()->getSubScript()) {
$objWriter->writeAttribute('val', 'subscript');
}
$objWriter->endElement();
@ -280,7 +280,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
// $objWriter->startElement($prefix.'vertAlign');
// if ($element->getFont()->getSuperScript()) {
// $objWriter->writeAttribute('val', 'superscript');
// } else if ($element->getFont()->getSubScript()) {
// } elseif ($element->getFont()->getSubScript()) {
// $objWriter->writeAttribute('val', 'subscript');
// }
// $objWriter->endElement();
@ -313,7 +313,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
foreach ($stringTable as $key => $value) {
if (! $value instanceof PHPExcel_RichText) {
$returnValue[$value] = $key;
} else if ($value instanceof PHPExcel_RichText) {
} elseif ($value instanceof PHPExcel_RichText) {
$returnValue[$value->getHashCode()] = $key;
}
}

View File

@ -317,7 +317,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->startElement('vertAlign');
if ($pFont->getSuperScript() === true) {
$objWriter->writeAttribute('val', 'superscript');
} else if ($pFont->getSubScript() === true) {
} elseif ($pFont->getSubScript() === true) {
$objWriter->writeAttribute('val', 'subscript');
}
$objWriter->endElement();
@ -428,7 +428,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$textRotation = 0;
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
$textRotation = $pStyle->getAlignment()->getTextRotation();
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
} elseif ($pStyle->getAlignment()->getTextRotation() < 0) {
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
}
$objWriter->writeAttribute('textRotation', $textRotation);
@ -493,7 +493,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$textRotation = 0;
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
$textRotation = $pStyle->getAlignment()->getTextRotation();
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
} elseif ($pStyle->getAlignment()->getTextRotation() < 0) {
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
}
$objWriter->writeAttribute('textRotation', $textRotation);

View File

@ -506,19 +506,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
} elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
} elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
} elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
} elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
foreach ($conditional->getConditions() as $formula) {
@ -910,7 +910,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
foreach ($pSheet->getBreaks() as $cell => $breakType) {
if ($breakType == PHPExcel_Worksheet::BREAK_ROW) {
$aRowBreaks[] = $cell;
} else if ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) {
} elseif ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) {
$aColumnBreaks[] = $cell;
}
}
@ -1095,7 +1095,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
case 'inlinestr': // Inline string
if (! $cellValue instanceof PHPExcel_RichText) {
$objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
} else if ($cellValue instanceof PHPExcel_RichText) {
} elseif ($cellValue instanceof PHPExcel_RichText) {
$objWriter->startElement('is');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
$objWriter->endElement();
@ -1107,7 +1107,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if (isset($pFlippedStringTable[$cellValue])) {
$objWriter->writeElement('v', $pFlippedStringTable[$cellValue]);
}
} else if ($cellValue instanceof PHPExcel_RichText) {
} elseif ($cellValue instanceof PHPExcel_RichText) {
$objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]);
}

View File

@ -32,63 +32,63 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
*
* @var PHPExcel
*/
private $_phpExcel;
private $phpExcel;
/**
* Total number of shared strings in workbook
*
* @var int
*/
private $_str_total = 0;
private $strTotal = 0;
/**
* Number of unique shared strings in workbook
*
* @var int
*/
private $_str_unique = 0;
private $strUnique = 0;
/**
* Array of unique shared strings in workbook
*
* @var array
*/
private $_str_table = array();
private $strTable = array();
/**
* Color cache. Mapping between RGB value and color index.
*
* @var array
*/
private $_colors;
private $colors;
/**
* Formula parser
*
* @var PHPExcel_Writer_Excel5_Parser
*/
private $_parser;
private $parser;
/**
* Identifier clusters for drawings. Used in MSODRAWINGGROUP record.
*
* @var array
*/
private $_IDCLs;
private $IDCLs;
/**
* Basic OLE object summary information
*
* @var array
*/
private $_summaryInformation;
private $summaryInformation;
/**
* Extended OLE object document summary information
*
* @var array
*/
private $_documentSummaryInformation;
private $documentSummaryInformation;
/**
* Create a new PHPExcel_Writer_Excel5
@ -97,9 +97,9 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
*/
public function __construct(PHPExcel $phpExcel)
{
$this->_phpExcel = $phpExcel;
$this->phpExcel = $phpExcel;
$this->_parser = new PHPExcel_Writer_Excel5_Parser();
$this->parser = new PHPExcel_Writer_Excel5_Parser();
}
/**
@ -112,38 +112,38 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
{
// garbage collect
$this->_phpExcel->garbageCollect();
$this->phpExcel->garbageCollect();
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// initialize colors array
$this->_colors = array();
$this->colors = array();
// Initialise workbook writer
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->phpExcel, $this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser);
// Initialise worksheet writers
$countSheets = $this->_phpExcel->getSheetCount();
$countSheets = $this->phpExcel->getSheetCount();
for ($i = 0; $i < $countSheets; ++$i) {
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $this->_phpExcel->getSheet($i));
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser, $this->_preCalculateFormulas, $this->phpExcel->getSheet($i));
}
// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
$this->_buildWorksheetEschers();
$this->_buildWorkbookEscher();
$this->buildWorksheetEschers();
$this->buildWorkbookEscher();
// add 15 identical cell style Xfs
// for now, we use the first cellXf instead of cellStyleXf
$cellXfCollection = $this->_phpExcel->getCellXfCollection();
$cellXfCollection = $this->phpExcel->getCellXfCollection();
for ($i = 0; $i < 15; ++$i) {
$this->_writerWorkbook->addXfWriter($cellXfCollection[0], true);
}
// add all the cell Xfs
foreach ($this->_phpExcel->getCellXfCollection() as $style) {
foreach ($this->phpExcel->getCellXfCollection() as $style) {
$this->_writerWorkbook->addXfWriter($style, false);
}
@ -184,18 +184,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$OLE->append($this->_writerWorksheets[$i]->getData());
}
$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation();
$this->documentSummaryInformation = $this->writeDocumentSummaryInformation();
// initialize OLE Document Summary Information
if (isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)) {
if (isset($this->documentSummaryInformation) && !empty($this->documentSummaryInformation)) {
$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation);
$OLE_DocumentSummaryInformation->append($this->documentSummaryInformation);
}
$this->_summaryInformation = $this->_writeSummaryInformation();
$this->summaryInformation = $this->writeSummaryInformation();
// initialize OLE Summary Information
if (isset($this->_summaryInformation) && !empty($this->_summaryInformation)) {
if (isset($this->summaryInformation) && !empty($this->summaryInformation)) {
$OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
$OLE_SummaryInformation->append($this->_summaryInformation);
$OLE_SummaryInformation->append($this->summaryInformation);
}
// define OLE Parts
@ -214,7 +214,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$res = $root->save($pFilename);
PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
}
/**
@ -234,14 +234,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the Worksheet Escher objects
*
*/
private function _buildWorksheetEschers()
private function buildWorksheetEschers()
{
// 1-based index to BstoreContainer
$blipIndex = 0;
$lastReducedSpId = 0;
$lastSpId = 0;
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
foreach ($this->phpExcel->getAllsheets() as $sheet) {
// sheet index
$sheetIndex = $sheet->getParent()->getIndex($sheet);
@ -385,7 +385,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
}
// identifier clusters, used for workbook Escher object
$this->_IDCLs[$dgId] = $lastReducedSpId;
$this->IDCLs[$dgId] = $lastReducedSpId;
// set last shape index
$dgContainer->setLastSpId($lastSpId);
@ -398,13 +398,13 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
/**
* Build the Escher object corresponding to the MSODRAWINGGROUP record
*/
private function _buildWorkbookEscher()
private function buildWorkbookEscher()
{
$escher = null;
// any drawings in this workbook?
$found = false;
foreach ($this->_phpExcel->getAllSheets() as $sheet) {
foreach ($this->phpExcel->getAllSheets() as $sheet) {
if (count($sheet->getDrawingCollection()) > 0) {
$found = true;
break;
@ -424,14 +424,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$escher->setDggContainer($dggContainer);
// set IDCLs (identifier clusters)
$dggContainer->setIDCLs($this->_IDCLs);
$dggContainer->setIDCLs($this->IDCLs);
// this loop is for determining maximum shape identifier of all drawing
$spIdMax = 0;
$totalCountShapes = 0;
$countDrawings = 0;
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
foreach ($this->phpExcel->getAllsheets() as $sheet) {
$sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet
if (count($sheet->getDrawingCollection()) > 0) {
@ -441,7 +441,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
++$sheetCountShapes;
++$totalCountShapes;
$spId = $sheetCountShapes | ($this->_phpExcel->getIndex($sheet) + 1) << 10;
$spId = $sheetCountShapes | ($this->phpExcel->getIndex($sheet) + 1) << 10;
$spIdMax = max($spId, $spIdMax);
}
}
@ -456,7 +456,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dggContainer->setBstoreContainer($bstoreContainer);
// the BSE's (all the images)
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
foreach ($this->phpExcel->getAllsheets() as $sheet) {
foreach ($sheet->getDrawingCollection() as $drawing) {
if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
$filename = $drawing->getPath();
@ -498,7 +498,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$BSE->setBlip($blip);
$bstoreContainer->addBSE($BSE);
} else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
} elseif ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
switch ($drawing->getRenderingFunction()) {
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
@ -537,7 +537,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for DocumentSummary Information
* @return string
*/
private function _writeDocumentSummaryInformation()
private function writeDocumentSummaryInformation()
{
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE);
@ -571,8 +571,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
// GKPIDDSI_CATEGORY : Category
if ($this->_phpExcel->getProperties()->getCategory()) {
$dataProp = $this->_phpExcel->getProperties()->getCategory();
if ($this->phpExcel->getProperties()->getCategory()) {
$dataProp = $this->phpExcel->getProperties()->getCategory();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E),
@ -733,7 +733,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for Summary Information
* @return string
*/
private function _writeSummaryInformation()
private function writeSummaryInformation()
{
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE);
@ -767,8 +767,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
// Title
if ($this->_phpExcel->getProperties()->getTitle()) {
$dataProp = $this->_phpExcel->getProperties()->getTitle();
if ($this->phpExcel->getProperties()->getTitle()) {
$dataProp = $this->phpExcel->getProperties()->getTitle();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -776,8 +776,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Subject
if ($this->_phpExcel->getProperties()->getSubject()) {
$dataProp = $this->_phpExcel->getProperties()->getSubject();
if ($this->phpExcel->getProperties()->getSubject()) {
$dataProp = $this->phpExcel->getProperties()->getSubject();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -785,8 +785,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Author (Creator)
if ($this->_phpExcel->getProperties()->getCreator()) {
$dataProp = $this->_phpExcel->getProperties()->getCreator();
if ($this->phpExcel->getProperties()->getCreator()) {
$dataProp = $this->phpExcel->getProperties()->getCreator();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -794,8 +794,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Keywords
if ($this->_phpExcel->getProperties()->getKeywords()) {
$dataProp = $this->_phpExcel->getProperties()->getKeywords();
if ($this->phpExcel->getProperties()->getKeywords()) {
$dataProp = $this->phpExcel->getProperties()->getKeywords();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -803,8 +803,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Comments (Description)
if ($this->_phpExcel->getProperties()->getDescription()) {
$dataProp = $this->_phpExcel->getProperties()->getDescription();
if ($this->phpExcel->getProperties()->getDescription()) {
$dataProp = $this->phpExcel->getProperties()->getDescription();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -812,8 +812,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Last Saved By (LastModifiedBy)
if ($this->_phpExcel->getProperties()->getLastModifiedBy()) {
$dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy();
if ($this->phpExcel->getProperties()->getLastModifiedBy()) {
$dataProp = $this->phpExcel->getProperties()->getLastModifiedBy();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -821,8 +821,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Created Date/Time
if ($this->_phpExcel->getProperties()->getCreated()) {
$dataProp = $this->_phpExcel->getProperties()->getCreated();
if ($this->phpExcel->getProperties()->getCreated()) {
$dataProp = $this->phpExcel->getProperties()->getCreated();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
@ -830,8 +830,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Modified Date/Time
if ($this->_phpExcel->getProperties()->getModified()) {
$dataProp = $this->_phpExcel->getProperties()->getModified();
if ($this->phpExcel->getProperties()->getModified()) {
$dataProp = $this->phpExcel->getProperties()->getModified();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)

View File

@ -82,7 +82,7 @@ class PHPExcel_Writer_Excel5_Escher
if ($dggContainer = $this->_object->getDggContainer()) {
$writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
$this->_data = $writer->close();
} else if ($dgContainer = $this->_object->getDgContainer()) {
} elseif ($dgContainer = $this->_object->getDgContainer()) {
$writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
$this->_data = $writer->close();
$this->_spOffsets = $writer->getSpOffsets();

View File

@ -83,7 +83,7 @@ class PHPExcel_Writer_Excel5_Font
$icv = $this->_colorIndex; // Index to color palette
if ($this->_font->getSuperScript()) {
$sss = 1;
} else if ($this->_font->getSubScript()) {
} elseif ($this->_font->getSubScript()) {
$sss = 2;
} else {
$sss = 0;

View File

@ -610,7 +610,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
);
// (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
} elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
@ -717,7 +717,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$chunk .= $this->writeData($this->_writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true));
// (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
} elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();

View File

@ -504,7 +504,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// internal to current workbook
$url = str_replace('sheet://', 'internal:', $url);
} else if (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) {
} elseif (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) {
// URL
// $url = $url;
@ -3048,7 +3048,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
$type = 0x02;
$operatorType = 0x00;
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
} elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
$type = 0x01;
switch ($conditional->getOperatorType()) {
@ -3089,7 +3089,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$szValue2 = 0x0000;
$operand1 = pack('Cv', 0x1E, $arrConditions[0]);
$operand2 = null;
} else if ($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)) {
} elseif ($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)) {
$szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000);
$szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000);
$operand1 = pack('Cv', 0x1E, $arrConditions[0]);
@ -3226,7 +3226,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($conditional->getStyle()->getFont()->getSubScript() == true) {
$dataBlockFont .= pack('v', 0x02);
$fontEscapement = 0;
} else if ($conditional->getStyle()->getFont()->getSuperScript() == true) {
} elseif ($conditional->getStyle()->getFont()->getSuperScript() == true) {
$dataBlockFont .= pack('v', 0x01);
$fontEscapement = 0;
} else {

View File

@ -75,61 +75,61 @@ class PHPExcel_Writer_Excel5_Xf
*
* @var boolean
*/
private $_isStyleXf;
private $isStyleXf;
/**
* Index to the FONT record. Index 4 does not exist
* @var integer
*/
private $_fontIndex;
private $fontIndex;
/**
* An index (2 bytes) to a FORMAT record (number format).
* @var integer
*/
public $_numberFormatIndex;
private $numberFormatIndex;
/**
* 1 bit, apparently not used.
* @var integer
*/
public $_text_justlast;
private $textJustLast;
/**
* The cell's foreground color.
* @var integer
*/
public $_fg_color;
private $foregroundColor;
/**
* The cell's background color.
* @var integer
*/
public $_bg_color;
private $backgroundColor;
/**
* Color of the bottom border of the cell.
* @var integer
*/
public $_bottom_color;
private $bottomBorderColor;
/**
* Color of the top border of the cell.
* @var integer
*/
public $_top_color;
private $topBorderColor;
/**
* Color of the left border of the cell.
* @var integer
*/
public $_left_color;
private $leftBorderColor;
/**
* Color of the right border of the cell.
* @var integer
*/
public $_right_color;
private $rightBorderColor;
/**
* Constructor
@ -139,22 +139,22 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function __construct(PHPExcel_Style $style = null)
{
$this->_isStyleXf = false;
$this->_fontIndex = 0;
$this->isStyleXf = false;
$this->fontIndex = 0;
$this->_numberFormatIndex = 0;
$this->numberFormatIndex = 0;
$this->_text_justlast = 0;
$this->textJustLast = 0;
$this->_fg_color = 0x40;
$this->_bg_color = 0x41;
$this->foregroundColor = 0x40;
$this->backgroundColor = 0x41;
$this->_diag = 0;
$this->_bottom_color = 0x40;
$this->_top_color = 0x40;
$this->_left_color = 0x40;
$this->_right_color = 0x40;
$this->bottomBorderColor = 0x40;
$this->topBorderColor = 0x40;
$this->leftBorderColor = 0x40;
$this->rightBorderColor = 0x40;
$this->_diag_color = 0x40;
$this->_style = $style;
@ -169,54 +169,54 @@ class PHPExcel_Writer_Excel5_Xf
public function writeXf()
{
// Set the type of the XF record and some of the attributes.
if ($this->_isStyleXf) {
if ($this->isStyleXf) {
$style = 0xFFF5;
} else {
$style = self::_mapLocked($this->_style->getProtection()->getLocked());
$style |= self::_mapHidden($this->_style->getProtection()->getHidden()) << 1;
$style = self::mapLocked($this->_style->getProtection()->getLocked());
$style |= self::mapHidden($this->_style->getProtection()->getHidden()) << 1;
}
// Flags to indicate if attributes have been set.
$atr_num = ($this->_numberFormatIndex != 0)?1:0;
$atr_fnt = ($this->_fontIndex != 0)?1:0;
$atr_num = ($this->numberFormatIndex != 0)?1:0;
$atr_fnt = ($this->fontIndex != 0)?1:0;
$atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0;
$atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0;
$atr_pat = (($this->_fg_color != 0x40) ||
($this->_bg_color != 0x41) ||
self::_mapFillType($this->_style->getFill()->getFillType()))?1:0;
$atr_prot = self::_mapLocked($this->_style->getProtection()->getLocked())
| self::_mapHidden($this->_style->getProtection()->getHidden());
$atr_bdr = (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0;
$atr_pat = (($this->foregroundColor != 0x40) ||
($this->backgroundColor != 0x41) ||
self::mapFillType($this->_style->getFill()->getFillType()))?1:0;
$atr_prot = self::mapLocked($this->_style->getProtection()->getLocked())
| self::mapHidden($this->_style->getProtection()->getHidden());
// Zero the default border colour if the border has not been set.
if (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
$this->_bottom_color = 0;
if (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
$this->bottomBorderColor = 0;
}
if (self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
$this->_top_color = 0;
if (self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
$this->topBorderColor = 0;
}
if (self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
$this->_right_color = 0;
if (self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
$this->rightBorderColor = 0;
}
if (self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) {
$this->_left_color = 0;
if (self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) {
$this->leftBorderColor = 0;
}
if (self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) {
if (self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) {
$this->_diag_color = 0;
}
$record = 0x00E0; // Record identifier
$length = 0x0014; // Number of bytes to follow
$ifnt = $this->_fontIndex; // Index to FONT record
$ifmt = $this->_numberFormatIndex; // Index to FORMAT record
$ifnt = $this->fontIndex; // Index to FONT record
$ifmt = $this->numberFormatIndex; // Index to FORMAT record
$align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment
$align = $this->mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment
$align |= (int) $this->_style->getAlignment()->getWrapText() << 3;
$align |= self::_mapVAlign($this->_style->getAlignment()->getVertical()) << 4;
$align |= $this->_text_justlast << 7;
$align |= self::mapVAlign($this->_style->getAlignment()->getVertical()) << 4;
$align |= $this->textJustLast << 7;
$used_attrib = $atr_num << 2;
$used_attrib |= $atr_fnt << 3;
@ -225,15 +225,15 @@ class PHPExcel_Writer_Excel5_Xf
$used_attrib |= $atr_pat << 6;
$used_attrib |= $atr_prot << 7;
$icv = $this->_fg_color; // fg and bg pattern colors
$icv |= $this->_bg_color << 7;
$icv = $this->foregroundColor; // fg and bg pattern colors
$icv |= $this->backgroundColor << 7;
$border1 = self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4;
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8;
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12;
$border1 |= $this->_left_color << 16;
$border1 |= $this->_right_color << 23;
$border1 = self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color
$border1 |= self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4;
$border1 |= self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8;
$border1 |= self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12;
$border1 |= $this->leftBorderColor << 16;
$border1 |= $this->rightBorderColor << 23;
$diagonalDirection = $this->_style->getBorders()->getDiagonalDirection();
$diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH
@ -243,11 +243,11 @@ class PHPExcel_Writer_Excel5_Xf
$border1 |= $diag_tl_to_rb << 30;
$border1 |= $diag_tr_to_lb << 31;
$border2 = $this->_top_color; // Border color
$border2 |= $this->_bottom_color << 7;
$border2 = $this->topBorderColor; // Border color
$border2 |= $this->bottomBorderColor << 7;
$border2 |= $this->_diag_color << 14;
$border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
$border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26;
$border2 |= self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
$border2 |= self::mapFillType($this->_style->getFill()->getFillType()) << 26;
$header = pack("vv", $record, $length);
@ -256,7 +256,7 @@ class PHPExcel_Writer_Excel5_Xf
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
$data = pack("vvvC", $ifnt, $ifmt, $style, $align);
$data .= pack("CCC", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
$data .= pack("CCC", self::mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
$data .= pack("VVv", $border1, $border2, $icv);
return($header . $data);
@ -269,7 +269,7 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function setIsStyleXf($value)
{
$this->_isStyleXf = $value;
$this->isStyleXf = $value;
}
/**
@ -280,7 +280,7 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function setBottomColor($colorIndex)
{
$this->_bottom_color = $colorIndex;
$this->bottomBorderColor = $colorIndex;
}
/**
@ -291,7 +291,7 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function setTopColor($colorIndex)
{
$this->_top_color = $colorIndex;
$this->topBorderColor = $colorIndex;
}
/**
@ -302,7 +302,7 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function setLeftColor($colorIndex)
{
$this->_left_color = $colorIndex;
$this->leftBorderColor = $colorIndex;
}
/**
@ -313,7 +313,7 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function setRightColor($colorIndex)
{
$this->_right_color = $colorIndex;
$this->rightBorderColor = $colorIndex;
}
/**
@ -336,7 +336,7 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function setFgColor($colorIndex)
{
$this->_fg_color = $colorIndex;
$this->foregroundColor = $colorIndex;
}
/**
@ -347,7 +347,7 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function setBgColor($colorIndex)
{
$this->_bg_color = $colorIndex;
$this->backgroundColor = $colorIndex;
}
/**
@ -359,7 +359,7 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function setNumberFormatIndex($numberFormatIndex)
{
$this->_numberFormatIndex = $numberFormatIndex;
$this->numberFormatIndex = $numberFormatIndex;
}
/**
@ -369,7 +369,7 @@ class PHPExcel_Writer_Excel5_Xf
*/
public function setFontIndex($value)
{
$this->_fontIndex = $value;
$this->fontIndex = $value;
}
/**
@ -377,7 +377,8 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int
*
*/
private static $_mapBorderStyle = array ( PHPExcel_Style_Border::BORDER_NONE => 0x00,
private static $mapBorderStyles = array(
PHPExcel_Style_Border::BORDER_NONE => 0x00,
PHPExcel_Style_Border::BORDER_THIN => 0x01,
PHPExcel_Style_Border::BORDER_MEDIUM => 0x02,
PHPExcel_Style_Border::BORDER_DASHED => 0x03,
@ -399,10 +400,10 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $borderStyle
* @return int
*/
private static function _mapBorderStyle($borderStyle)
private static function mapBorderStyle($borderStyle)
{
if (isset(self::$_mapBorderStyle[$borderStyle])) {
return self::$_mapBorderStyle[$borderStyle];
if (isset(self::$mapBorderStyles[$borderStyle])) {
return self::$mapBorderStyles[$borderStyle];
}
return 0x00;
}
@ -412,7 +413,8 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int
*
*/
private static $_mapFillType = array( PHPExcel_Style_Fill::FILL_NONE => 0x00,
private static $mapFillTypes = array(
PHPExcel_Style_Fill::FILL_NONE => 0x00,
PHPExcel_Style_Fill::FILL_SOLID => 0x01,
PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02,
PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03,
@ -434,16 +436,17 @@ class PHPExcel_Writer_Excel5_Xf
PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8
PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8
);
/**
* Map fill type
*
* @param string $fillType
* @return int
*/
private static function _mapFillType($fillType)
private static function mapFillType($fillType)
{
if (isset(self::$_mapFillType[$fillType])) {
return self::$_mapFillType[$fillType];
if (isset(self::$mapFillTypes[$fillType])) {
return self::$mapFillTypes[$fillType];
}
return 0x00;
}
@ -453,7 +456,8 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int
*
*/
private static $_mapHAlign = array( PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0,
private static $mapHAlignments = array(
PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0,
PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2,
PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3,
@ -461,16 +465,17 @@ class PHPExcel_Writer_Excel5_Xf
PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6,
);
/**
* Map to BIFF2-BIFF8 codes for horizontal alignment
*
* @param string $hAlign
* @return int
*/
private function _mapHAlign($hAlign)
private function mapHAlign($hAlign)
{
if (isset(self::$_mapHAlign[$hAlign])) {
return self::$_mapHAlign[$hAlign];
if (isset(self::$mapHAlignments[$hAlign])) {
return self::$mapHAlignments[$hAlign];
}
return 0;
}
@ -480,21 +485,23 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int
*
*/
private static $_mapVAlign = array( PHPExcel_Style_Alignment::VERTICAL_TOP => 0,
private static $mapVAlignments = array(
PHPExcel_Style_Alignment::VERTICAL_TOP => 0,
PHPExcel_Style_Alignment::VERTICAL_CENTER => 1,
PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2,
PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3,
);
/**
* Map to BIFF2-BIFF8 codes for vertical alignment
*
* @param string $vAlign
* @return int
*/
private static function _mapVAlign($vAlign)
private static function mapVAlign($vAlign)
{
if (isset(self::$_mapVAlign[$vAlign])) {
return self::$_mapVAlign[$vAlign];
if (isset(self::$mapVAlignments[$vAlign])) {
return self::$mapVAlignments[$vAlign];
}
return 2;
}
@ -505,15 +512,13 @@ class PHPExcel_Writer_Excel5_Xf
* @param int $textRotation
* @return int
*/
private static function _mapTextRotation($textRotation)
private static function mapTextRotation($textRotation)
{
if ($textRotation >= 0) {
return $textRotation;
}
if ($textRotation == -165) {
} elseif ($textRotation == -165) {
return 255;
}
if ($textRotation < 0) {
} elseif ($textRotation < 0) {
return 90 - $textRotation;
}
}
@ -524,7 +529,7 @@ class PHPExcel_Writer_Excel5_Xf
* @param string
* @return int
*/
private static function _mapLocked($locked)
private static function mapLocked($locked)
{
switch ($locked) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT:
@ -544,7 +549,7 @@ class PHPExcel_Writer_Excel5_Xf
* @param string
* @return int
*/
private static function _mapHidden($hidden)
private static function mapHidden($hidden)
{
switch ($hidden) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT:

View File

@ -32,14 +32,14 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*
* @var string
*/
protected $_tempDir = '';
protected $tempDir = '';
/**
* Font
*
* @var string
*/
protected $_font = 'freesans';
protected $font = 'freesans';
/**
* Orientation (Over-ride)
@ -212,7 +212,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
{
parent::__construct($phpExcel);
$this->setUseInlineCss(true);
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
$this->tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
}
/**
@ -222,7 +222,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*/
public function getFont()
{
return $this->_font;
return $this->font;
}
/**
@ -236,7 +236,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*/
public function setFont($fontName)
{
$this->_font = $fontName;
$this->font = $fontName;
return $this;
}
@ -291,7 +291,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*/
public function getTempDir()
{
return $this->_tempDir;
return $this->tempDir;
}
/**
@ -304,7 +304,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
public function setTempDir($pValue = '')
{
if (is_dir($pValue)) {
$this->_tempDir = $pValue;
$this->tempDir = $pValue;
} else {
throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue");
}

View File

@ -6,8 +6,7 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -46,11 +45,10 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase
public function testAutoloadInstantiateSuccess()
{
$result = new PHPExcel_Calculation_Function(1,2,3);
$result = new PHPExcel_Calculation_Function(1, 2, 3);
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'PHPExcel_Calculation_Function'));
$this->assertTrue(is_a($result, 'PHPExcel_Calculation_Function'));
}
}

View File

@ -8,8 +8,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -24,8 +23,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDATE()
@ -36,38 +35,38 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function testDATEtoPHP()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
$result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1327968000, $result, NULL, 1E-8);
$this->assertEquals(1327968000, $result, null, 1E-8);
}
public function testDATEtoPHPObject()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
$result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012');
$this->assertEquals($result->format('d-M-Y'), '31-Jan-2012');
}
public function testDATEwith1904Calendar()
{
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
$result = PHPExcel_Calculation_DateTime::DATE(1918,11,11);
$result = PHPExcel_Calculation_DateTime::DATE(1918, 11, 11);
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
$this->assertEquals($result,5428);
$this->assertEquals($result, 5428);
}
public function testDATEwith1904CalendarError()
{
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
$result = PHPExcel_Calculation_DateTime::DATE(1901,1,31);
$result = PHPExcel_Calculation_DateTime::DATE(1901, 1, 31);
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
$this->assertEquals($result,'#NUM!');
$this->assertEquals($result, '#NUM!');
}
/**
@ -77,8 +76,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEVALUE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEVALUE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDATEVALUE()
@ -91,7 +90,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1327968000, $result, NULL, 1E-8);
$this->assertEquals(1327968000, $result, null, 1E-8);
}
public function testDATEVALUEtoPHPObject()
@ -102,9 +101,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012');
$this->assertEquals($result->format('d-M-Y'), '31-Jan-2012');
}
/**
@ -114,8 +113,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEAR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEAR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerYEAR()
@ -130,8 +129,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MONTHOFYEAR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MONTHOFYEAR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerMONTH()
@ -146,8 +145,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WEEKOFYEAR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WEEKOFYEAR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerWEEKNUM()
@ -162,8 +161,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFWEEK'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFWEEK'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerWEEKDAY()
@ -178,8 +177,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFMONTH'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFMONTH'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDAY()
@ -194,8 +193,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIME'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIME'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerTIME()
@ -206,22 +205,22 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function testTIMEtoPHP()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
$result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(27020, $result, NULL, 1E-8);
$this->assertEquals(27020, $result, null, 1E-8);
}
public function testTIMEtoPHPObject()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
$result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('H:i:s'),'07:30:20');
$this->assertEquals($result->format('H:i:s'), '07:30:20');
}
/**
@ -231,8 +230,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIMEVALUE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIMEVALUE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerTIMEVALUE()
@ -245,7 +244,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(23420, $result, NULL, 1E-8);
$this->assertEquals(23420, $result, null, 1E-8);
}
public function testTIMEVALUEtoPHPObject()
@ -256,9 +255,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('H:i:s'),'07:30:20');
$this->assertEquals($result->format('H:i:s'), '07:30:20');
}
/**
@ -268,8 +267,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','HOUROFDAY'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'HOUROFDAY'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerHOUR()
@ -284,8 +283,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MINUTEOFHOUR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MINUTEOFHOUR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerMINUTE()
@ -300,8 +299,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','SECONDOFMINUTE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'SECONDOFMINUTE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerSECOND()
@ -316,8 +315,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','NETWORKDAYS'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'NETWORKDAYS'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerNETWORKDAYS()
@ -332,8 +331,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WORKDAY'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WORKDAY'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerWORKDAY()
@ -348,8 +347,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EDATE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EDATE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerEDATE()
@ -360,22 +359,22 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function testEDATEtoPHP()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1);
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1324857600, $result, NULL, 1E-8);
$this->assertEquals(1324857600, $result, null, 1E-8);
}
public function testEDATEtoPHPObject()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1);
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'26-Dec-2011');
$this->assertEquals($result->format('d-M-Y'), '26-Dec-2011');
}
/**
@ -385,8 +384,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EOMONTH'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EOMONTH'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerEOMONTH()
@ -397,22 +396,22 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function testEOMONTHtoPHP()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1);
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1325289600, $result, NULL, 1E-8);
$this->assertEquals(1325289600, $result, null, 1E-8);
}
public function testEOMONTHtoPHPObject()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1);
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Dec-2011');
$this->assertEquals($result->format('d-M-Y'), '31-Dec-2011');
}
/**
@ -422,8 +421,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEDIF'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEDIF'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDATEDIF()
@ -438,8 +437,8 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYS360'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYS360'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDAYS360()
@ -454,13 +453,12 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEARFRAC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEARFRAC'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerYEARFRAC()
{
return new testDataFileIterator('rawTestData/Calculation/DateTime/YEARFRAC.data');
}
}

View File

@ -12,8 +12,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -28,8 +27,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELI'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELI'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerBESSELI()
@ -44,8 +43,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELJ'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELJ'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerBESSELJ()
@ -60,8 +59,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELK'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELK'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerBESSELK()
@ -76,8 +75,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELY'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELY'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerBESSELY()
@ -92,7 +91,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','COMPLEX'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','COMPLEX'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -108,8 +107,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMAGINARY'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMAGINARY'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIMAGINARY()
@ -124,8 +123,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMREAL'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMREAL'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIMREAL()
@ -140,8 +139,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMABS'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMABS'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIMABS()
@ -156,8 +155,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMARGUMENT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMARGUMENT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIMARGUMENT()
@ -172,10 +171,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCONJUGATE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCONJUGATE'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMCONJUGATE()
@ -190,10 +188,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCOS'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCOS'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMCOS()
@ -208,10 +205,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMDIV'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMDIV'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMDIV()
@ -226,10 +222,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMEXP'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMEXP'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMEXP()
@ -244,10 +239,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLN'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLN'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMLN()
@ -262,10 +256,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG2'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG2'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMLOG2()
@ -280,10 +273,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG10'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG10'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMLOG10()
@ -298,10 +290,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPOWER'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPOWER'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMPOWER()
@ -316,10 +307,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPRODUCT'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPRODUCT'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMPRODUCT()
@ -334,10 +324,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSIN'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSIN'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMSIN()
@ -352,10 +341,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSQRT'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSQRT'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMSQRT()
@ -370,10 +358,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUB'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUB'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMSUB()
@ -388,10 +375,9 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUM'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUM'), $args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
}
public function providerIMSUM()
@ -406,8 +392,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERF'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERF'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerERF()
@ -422,8 +408,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERFC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERFC'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerERFC()
@ -438,7 +424,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTODEC'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTODEC'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -454,7 +440,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTOHEX'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTOHEX'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -470,7 +456,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTOOCT'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTOOCT'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -486,8 +472,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOBIN'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOBIN'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerDEC2BIN()
@ -502,8 +488,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOHEX'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOHEX'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerDEC2HEX()
@ -518,8 +504,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOOCT'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOOCT'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerDEC2OCT()
@ -534,8 +520,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOBIN'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOBIN'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerHEX2BIN()
@ -550,8 +536,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTODEC'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTODEC'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerHEX2DEC()
@ -566,8 +552,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOOCT'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOOCT'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerHEX2OCT()
@ -582,8 +568,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOBIN'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOBIN'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerOCT2BIN()
@ -598,8 +584,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTODEC'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTODEC'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerOCT2DEC()
@ -614,8 +600,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOHEX'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOHEX'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerOCT2HEX()
@ -630,8 +616,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DELTA'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DELTA'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerDELTA()
@ -646,8 +632,8 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','GESTEP'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','GESTEP'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerGESTEP()
@ -686,13 +672,12 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','CONVERTUOM'),$args);
$this->assertEquals($expectedResult, $result, NULL);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','CONVERTUOM'), $args);
$this->assertEquals($expectedResult, $result, null);
}
public function providerCONVERTUOM()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/CONVERTUOM.data');
}
}

View File

@ -8,8 +8,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -24,8 +23,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerACCRINT()
@ -40,8 +39,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerACCRINTM()
@ -56,8 +55,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerAMORDEGRC()
@ -72,8 +71,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerAMORLINC()
@ -88,8 +87,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerCOUPDAYBS()
@ -104,8 +103,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerCOUPDAYS()
@ -120,8 +119,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerCOUPDAYSNC()
@ -136,8 +135,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerCOUPNCD()
@ -152,8 +151,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerCOUPNUM()
@ -168,8 +167,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerCOUPPCD()
@ -184,8 +183,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerCUMIPMT()
@ -200,8 +199,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerCUMPRINC()
@ -216,8 +215,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDB()
@ -232,8 +231,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDDB()
@ -248,8 +247,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDISC()
@ -264,8 +263,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDOLLARDE()
@ -280,8 +279,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerDOLLARFR()
@ -296,8 +295,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerEFFECT()
@ -312,8 +311,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerFV()
@ -328,8 +327,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerFVSCHEDULE()
@ -344,8 +343,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerINTRATE()
@ -360,8 +359,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIPMT()
@ -376,8 +375,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIRR()
@ -392,8 +391,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerISPMT()
@ -408,8 +407,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerMIRR()
@ -424,8 +423,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerNOMINAL()
@ -440,8 +439,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerNPER()
@ -456,8 +455,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerNPV()
@ -472,8 +471,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerPRICE()
@ -488,8 +487,8 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerRATE()
@ -504,13 +503,12 @@ class FinancialTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerXIRR()
{
return new testDataFileIterator('rawTestData/Calculation/Financial/XIRR.data');
}
}

View File

@ -8,8 +8,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -55,7 +54,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
public function testNULL()
{
$result = PHPExcel_Calculation_Functions::NULL();
$result = PHPExcel_Calculation_Functions::null();
$this->assertEquals('#NULL!', $result);
}
@ -72,8 +71,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_BLANK()
@ -88,8 +87,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_ERR()
@ -104,8 +103,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_ERROR()
@ -120,8 +119,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerERROR_TYPE()
@ -136,8 +135,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_LOGICAL()
@ -152,8 +151,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_NA()
@ -168,8 +167,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_NUMBER()
@ -184,8 +183,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_TEXT()
@ -200,8 +199,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_NONTEXT()
@ -216,8 +215,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_EVEN()
@ -232,8 +231,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerIS_ODD()
@ -248,8 +247,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerTYPE()
@ -264,13 +263,12 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerN()
{
return new testDataFileIterator('rawTestData/Calculation/Functions/N.data');
}
}

View File

@ -8,8 +8,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -20,13 +19,13 @@ class LogicalTest extends PHPUnit_Framework_TestCase
public function testTRUE()
{
$result = PHPExcel_Calculation_Logical::TRUE();
$this->assertEquals(TRUE, $result);
$this->assertEquals(true, $result);
}
public function testFALSE()
{
$result = PHPExcel_Calculation_Logical::FALSE();
$this->assertEquals(FALSE, $result);
$this->assertEquals(false, $result);
}
/**
@ -36,7 +35,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -52,7 +51,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -68,7 +67,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -84,7 +83,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -100,7 +99,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -108,5 +107,4 @@ class LogicalTest extends PHPUnit_Framework_TestCase
{
return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data');
}
}

View File

@ -8,8 +8,7 @@ class LookupRefTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -24,7 +23,7 @@ class LookupRefTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -40,7 +39,7 @@ class LookupRefTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -48,5 +47,4 @@ class LookupRefTest extends PHPUnit_Framework_TestCase
{
return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data');
}
}

View File

@ -8,8 +8,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -24,8 +23,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerATAN2()
@ -40,8 +39,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerCEILING()
@ -56,8 +55,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerCOMBIN()
@ -72,8 +71,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerEVEN()
@ -88,8 +87,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerODD()
@ -104,8 +103,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerFACT()
@ -120,8 +119,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerFACTDOUBLE()
@ -136,8 +135,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerFLOOR()
@ -152,8 +151,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerGCD()
@ -168,8 +167,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerLCM()
@ -184,7 +183,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -200,8 +199,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSIGN()
@ -216,8 +215,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerPOWER()
@ -232,8 +231,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerLOG()
@ -248,8 +247,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMOD()
@ -264,8 +263,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMDETERM()
@ -280,8 +279,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMINVERSE()
@ -296,8 +295,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMMULT()
@ -312,8 +311,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMULTINOMIAL()
@ -329,9 +328,9 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'), $args);
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMROUND()
@ -346,8 +345,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerPRODUCT()
@ -362,8 +361,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerQUOTIENT()
@ -378,8 +377,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerROUNDUP()
@ -394,8 +393,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerROUNDDOWN()
@ -410,8 +409,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSERIESSUM()
@ -426,8 +425,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSUMSQ()
@ -442,8 +441,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerTRUNC()
@ -458,7 +457,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -474,8 +473,8 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSQRTPI()
@ -491,7 +490,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig', 'SUMIF'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSUMIF()
@ -556,5 +555,4 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
),
);
}
}

View File

@ -8,8 +8,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -24,7 +23,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -40,7 +39,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -56,7 +55,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -72,7 +71,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -88,7 +87,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','MID'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','MID'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -104,7 +103,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -120,7 +119,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -136,7 +135,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -152,7 +151,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -168,7 +167,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -184,7 +183,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -200,7 +199,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -216,7 +215,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -232,7 +231,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -248,7 +247,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -264,7 +263,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -280,7 +279,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -296,7 +295,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -312,7 +311,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -327,13 +326,13 @@ class TextDataTest extends PHPUnit_Framework_TestCase
public function testTEXT()
{
// 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_String','setThousandsSeparator'),',');
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.');
call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ',');
call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$');
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TEXTFORMAT'),$args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'TEXTFORMAT'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -347,19 +346,18 @@ class TextDataTest extends PHPUnit_Framework_TestCase
*/
public function testVALUE()
{
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),' ');
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.');
call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ' ');
call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$');
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','VALUE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'VALUE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerVALUE()
{
return new testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data');
}
}

View File

@ -4,7 +4,6 @@ require_once 'testDataFileIterator.php';
class CalculationTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT')) {
@ -33,5 +32,4 @@ class CalculationTest extends PHPUnit_Framework_TestCase
{
return new testDataFileIterator('rawTestData/CalculationBinaryComparisonOperation.data');
}
}

View File

@ -64,7 +64,7 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
PHPExcel_Shared_String::setDecimalSeparator($decimalSeparator);
PHPExcel_Shared_String::setThousandsSeparator($thousandsSeparator);
$cell = new PHPExcel_Cell(NULL, PHPExcel_Cell_DataType::TYPE_STRING, $sheet);
$cell = new PHPExcel_Cell(null, PHPExcel_Cell_DataType::TYPE_STRING, $sheet);
$binder = new PHPExcel_Cell_AdvancedValueBinder();
$binder->bindValue($cell, $value);

View File

@ -6,8 +6,7 @@ class DataTypeTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -20,5 +19,4 @@ class DataTypeTest extends PHPUnit_Framework_TestCase
$this->assertGreaterThan(0, count($result));
$this->assertArrayHasKey('#NULL!', $result);
}
}

View File

@ -8,8 +8,7 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');

View File

@ -6,8 +6,7 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -20,7 +19,7 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue);
$result = $testInstance->getUrl();
$this->assertEquals($urlValue,$result);
$this->assertEquals($urlValue, $result);
}
public function testSetUrl()
@ -33,17 +32,17 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
$result = $testInstance->getUrl();
$this->assertEquals($newUrlValue,$result);
$this->assertEquals($newUrlValue, $result);
}
public function testGetTooltip()
{
$tooltipValue = 'PHPExcel Web Site';
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $tooltipValue);
$testInstance = new PHPExcel_Cell_Hyperlink(null, $tooltipValue);
$result = $testInstance->getTooltip();
$this->assertEquals($tooltipValue,$result);
$this->assertEquals($tooltipValue, $result);
}
public function testSetTooltip()
@ -51,12 +50,12 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
$initialTooltipValue = 'PHPExcel Web Site';
$newTooltipValue = 'PHPExcel Repository on Github';
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $initialTooltipValue);
$testInstance = new PHPExcel_Cell_Hyperlink(null, $initialTooltipValue);
$result = $testInstance->setTooltip($newTooltipValue);
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
$result = $testInstance->getTooltip();
$this->assertEquals($newTooltipValue,$result);
$this->assertEquals($newTooltipValue, $result);
}
public function testIsInternal()
@ -82,7 +81,6 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue, $tooltipValue);
$result = $testInstance->getHashCode();
$this->assertEquals($initialExpectedHash,$result);
$this->assertEquals($initialExpectedHash, $result);
}
}

View File

@ -21,7 +21,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','columnIndexFromString'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','columnIndexFromString'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -34,7 +34,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$cellAddress = 'ABCD';
try {
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
return;
@ -46,7 +46,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$cellAddress = '';
try {
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Column string index can not be empty');
return;
@ -61,7 +61,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','stringFromColumnIndex'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','stringFromColumnIndex'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -77,7 +77,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','coordinateFromString'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','coordinateFromString'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -90,7 +90,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$cellAddress = 'A1:AI2012';
try {
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
return;
@ -102,7 +102,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$cellAddress = '';
try {
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
return;
@ -114,7 +114,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$cellAddress = 'AI';
try {
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress);
return;
@ -129,7 +129,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','absoluteCoordinate'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','absoluteCoordinate'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -142,7 +142,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$cellAddress = 'A1:AI2012';
try {
$result = call_user_func(array('PHPExcel_Cell','absoluteCoordinate'),$cellAddress);
$result = call_user_func(array('PHPExcel_Cell','absoluteCoordinate'), $cellAddress);
} catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
return;
@ -157,7 +157,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','absoluteReference'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','absoluteReference'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -170,7 +170,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$cellAddress = 'A1:AI2012';
try {
$result = call_user_func(array('PHPExcel_Cell','absoluteReference'),$cellAddress);
$result = call_user_func(array('PHPExcel_Cell','absoluteReference'), $cellAddress);
} catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
return;
@ -185,8 +185,8 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','splitRange'),$args);
foreach($result as $key => $split) {
$result = call_user_func_array(array('PHPExcel_Cell','splitRange'), $args);
foreach ($result as $key => $split) {
if (!is_array($expectedResult[$key])) {
$this->assertEquals($expectedResult[$key], $split[0]);
} else {
@ -207,7 +207,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','buildRange'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','buildRange'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -220,7 +220,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$cellRange = '';
try {
$result = call_user_func(array('PHPExcel_Cell','buildRange'),$cellRange);
$result = call_user_func(array('PHPExcel_Cell','buildRange'), $cellRange);
} catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Range does not contain any information');
return;
@ -235,7 +235,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','rangeBoundaries'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','rangeBoundaries'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -251,7 +251,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','rangeDimension'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','rangeDimension'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -267,7 +267,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','getRangeBoundaries'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','getRangeBoundaries'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -283,7 +283,7 @@ class CellTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','extractAllCellReferencesInRange'),$args);
$result = call_user_func_array(array('PHPExcel_Cell','extractAllCellReferencesInRange'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -291,5 +291,4 @@ class CellTest extends PHPUnit_Framework_TestCase
{
return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data');
}
}

View File

@ -6,8 +6,7 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -22,7 +21,7 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase
$testInstance = new PHPExcel_Chart_DataSeriesValues;
foreach($dataTypeValues as $dataTypeValue) {
foreach ($dataTypeValues as $dataTypeValue) {
$result = $testInstance->setDataType($dataTypeValue);
$this->assertTrue($result instanceof PHPExcel_Chart_DataSeriesValues);
}
@ -49,7 +48,6 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase
$setValue = $testInstance->setDataType($dataTypeValue);
$result = $testInstance->getDataType();
$this->assertEquals($dataTypeValue,$result);
$this->assertEquals($dataTypeValue, $result);
}
}

View File

@ -6,8 +6,7 @@ class LayoutTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -31,7 +30,6 @@ class LayoutTest extends PHPUnit_Framework_TestCase
$setValue = $testInstance->setLayoutTarget($LayoutTargetValue);
$result = $testInstance->getLayoutTarget();
$this->assertEquals($LayoutTargetValue,$result);
$this->assertEquals($LayoutTargetValue, $result);
}
}

View File

@ -6,8 +6,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -25,7 +24,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
$testInstance = new PHPExcel_Chart_Legend;
foreach($positionValues as $positionValue) {
foreach ($positionValues as $positionValue) {
$result = $testInstance->setPosition($positionValue);
$this->assertTrue($result);
}
@ -39,7 +38,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
$this->assertFalse($result);
// Ensure that value is unchanged
$result = $testInstance->getPosition();
$this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT,$result);
$this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT, $result);
}
public function testGetPosition()
@ -50,7 +49,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
$setValue = $testInstance->setPosition($PositionValue);
$result = $testInstance->getPosition();
$this->assertEquals($PositionValue,$result);
$this->assertEquals($PositionValue, $result);
}
public function testSetPositionXL()
@ -66,7 +65,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
$testInstance = new PHPExcel_Chart_Legend;
foreach($positionValues as $positionValue) {
foreach ($positionValues as $positionValue) {
$result = $testInstance->setPositionXL($positionValue);
$this->assertTrue($result);
}
@ -80,7 +79,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
$this->assertFalse($result);
// Ensure that value is unchanged
$result = $testInstance->getPositionXL();
$this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight,$result);
$this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight, $result);
}
public function testGetPositionXL()
@ -91,19 +90,19 @@ class LegendTest extends PHPUnit_Framework_TestCase
$setValue = $testInstance->setPositionXL($PositionValue);
$result = $testInstance->getPositionXL();
$this->assertEquals($PositionValue,$result);
$this->assertEquals($PositionValue, $result);
}
public function testSetOverlay()
{
$overlayValues = array(
TRUE,
FALSE,
true,
false,
);
$testInstance = new PHPExcel_Chart_Legend;
foreach($overlayValues as $overlayValue) {
foreach ($overlayValues as $overlayValue) {
$result = $testInstance->setOverlay($overlayValue);
$this->assertTrue($result);
}
@ -122,13 +121,12 @@ class LegendTest extends PHPUnit_Framework_TestCase
public function testGetOverlay()
{
$OverlayValue = TRUE;
$OverlayValue = true;
$testInstance = new PHPExcel_Chart_Legend;
$setValue = $testInstance->setOverlay($OverlayValue);
$result = $testInstance->getOverlay();
$this->assertEquals($OverlayValue,$result);
$this->assertEquals($OverlayValue, $result);
}
}

View File

@ -27,7 +27,7 @@ class XEEValidatorTest extends PHPUnit_Framework_TestCase
public function providerInvalidXML()
{
$tests = [];
foreach(glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) {
foreach (glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) {
$tests[] = [realpath($file), true];
}
return $tests;
@ -46,10 +46,9 @@ class XEEValidatorTest extends PHPUnit_Framework_TestCase
public function providerValidXML()
{
$tests = [];
foreach(glob('rawTestData/Reader/XEETestValid*.xml') as $file) {
foreach (glob('rawTestData/Reader/XEETestValid*.xml') as $file) {
$tests[] = [realpath($file), file_get_contents($file)];
}
return $tests;
}
}

View File

@ -28,7 +28,7 @@ class ReferenceHelperTest extends PHPUnit_Framework_TestCase
);
shuffle($columnBase);
usort($columnBase, array('PHPExcel_ReferenceHelper','columnSort'));
foreach($columnBase as $key => $value) {
foreach ($columnBase as $key => $value) {
$this->assertEquals($columnExpectedResult[$key], $value);
}
}
@ -50,9 +50,8 @@ class ReferenceHelperTest extends PHPUnit_Framework_TestCase
shuffle($columnBase);
$columnExpectedResult = array_reverse($columnExpectedResult);
usort($columnBase, array('PHPExcel_ReferenceHelper','columnReverseSort'));
foreach($columnBase as $key => $value) {
foreach ($columnBase as $key => $value) {
$this->assertEquals($columnExpectedResult[$key], $value);
}
}
}

View File

@ -21,7 +21,7 @@ class CodePageTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_CodePage','NumberToName'),$args);
$result = call_user_func_array(array('PHPExcel_Shared_CodePage','NumberToName'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -34,7 +34,7 @@ class CodePageTest extends PHPUnit_Framework_TestCase
{
$invalidCodePage = 12345;
try {
$result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'),$invalidCodePage);
$result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'), $invalidCodePage);
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
return;
@ -46,12 +46,11 @@ class CodePageTest extends PHPUnit_Framework_TestCase
{
$unsupportedCodePage = 720;
try {
$result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'),$unsupportedCodePage);
$result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'), $unsupportedCodePage);
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
return;
}
$this->fail('An expected exception has not been raised.');
}
}

View File

@ -21,8 +21,8 @@ class DateTest extends PHPUnit_Framework_TestCase
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900,
);
foreach($calendarValues as $calendarValue) {
$result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'),$calendarValue);
foreach ($calendarValues as $calendarValue) {
$result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'), $calendarValue);
$this->assertTrue($result);
}
}
@ -30,7 +30,7 @@ class DateTest extends PHPUnit_Framework_TestCase
public function testSetExcelCalendarWithInvalidValue()
{
$unsupportedCalendar = '2012';
$result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'),$unsupportedCalendar);
$result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'), $unsupportedCalendar);
$this->assertFalse($result);
}
@ -47,9 +47,9 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0);
$expectedResult += gmmktime(0, 0, 0);
}
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args);
$result = call_user_func_array(array('PHPExcel_Shared_Date', 'ExcelToPHP'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -70,8 +70,8 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-5);
}
public function providerDateTimePHPToExcel1900()
@ -91,8 +91,8 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','FormattedPHPToExcel'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5);
$result = call_user_func_array(array('PHPExcel_Shared_Date','FormattedPHPToExcel'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-5);
}
public function providerDateTimeFormattedPHPToExcel1900()
@ -113,9 +113,9 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0);
$expectedResult += gmmktime(0, 0, 0);
}
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -136,8 +136,8 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-5);
}
public function providerDateTimePHPToExcel1904()
@ -152,7 +152,7 @@ class DateTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','isDateTimeFormatCode'),$args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','isDateTimeFormatCode'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -174,9 +174,9 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0);
$expectedResult += gmmktime(0, 0, 0);
}
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -184,5 +184,4 @@ class DateTest extends PHPUnit_Framework_TestCase
{
return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900Timezone.data');
}
}

View File

@ -16,7 +16,7 @@ class FileTest extends PHPUnit_Framework_TestCase
public function testGetUseUploadTempDirectory()
{
$expectedResult = FALSE;
$expectedResult = false;
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$this->assertEquals($expectedResult, $result);
@ -25,12 +25,12 @@ class FileTest extends PHPUnit_Framework_TestCase
public function testSetUseUploadTempDirectory()
{
$useUploadTempDirectoryValues = array(
TRUE,
FALSE,
true,
false,
);
foreach($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
call_user_func(array('PHPExcel_Shared_File','setUseUploadTempDirectory'),$useUploadTempDirectoryValue);
foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
call_user_func(array('PHPExcel_Shared_File','setUseUploadTempDirectory'), $useUploadTempDirectoryValue);
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$this->assertEquals($useUploadTempDirectoryValue, $result);

View File

@ -29,8 +29,8 @@ class FontTest extends PHPUnit_Framework_TestCase
PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX,
);
foreach($autosizeMethodValues as $autosizeMethodValue) {
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$autosizeMethodValue);
foreach ($autosizeMethodValues as $autosizeMethodValue) {
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'), $autosizeMethodValue);
$this->assertTrue($result);
}
}
@ -39,7 +39,7 @@ class FontTest extends PHPUnit_Framework_TestCase
{
$unsupportedAutosizeMethod = 'guess';
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$unsupportedAutosizeMethod);
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'), $unsupportedAutosizeMethod);
$this->assertFalse($result);
}
@ -50,7 +50,7 @@ class FontTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','fontSizeToPixels'),$args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','fontSizeToPixels'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -66,7 +66,7 @@ class FontTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','inchSizeToPixels'),$args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','inchSizeToPixels'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -82,7 +82,7 @@ class FontTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','centimeterSizeToPixels'),$args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','centimeterSizeToPixels'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -90,5 +90,4 @@ class FontTest extends PHPUnit_Framework_TestCase
{
return new testDataFileIterator('rawTestData/Shared/CentimeterSizeToPixels.data');
}
}

Some files were not shown because too many files have changed in this diff Show More