diff --git a/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php b/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php index e5624a6f..49ed0c6d 100644 --- a/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php +++ b/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php @@ -32,8 +32,8 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder /** * Bind value to a cell * - * @param PHPExcel_Cell $cell Cell to bind value to - * @param mixed $value Value to bind in cell + * @param \PHPExcel\Cell $cell Cell to bind value to + * @param mixed $value Value to bind in cell * @return boolean */ public function bindValue(\PHPExcel\Cell $cell, $value = null) @@ -47,7 +47,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder $dataType = parent::dataTypeForValue($value); // Style logic - strings - if ($dataType === DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) { + if ($dataType === DataType::TYPE_STRING && !$value instanceof \PHPExcel\RichText) { // Test for booleans using locale-setting if ($value == \PHPExcel\Calculation::getTRUE()) { $cell->setValueExplicit(true, DataType::TYPE_BOOL); @@ -149,7 +149,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder } // Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10' - if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) { + if (($d = \PHPExcel\Shared\Date::stringToExcel($value)) !== false) { // Convert value to number $cell->setValueExplicit($d, DataType::TYPE_NUMERIC); // Determine style. Either there is a time part or not. Look for ':' @@ -165,7 +165,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder // Check for newline character "\n" if (strpos($value, "\n") !== false) { - $value = PHPExcel_Shared_String::SanitizeUTF8($value); + $value = \PHPExcel\Shared\String::SanitizeUTF8($value); $cell->setValueExplicit($value, DataType::TYPE_STRING); // Set style $cell->getWorksheet()->getStyle($cell->getCoordinate()) diff --git a/src/PhpSpreadsheet/Cell/DataType.php b/src/PhpSpreadsheet/Cell/DataType.php index 13730690..9a729d46 100644 --- a/src/PhpSpreadsheet/Cell/DataType.php +++ b/src/PhpSpreadsheet/Cell/DataType.php @@ -67,7 +67,7 @@ class DataType /** * DataType for value * - * @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0 + * @deprecated Replaced by \PHPExcel\Cell\IValueBinder infrastructure, will be removed in version 1.8.0 * @param mixed $pValue * @return string */ diff --git a/src/PhpSpreadsheet/Cell/DataValidation.php b/src/PhpSpreadsheet/Cell/DataValidation.php index 9e2df3c2..f5e5edad 100644 --- a/src/PhpSpreadsheet/Cell/DataValidation.php +++ b/src/PhpSpreadsheet/Cell/DataValidation.php @@ -146,7 +146,7 @@ class DataValidation private $prompt = ''; /** - * Create a new PHPExcel_Cell_DataValidation + * Create a new DataValidation */ public function __construct() { @@ -166,7 +166,7 @@ class DataValidation * Set Formula 1 * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setFormula1($value = '') { @@ -188,7 +188,7 @@ class DataValidation * Set Formula 2 * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setFormula2($value = '') { @@ -210,9 +210,9 @@ class DataValidation * Set Type * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ - public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) + public function setType($value = self::TYPE_NONE) { $this->type = $value; return $this; @@ -232,9 +232,9 @@ class DataValidation * Set Error style * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ - public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) + public function setErrorStyle($value = self::STYLE_STOP) { $this->errorStyle = $value; return $this; @@ -254,7 +254,7 @@ class DataValidation * Set Operator * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setOperator($value = '') { @@ -276,7 +276,7 @@ class DataValidation * Set Allow Blank * * @param boolean $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setAllowBlank($value = false) { @@ -298,7 +298,7 @@ class DataValidation * Set Show DropDown * * @param boolean $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setShowDropDown($value = false) { @@ -320,7 +320,7 @@ class DataValidation * Set Show InputMessage * * @param boolean $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setShowInputMessage($value = false) { @@ -342,7 +342,7 @@ class DataValidation * Set Show ErrorMessage * * @param boolean $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setShowErrorMessage($value = false) { @@ -364,7 +364,7 @@ class DataValidation * Set Error title * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setErrorTitle($value = '') { @@ -386,7 +386,7 @@ class DataValidation * Set Error * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setError($value = '') { @@ -408,7 +408,7 @@ class DataValidation * Set Prompt title * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setPromptTitle($value = '') { @@ -430,7 +430,7 @@ class DataValidation * Set Prompt * * @param string $value - * @return PHPExcel_Cell_DataValidation + * @return DataValidation */ public function setPrompt($value = '') { @@ -448,8 +448,8 @@ class DataValidation return md5( $this->formula1 . $this->formula2 . - $this->type = PHPExcel_Cell_DataValidation::TYPE_NONE . - $this->errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP . + $this->type = self::TYPE_NONE . + $this->errorStyle = self::STYLE_STOP . $this->operator . ($this->allowBlank ? 't' : 'f') . ($this->showDropDown ? 't' : 'f') . diff --git a/src/PhpSpreadsheet/Cell/Hyperlink.php b/src/PhpSpreadsheet/Cell/Hyperlink.php index b60c2a4e..5fa261ab 100644 --- a/src/PhpSpreadsheet/Cell/Hyperlink.php +++ b/src/PhpSpreadsheet/Cell/Hyperlink.php @@ -44,7 +44,7 @@ class Hyperlink private $tooltip; /** - * Create a new PHPExcel_Cell_Hyperlink + * Create a new Hyperlink * * @param string $pUrl Url to link the cell to * @param string $pTooltip Tooltip to display on the hyperlink @@ -70,7 +70,7 @@ class Hyperlink * Set URL * * @param string $value - * @return PHPExcel_Cell_Hyperlink + * @return Hyperlink */ public function setUrl($value = '') { @@ -92,7 +92,7 @@ class Hyperlink * Set tooltip * * @param string $value - * @return PHPExcel_Cell_Hyperlink + * @return Hyperlink */ public function setTooltip($value = '') { diff --git a/src/PhpSpreadsheet/Cell/IValueBinder.php b/src/PhpSpreadsheet/Cell/IValueBinder.php index 7e263e14..bf6e8193 100644 --- a/src/PhpSpreadsheet/Cell/IValueBinder.php +++ b/src/PhpSpreadsheet/Cell/IValueBinder.php @@ -32,7 +32,7 @@ interface IValueBinder /** * Bind value to a cell * - * @param PHPExcel_Cell $cell Cell to bind value to + * @param \PHPExcel\Cell $cell Cell to bind value to * @param mixed $value Value to bind in cell * @return boolean */ diff --git a/src/PhpSpreadsheet/Chart/Axis.php b/src/PhpSpreadsheet/Chart/Axis.php index ed72b8e0..cc4fbc8f 100644 --- a/src/PhpSpreadsheet/Chart/Axis.php +++ b/src/PhpSpreadsheet/Chart/Axis.php @@ -359,7 +359,7 @@ class Axis extends Properties * * @param int $shadow_presets * - * @return PHPExcel_Chart_Axis + * @return Axis */ private function setShadowPresetsProperties($shadow_presets) { @@ -375,7 +375,7 @@ class Axis extends Properties * @param array $properties_map * @param * $reference * - * @return PHPExcel_Chart_Axis + * @return Axis */ private function setShadowProperiesMapValues(array $properties_map, &$reference = null) { @@ -407,7 +407,7 @@ class Axis extends Properties * @param int $alpha * @param string $type * - * @return PHPExcel_Chart_Axis + * @return Axis */ private function setShadowColor($color, $alpha, $type) { @@ -421,7 +421,7 @@ class Axis extends Properties * * @param float $blur * - * @return PHPExcel_Chart_Axis + * @return Axis */ private function setShadowBlur($blur) { @@ -437,7 +437,7 @@ class Axis extends Properties * * @param int $angle * - * @return PHPExcel_Chart_Axis + * @return Axis */ private function setShadowAngle($angle) { @@ -453,7 +453,7 @@ class Axis extends Properties * * @param float $distance * - * @return PHPExcel_Chart_Axis + * @return Axis */ private function setShadowDistance($distance) { @@ -512,7 +512,7 @@ class Axis extends Properties * * @param float $size * - * @return PHPExcel_Chart_Axis + * @return Axis */ private function setGlowSize($size) { @@ -530,7 +530,7 @@ class Axis extends Properties * @param int $alpha * @param string $type * - * @return PHPExcel_Chart_Axis + * @return Axis */ private function setGlowColor($color, $alpha, $type) { diff --git a/src/PhpSpreadsheet/Chart/DataSeries.php b/src/PhpSpreadsheet/Chart/DataSeries.php index 4f7eeb50..8c32b864 100644 --- a/src/PhpSpreadsheet/Chart/DataSeries.php +++ b/src/PhpSpreadsheet/Chart/DataSeries.php @@ -102,14 +102,14 @@ class DataSeries /** * Plot Label * - * @var array of PHPExcel_Chart_DataSeriesValues + * @var array of DataSeriesValues */ private $plotLabel = array(); /** * Plot Category * - * @var array of PHPExcel_Chart_DataSeriesValues + * @var array of DataSeriesValues */ private $plotCategory = array(); @@ -123,12 +123,12 @@ class DataSeries /** * Plot Values * - * @var array of PHPExcel_Chart_DataSeriesValues + * @var array of DataSeriesValues */ private $plotValues = array(); /** - * Create a new PHPExcel_Chart_DataSeries + * Create a new DataSeries */ public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null) { @@ -138,12 +138,12 @@ class DataSeries $keys = array_keys($plotValues); $this->plotValues = $plotValues; if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) { - $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); + $plotLabel[$keys[0]] = new DataSeriesValues(); } $this->plotLabel = $plotLabel; if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) { - $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); + $plotCategory[$keys[0]] = new DataSeriesValues(); } $this->plotCategory = $plotCategory; $this->smoothLine = $smoothLine; @@ -169,7 +169,7 @@ class DataSeries * Set Plot Type * * @param string $plotType - * @return PHPExcel_Chart_DataSeries + * @return DataSeries */ public function setPlotType($plotType = '') { @@ -191,7 +191,7 @@ class DataSeries * Set Plot Grouping Type * * @param string $groupingType - * @return PHPExcel_Chart_DataSeries + * @return DataSeries */ public function setPlotGrouping($groupingType = null) { @@ -213,7 +213,7 @@ class DataSeries * Set Plot Direction * * @param string $plotDirection - * @return PHPExcel_Chart_DataSeries + * @return DataSeries */ public function setPlotDirection($plotDirection = null) { @@ -234,7 +234,7 @@ class DataSeries /** * Get Plot Labels * - * @return array of PHPExcel_Chart_DataSeriesValues + * @return array of DataSeriesValues */ public function getPlotLabels() { @@ -244,7 +244,7 @@ class DataSeries /** * Get Plot Label by Index * - * @return PHPExcel_Chart_DataSeriesValues + * @return DataSeriesValues */ public function getPlotLabelByIndex($index) { @@ -260,7 +260,7 @@ class DataSeries /** * Get Plot Categories * - * @return array of PHPExcel_Chart_DataSeriesValues + * @return array of DataSeriesValues */ public function getPlotCategories() { @@ -270,7 +270,7 @@ class DataSeries /** * Get Plot Category by Index * - * @return PHPExcel_Chart_DataSeriesValues + * @return DataSeriesValues */ public function getPlotCategoryByIndex($index) { @@ -297,7 +297,7 @@ class DataSeries * Set Plot Style * * @param string $plotStyle - * @return PHPExcel_Chart_DataSeries + * @return DataSeries */ public function setPlotStyle($plotStyle = null) { @@ -308,7 +308,7 @@ class DataSeries /** * Get Plot Values * - * @return array of PHPExcel_Chart_DataSeriesValues + * @return array of DataSeriesValues */ public function getPlotValues() { @@ -318,7 +318,7 @@ class DataSeries /** * Get Plot Values by Index * - * @return PHPExcel_Chart_DataSeriesValues + * @return DataSeriesValues */ public function getPlotValuesByIndex($index) { @@ -355,7 +355,7 @@ class DataSeries * Set Smooth Line * * @param boolean $smoothLine - * @return PHPExcel_Chart_DataSeries + * @return DataSeries */ public function setSmoothLine($smoothLine = true) { @@ -363,7 +363,7 @@ class DataSeries return $this; } - public function refresh(PHPExcel_Worksheet $worksheet) + public function refresh(\PHPExcel\Worksheet $worksheet) { foreach ($this->plotValues as $plotValues) { if ($plotValues !== null) { diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index dcfb9f2e..a318cea2 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -81,7 +81,7 @@ class DataSeriesValues private $dataValues = array(); /** - * Create a new PHPExcel_Chart_DataSeriesValues object + * Create a new DataSeriesValues object */ public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) { @@ -108,16 +108,17 @@ class DataSeriesValues * * @param string $dataType Datatype of this data series * Typical values are: - * PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING + * \PHPExcel\Chart\DataSeriesValues::DATASERIES_TYPE_STRING * Normally used for axis point values - * PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER + * \PHPExcel\Chart\DataSeriesValues::DATASERIES_TYPE_NUMBER * Normally used for chart data values - * @return PHPExcel_Chart_DataSeriesValues + * @return DataSeriesValues + * @throws Exception */ public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) { if (!in_array($dataType, self::$dataTypeValues)) { - throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values'); + throw new Exception('Invalid datatype for chart data series values'); } $this->dataType = $dataType; @@ -138,7 +139,7 @@ class DataSeriesValues * Set Series Data Source (formula) * * @param string $dataSource - * @return PHPExcel_Chart_DataSeriesValues + * @return DataSeriesValues */ public function setDataSource($dataSource = null, $refreshDataValues = true) { @@ -165,7 +166,7 @@ class DataSeriesValues * Set Point Marker * * @param string $marker - * @return PHPExcel_Chart_DataSeriesValues + * @return DataSeriesValues */ public function setPointMarker($marker = null) { @@ -188,7 +189,7 @@ class DataSeriesValues * Set Series Format Code * * @param string $formatCode - * @return PHPExcel_Chart_DataSeriesValues + * @return DataSeriesValues */ public function setFormatCode($formatCode = null) { @@ -267,11 +268,11 @@ class DataSeriesValues * @param boolean $refreshDataSource * TRUE - refresh the value of dataSource based on the values of $dataValues * FALSE - don't change the value of dataSource - * @return PHPExcel_Chart_DataSeriesValues + * @return DataSeriesValues */ public function setDataValues($dataValues = array(), $refreshDataSource = true) { - $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues); + $this->dataValues = \PHPExcel\Calculation\Functions::flattenArray($dataValues); $this->pointCount = count($dataValues); if ($refreshDataSource) { @@ -286,11 +287,11 @@ class DataSeriesValues return $var !== null; } - public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true) + public function refresh(\PHPExcel\Worksheet $worksheet, $flatten = true) { if ($this->dataSource !== null) { - $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); - $newDataValues = PHPExcel_Calculation::unwrapResult( + $calcEngine = \PHPExcel\Calculation::getInstance($worksheet->getParent()); + $newDataValues = \PHPExcel\Calculation::unwrapResult( $calcEngine->_calculateFormulaValue( '='.$this->dataSource, null, @@ -298,7 +299,7 @@ class DataSeriesValues ) ); if ($flatten) { - $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); + $this->dataValues = \PHPExcel\Calculation\Functions::flattenArray($newDataValues); foreach ($this->dataValues as &$dataValue) { if ((!empty($dataValue)) && ($dataValue[0] == '#')) { $dataValue = 0.0; @@ -311,9 +312,9 @@ class DataSeriesValues list(, $cellRange) = $cellRange; } - $dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange)); + $dimensions = \PHPExcel\Cell::rangeDimension(str_replace('$', '', $cellRange)); if (($dimensions[0] == 1) || ($dimensions[1] == 1)) { - $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); + $this->dataValues = \PHPExcel\Calculation\Functions::flattenArray($newDataValues); } else { $newArray = array_values(array_shift($newDataValues)); foreach ($newArray as $i => $newDataSet) { diff --git a/src/PhpSpreadsheet/Chart/GridLines.php b/src/PhpSpreadsheet/Chart/GridLines.php index 6ca5f825..4fb60adf 100644 --- a/src/PhpSpreadsheet/Chart/GridLines.php +++ b/src/PhpSpreadsheet/Chart/GridLines.php @@ -96,7 +96,7 @@ class GridLines extends Properties /** * Change Object State to True * - * @return PHPExcel_Chart_GridLines + * @return GridLines */ private function activateObject() @@ -243,7 +243,7 @@ class GridLines extends Properties * * @param float $size * - * @return PHPExcel_Chart_GridLines + * @return GridLines */ private function setGlowSize($size) @@ -260,7 +260,7 @@ class GridLines extends Properties * @param int $alpha * @param string $type * - * @return PHPExcel_Chart_GridLines + * @return GridLines */ private function setGlowColor($color, $alpha, $type) @@ -324,7 +324,7 @@ class GridLines extends Properties * * @param int $shadow_presets * - * @return PHPExcel_Chart_GridLines + * @return GridLines */ private function setShadowPresetsProperties($shadow_presets) @@ -341,7 +341,7 @@ class GridLines extends Properties * @param array $properties_map * @param * $reference * - * @return PHPExcel_Chart_GridLines + * @return GridLines */ private function setShadowProperiesMapValues(array $properties_map, &$reference = null) @@ -373,7 +373,7 @@ class GridLines extends Properties * @param string $color * @param int $alpha * @param string $type - * @return PHPExcel_Chart_GridLines + * @return GridLines */ private function setShadowColor($color, $alpha, $type) { @@ -395,7 +395,7 @@ class GridLines extends Properties * * @param float $blur * - * @return PHPExcel_Chart_GridLines + * @return GridLines */ private function setShadowBlur($blur) { @@ -410,7 +410,7 @@ class GridLines extends Properties * Set Shadow Angle * * @param int $angle - * @return PHPExcel_Chart_GridLines + * @return GridLines */ private function setShadowAngle($angle) @@ -426,7 +426,7 @@ class GridLines extends Properties * Set Shadow Distance * * @param float $distance - * @return PHPExcel_Chart_GridLines + * @return GridLines */ private function setShadowDistance($distance) { diff --git a/src/PhpSpreadsheet/Chart/Layout.php b/src/PhpSpreadsheet/Chart/Layout.php index 6443e3b6..e0d081ce 100644 --- a/src/PhpSpreadsheet/Chart/Layout.php +++ b/src/PhpSpreadsheet/Chart/Layout.php @@ -135,7 +135,7 @@ class Layout /** - * Create a new PHPExcel_Chart_Layout + * Create a new Layout */ public function __construct($layout = array()) { @@ -176,7 +176,7 @@ class Layout * Set Layout Target * * @param Layout Target $value - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setLayoutTarget($value) { @@ -198,7 +198,7 @@ class Layout * Set X-Mode * * @param X-Mode $value - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setXMode($value) { @@ -220,7 +220,7 @@ class Layout * Set Y-Mode * * @param Y-Mode $value - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setYMode($value) { @@ -242,7 +242,7 @@ class Layout * Set X-Position * * @param X-Position $value - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setXPosition($value) { @@ -264,7 +264,7 @@ class Layout * Set Y-Position * * @param Y-Position $value - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setYPosition($value) { @@ -286,7 +286,7 @@ class Layout * Set Width * * @param Width $value - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setWidth($value) { @@ -308,7 +308,7 @@ class Layout * Set Height * * @param Height $value - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setHeight($value) { @@ -332,7 +332,7 @@ class Layout * Specifies that legend keys should be shown in data labels. * * @param boolean $value Show legend key - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setShowLegendKey($value) { @@ -355,7 +355,7 @@ class Layout * Specifies that the value should be shown in data labels. * * @param boolean $value Show val - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setShowVal($value) { @@ -378,7 +378,7 @@ class Layout * Specifies that the category name should be shown in data labels. * * @param boolean $value Show cat name - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setShowCatName($value) { @@ -401,7 +401,7 @@ class Layout * Specifies that the series name should be shown in data labels. * * @param boolean $value Show series name - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setShowSerName($value) { @@ -424,7 +424,7 @@ class Layout * Specifies that the percentage should be shown in data labels. * * @param boolean $value Show percentage - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setShowPercent($value) { @@ -447,7 +447,7 @@ class Layout * Specifies that the bubble size should be shown in data labels. * * @param boolean $value Show bubble size - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setShowBubbleSize($value) { @@ -470,7 +470,7 @@ class Layout * Specifies that leader lines should be shown in data labels. * * @param boolean $value Show leader lines - * @return PHPExcel_Chart_Layout + * @return Layout */ public function setShowLeaderLines($value) { diff --git a/src/PhpSpreadsheet/Chart/Legend.php b/src/PhpSpreadsheet/Chart/Legend.php index e7e7f13f..f9dc6d0e 100644 --- a/src/PhpSpreadsheet/Chart/Legend.php +++ b/src/PhpSpreadsheet/Chart/Legend.php @@ -69,15 +69,15 @@ class Legend /** * Legend Layout * - * @var PHPExcel_Chart_Layout + * @var Layout */ private $layout = null; /** - * Create a new PHPExcel_Chart_Legend + * Create a new Legend */ - public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = null, $overlay = false) + public function __construct($position = self::POSITION_RIGHT, Layout $layout = null, $overlay = false) { $this->setPosition($position); $this->layout = $layout; @@ -163,7 +163,7 @@ class Legend /** * Get Layout * - * @return PHPExcel_Chart_Layout + * @return Layout */ public function getLayout() { diff --git a/src/PhpSpreadsheet/Chart/PlotArea.php b/src/PhpSpreadsheet/Chart/PlotArea.php index c0907a96..e281807e 100644 --- a/src/PhpSpreadsheet/Chart/PlotArea.php +++ b/src/PhpSpreadsheet/Chart/PlotArea.php @@ -32,19 +32,19 @@ class PlotArea /** * PlotArea Layout * - * @var PHPExcel_Chart_Layout + * @var Layout */ private $layout = null; /** * Plot Series * - * @var array of PHPExcel_Chart_DataSeries + * @var array of DataSeries */ private $plotSeries = array(); /** - * Create a new PHPExcel_Chart_PlotArea + * Create a new PlotArea */ public function __construct(Layout $layout = null, $plotSeries = array()) { @@ -55,7 +55,7 @@ class PlotArea /** * Get Layout * - * @return PHPExcel_Chart_Layout + * @return Layout */ public function getLayout() { @@ -65,7 +65,7 @@ class PlotArea /** * Get Number of Plot Groups * - * @return array of PHPExcel_Chart_DataSeries + * @return array of DataSeries */ public function getPlotGroupCount() { @@ -89,7 +89,7 @@ class PlotArea /** * Get Plot Series * - * @return array of PHPExcel_Chart_DataSeries + * @return array of DataSeries */ public function getPlotGroup() { @@ -99,7 +99,7 @@ class PlotArea /** * Get Plot Series by Index * - * @return PHPExcel_Chart_DataSeries + * @return DataSeries */ public function getPlotGroupByIndex($index) { @@ -109,8 +109,8 @@ class PlotArea /** * Set Plot Series * - * @param [PHPExcel_Chart_DataSeries] - * @return PHPExcel_Chart_PlotArea + * @param DataSeries[] + * @return PlotArea */ public function setPlotSeries($plotSeries = array()) { @@ -119,7 +119,7 @@ class PlotArea return $this; } - public function refresh(PHPExcel_Worksheet $worksheet) + public function refresh(\PHPExcel\Worksheet $worksheet) { foreach ($this->plotSeries as $plotSeries) { $plotSeries->refresh($worksheet); diff --git a/src/PhpSpreadsheet/Chart/Renderer/jpgraph.php b/src/PhpSpreadsheet/Chart/Renderer/jpgraph.php index 61d69b46..4514de35 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/jpgraph.php +++ b/src/PhpSpreadsheet/Chart/Renderer/jpgraph.php @@ -2,7 +2,7 @@ namespace PHPExcel\Chart\Renderer; -require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php'); +require_once(\PHPExcel\Settings::getChartRendererPath().'/jpgraph.php'); /** * PHPExcel_Chart_Renderer_jpgraph @@ -113,7 +113,7 @@ class jpgraph } else { // Format labels according to any formatting code if (!is_null($datasetLabelFormatCode)) { - $datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel, $datasetLabelFormatCode); + $datasetLabels[$i] = \PHPExcel\Style\NumberFormat::toFormattedString($datasetLabel, $datasetLabelFormatCode); } } ++$testCurrentIndex; @@ -565,7 +565,7 @@ class jpgraph private function renderAreaChart($groupCount, $dimensions = '2d') { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_line.php'); $this->renderCartesianPlotArea(); @@ -577,7 +577,7 @@ class jpgraph private function renderLineChart($groupCount, $dimensions = '2d') { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_line.php'); $this->renderCartesianPlotArea(); @@ -589,7 +589,7 @@ class jpgraph private function renderBarChart($groupCount, $dimensions = '2d') { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_bar.php'); $this->renderCartesianPlotArea(); @@ -601,9 +601,9 @@ class jpgraph private function renderScatterChart($groupCount) { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php'); - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php'); - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_scatter.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_regstat.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_line.php'); $this->renderCartesianPlotArea('linlin'); @@ -615,7 +615,7 @@ class jpgraph private function renderBubbleChart($groupCount) { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_scatter.php'); $this->renderCartesianPlotArea('linlin'); @@ -627,9 +627,9 @@ class jpgraph private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false) { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_pie.php'); if ($dimensions == '3d') { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie3d.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_pie3d.php'); } $this->renderPiePlotArea($doughnut); @@ -704,7 +704,7 @@ class jpgraph private function renderRadarChart($groupCount) { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_radar.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_radar.php'); $this->renderRadarPlotArea(); @@ -716,7 +716,7 @@ class jpgraph private function renderStockChart($groupCount) { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_stock.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_stock.php'); $this->renderCartesianPlotArea('intint'); @@ -728,7 +728,7 @@ class jpgraph private function renderContourChart($groupCount, $dimensions) { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_contour.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_contour.php'); $this->renderCartesianPlotArea('intint'); @@ -740,11 +740,11 @@ class jpgraph private function renderCombinationChart($groupCount, $dimensions, $outputDestination) { - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php'); - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php'); - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php'); - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php'); - require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_line.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_bar.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_scatter.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_regstat.php'); + require_once(\PHPExcel\Settings::getChartRendererPath().'jpgraph_line.php'); $this->renderCartesianPlotArea(); @@ -875,11 +875,11 @@ class jpgraph /** - * Create a new PHPExcel_Chart_Renderer_jpgraph + * Create a new jpgraph */ - public function __construct(PHPExcel_Chart $chart) + public function __construct(\PHPExcel\Chart $chart) { - $this->graph = null; - $this->chart = $chart; + $this->graph = null; + $this->chart = $chart; } } diff --git a/src/PhpSpreadsheet/Chart/Title.php b/src/PhpSpreadsheet/Chart/Title.php index b83659ed..6cf29d07 100644 --- a/src/PhpSpreadsheet/Chart/Title.php +++ b/src/PhpSpreadsheet/Chart/Title.php @@ -40,12 +40,12 @@ class Title /** * Title Layout * - * @var PHPExcel_Chart_Layout + * @var Layout */ private $layout = null; /** - * Create a new PHPExcel_Chart_Title + * Create a new Title */ public function __construct($caption = null, Layout $layout = null) { @@ -67,7 +67,7 @@ class Title * Set caption * * @param string $caption - * @return PHPExcel_Chart_Title + * @return Title */ public function setCaption($caption = null) { @@ -79,7 +79,7 @@ class Title /** * Get Layout * - * @return PHPExcel_Chart_Layout + * @return Layout */ public function getLayout() { diff --git a/src/PhpSpreadsheet/Document/Properties.php b/src/PhpSpreadsheet/Document/Properties.php index 78f579f5..a5dfc47e 100644 --- a/src/PhpSpreadsheet/Document/Properties.php +++ b/src/PhpSpreadsheet/Document/Properties.php @@ -147,7 +147,7 @@ class Properties * Set Creator * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setCreator($pValue = '') { @@ -169,7 +169,7 @@ class Properties * Set Last Modified By * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setLastModifiedBy($pValue = '') { @@ -191,7 +191,7 @@ class Properties * Set Created * * @param datetime $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setCreated($pValue = null) { @@ -223,7 +223,7 @@ class Properties * Set Modified * * @param datetime $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setModified($pValue = null) { @@ -255,7 +255,7 @@ class Properties * Set Title * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setTitle($pValue = '') { @@ -277,7 +277,7 @@ class Properties * Set Description * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setDescription($pValue = '') { @@ -299,7 +299,7 @@ class Properties * Set Subject * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setSubject($pValue = '') { @@ -321,7 +321,7 @@ class Properties * Set Keywords * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setKeywords($pValue = '') { @@ -343,7 +343,7 @@ class Properties * Set Category * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setCategory($pValue = '') { @@ -365,7 +365,7 @@ class Properties * Set Company * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setCompany($pValue = '') { @@ -387,7 +387,7 @@ class Properties * Set Manager * * @param string $pValue - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setManager($pValue = '') { @@ -455,7 +455,7 @@ class Properties * 's' : String * 'd' : Date/Time * 'b' : Boolean - * @return PHPExcel_DocumentProperties + * @return Properties */ public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null) { diff --git a/src/PhpSpreadsheet/Document/Security.php b/src/PhpSpreadsheet/Document/Security.php index 57166aa0..58459c68 100644 --- a/src/PhpSpreadsheet/Document/Security.php +++ b/src/PhpSpreadsheet/Document/Security.php @@ -97,7 +97,7 @@ class Security * Set LockRevision * * @param boolean $pValue - * @return PHPExcel_DocumentSecurity + * @return Security */ public function setLockRevision($pValue = false) { @@ -119,7 +119,7 @@ class Security * Set LockStructure * * @param boolean $pValue - * @return PHPExcel_DocumentSecurity + * @return Security */ public function setLockStructure($pValue = false) { @@ -141,7 +141,7 @@ class Security * Set LockWindows * * @param boolean $pValue - * @return PHPExcel_DocumentSecurity + * @return Security */ public function setLockWindows($pValue = false) { @@ -164,12 +164,12 @@ class Security * * @param string $pValue * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @return PHPExcel_DocumentSecurity + * @return Security */ public function setRevisionsPassword($pValue = '', $pAlreadyHashed = false) { if (!$pAlreadyHashed) { - $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); + $pValue = \PHPExcel\Shared\PasswordHasher::hashPassword($pValue); } $this->revisionsPassword = $pValue; return $this; @@ -190,12 +190,12 @@ class Security * * @param string $pValue * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @return PHPExcel_DocumentSecurity + * @return Security */ public function setWorkbookPassword($pValue = '', $pAlreadyHashed = false) { if (!$pAlreadyHashed) { - $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); + $pValue = \PHPExcel\Shared\PasswordHasher::hashPassword($pValue); } $this->workbookPassword = $pValue; return $this; diff --git a/src/PhpSpreadsheet/Helper/HTML.php b/src/PhpSpreadsheet/Helper/HTML.php index 3a2bbccb..0826d10b 100644 --- a/src/PhpSpreadsheet/Helper/HTML.php +++ b/src/PhpSpreadsheet/Helper/HTML.php @@ -2,6 +2,31 @@ namespace PHPExcel\Helper; +/** + * PHPExcel_Helper_HTML + * + * 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 + * @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## + */ class HTML { protected static $colourMap = [ @@ -598,7 +623,7 @@ class HTML // Discard excess white space $dom->preserveWhiteSpace = false; - $this->richTextObject = new PHPExcel_RichText(); + $this->richTextObject = new \PHPExcel\RichText(); $this->parseElements($dom); return $this->richTextObject; } @@ -618,7 +643,7 @@ class HTML $richtextRun->getFont()->setSize($this->size); } if ($this->color) { - $richtextRun->getFont()->setColor(new PHPExcel_Style_Color('ff' . $this->color)); + $richtextRun->getFont()->setColor(new \PHPExcel\Style\Color('ff' . $this->color)); } if ($this->bold) { $richtextRun->getFont()->setBold(true); @@ -627,7 +652,7 @@ class HTML $richtextRun->getFont()->setItalic(true); } if ($this->underline) { - $richtextRun->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); + $richtextRun->getFont()->setUnderline(\PHPExcel\Style\Font::UNDERLINE_SINGLE); } if ($this->superscript) { $richtextRun->getFont()->setSuperScript(true); diff --git a/src/PhpSpreadsheet/RichText/ITextElement.php b/src/PhpSpreadsheet/RichText/ITextElement.php index b09a0597..5a30bc72 100644 --- a/src/PhpSpreadsheet/RichText/ITextElement.php +++ b/src/PhpSpreadsheet/RichText/ITextElement.php @@ -38,14 +38,14 @@ interface ITextElement * Set text * * @param $pText string Text - * @return PHPExcel_RichText_ITextElement + * @return ITextElement */ public function setText($pText = ''); /** * Get font * - * @return PHPExcel_Style_Font + * @return \PHPExcel\Style\Font */ public function getFont(); diff --git a/src/PhpSpreadsheet/RichText/Run.php b/src/PhpSpreadsheet/RichText/Run.php index 324b5e87..539c0302 100644 --- a/src/PhpSpreadsheet/RichText/Run.php +++ b/src/PhpSpreadsheet/RichText/Run.php @@ -30,12 +30,12 @@ class Run extends TextElement implements ITextElement /** * Font * - * @var PHPExcel_Style_Font + * @var \PHPExcel\Style\Font */ private $font; /** - * Create a new PHPExcel_RichText_Run instance + * Create a new Run instance * * @param string $pText Text */ @@ -43,13 +43,13 @@ class Run extends TextElement implements ITextElement { // Initialise variables $this->setText($pText); - $this->font = new PHPExcel_Style_Font(); + $this->font = new \PHPExcel\Style\Font(); } /** * Get font * - * @return PHPExcel_Style_Font + * @return \PHPExcel\Style\Font */ public function getFont() { @@ -59,11 +59,11 @@ class Run extends TextElement implements ITextElement /** * Set font * - * @param PHPExcel_Style_Font $pFont Font - * @throws PHPExcel_Exception - * @return PHPExcel_RichText_ITextElement + * @param \PHPExcel\Style\Font $pFont Font + * @throws \PHPExcel\Exception + * @return ITextElement */ - public function setFont(PHPExcel_Style_Font $pFont = null) + public function setFont(\PHPExcel\Style\Font $pFont = null) { $this->font = $pFont; return $this; diff --git a/src/PhpSpreadsheet/RichText/TextElement.php b/src/PhpSpreadsheet/RichText/TextElement.php index 5093d2f9..4b7fcee0 100644 --- a/src/PhpSpreadsheet/RichText/TextElement.php +++ b/src/PhpSpreadsheet/RichText/TextElement.php @@ -35,7 +35,7 @@ class TextElement implements ITextElement private $text; /** - * Create a new PHPExcel_RichText_TextElement instance + * Create a new TextElement instance * * @param string $pText Text */ @@ -58,8 +58,8 @@ class TextElement implements ITextElement /** * Set text * - * @param $pText string Text - * @return PHPExcel_RichText_ITextElement + * @param $pText string Text + * @return ITextElement */ public function setText($pText = '') { @@ -70,7 +70,7 @@ class TextElement implements ITextElement /** * Get font * - * @return PHPExcel_Style_Font + * @return \PHPExcel\Style\Font */ public function getFont() { diff --git a/src/PhpSpreadsheet/Shared/CodePage.php b/src/PhpSpreadsheet/Shared/CodePage.php index 7ff4f1aa..e68c6092 100644 --- a/src/PhpSpreadsheet/Shared/CodePage.php +++ b/src/PhpSpreadsheet/Shared/CodePage.php @@ -35,7 +35,7 @@ class CodePage * * @param integer $codePage Microsoft Code Page Indentifier * @return string Code Page Name - * @throws PHPExcel_Exception + * @throws \PHPExcel\Exception */ public static function NumberToName($codePage = 1252) { @@ -45,7 +45,7 @@ class CodePage case 437: return 'CP437'; // OEM US case 720: - throw new PHPExcel_Exception('Code page 720 not supported.'); // OEM Arabic + throw new \PHPExcel\Exception('Code page 720 not supported.'); // OEM Arabic case 737: return 'CP737'; // OEM Greek case 775: @@ -135,12 +135,12 @@ class CodePage case 32768: return 'MAC'; // Apple Roman case 32769: - throw new PHPExcel_Exception('Code page 32769 not supported.'); // ANSI Latin I (BIFF2-BIFF3) + throw new \PHPExcel\Exception('Code page 32769 not supported.'); // ANSI Latin I (BIFF2-BIFF3) case 65000: return 'UTF-7'; // Unicode (UTF-7) case 65001: return 'UTF-8'; // Unicode (UTF-8) } - throw new PHPExcel_Exception('Unknown codepage: ' . $codePage); + throw new \PHPExcel\Exception('Unknown codepage: ' . $codePage); } } diff --git a/src/PhpSpreadsheet/Shared/Date.php b/src/PhpSpreadsheet/Shared/Date.php index 4b70959c..3b193a95 100644 --- a/src/PhpSpreadsheet/Shared/Date.php +++ b/src/PhpSpreadsheet/Shared/Date.php @@ -141,7 +141,7 @@ class Date } $timezoneAdjustment = ($adjustToTimezone) ? - PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) : + TimeZone::getTimezoneAdjustment($timezone, $returnValue) : 0; return $returnValue + $timezoneAdjustment; @@ -246,8 +246,8 @@ class Date /** * Is a given cell a date/time? * - * @param PHPExcel_Cell $pCell - * @return boolean + * @param \PHPExcel\Cell $pCell + * @return boolean */ public static function isDateTime(\PHPExcel\Cell $pCell) { @@ -262,8 +262,8 @@ class Date /** * Is a given number format a date/time? * - * @param PHPExcel_Style_NumberFormat $pFormat - * @return boolean + * @param \PHPExcel\Style\NumberFormat $pFormat + * @return boolean */ public static function isDateTimeFormat(\PHPExcel\Style\NumberFormat $pFormat) { @@ -281,7 +281,7 @@ class Date */ public static function isDateTimeFormatCode($pFormatCode = '') { - if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL)) { + if (strtolower($pFormatCode) === strtolower(\PHPExcel\Style\NumberFormat::FORMAT_GENERAL)) { // "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check) return false; } @@ -293,28 +293,28 @@ class Date // Switch on formatcode switch ($pFormatCode) { // Explicitly defined date formats - case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYSLASH: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYMINUS: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMMINUS: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_MYMINUS: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME1: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME2: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME5: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME6: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME7: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME8: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX14: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17: - case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DDMMYYYY: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DMYSLASH: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DMYMINUS: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DMMINUS: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_MYMINUS: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DATETIME: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME1: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME2: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME3: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME4: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME5: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME6: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME7: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME8: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDDSLASH: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX14: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX15: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX16: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX17: + case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX22: return true; } diff --git a/src/PhpSpreadsheet/Shared/Drawing.php b/src/PhpSpreadsheet/Shared/Drawing.php index 67515eb1..4f94ec4b 100644 --- a/src/PhpSpreadsheet/Shared/Drawing.php +++ b/src/PhpSpreadsheet/Shared/Drawing.php @@ -27,7 +27,7 @@ namespace PHPExcel\Shared; * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -class PHPExcel_Shared_Drawing +class Drawing { /** * Convert pixels to EMU @@ -60,23 +60,23 @@ class PHPExcel_Shared_Drawing * By inspection of a real Excel file using Calibri 11, one finds 1000px ~ 142.85546875 * This gives a conversion factor of 7. Also, we assume that pixels and font size are proportional. * - * @param int $pValue Value in pixels - * @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook - * @return int Value in cell dimension + * @param int $pValue Value in pixels + * @param \PHPExcel\Style\Font $pDefaultFont Default font of the workbook + * @return int Value in cell dimension */ - public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) + public static function pixelsToCellDimension($pValue = 0, \PHPExcel\Style\Font $pDefaultFont) { // Font name and size $name = $pDefaultFont->getName(); $size = $pDefaultFont->getSize(); - if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) { + if (isset(\PHPExcel\Shared\Font::$defaultColumnWidths[$name][$size])) { // Exact width can be determined - $colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']; + $colWidth = $pValue * \PHPExcel\Shared\Font::$defaultColumnWidths[$name][$size]['width'] / \PHPExcel\Shared\Font::$defaultColumnWidths[$name][$size]['px']; } else { // We don't have data for this particular font and size, use approximation by // extrapolating from Calibri 11 - $colWidth = $pValue * 11 * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size; + $colWidth = $pValue * 11 * \PHPExcel\Shared\Font::$defaultColumnWidths['Calibri'][11]['width'] / \PHPExcel\Shared\Font::$defaultColumnWidths['Calibri'][11]['px'] / $size; } return $colWidth; @@ -85,23 +85,23 @@ class PHPExcel_Shared_Drawing /** * Convert column width from (intrinsic) Excel units to pixels * - * @param float $pValue Value in cell dimension - * @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook - * @return int Value in pixels + * @param float $pValue Value in cell dimension + * @param \PHPExcel\Style\Font $pDefaultFont Default font of the workbook + * @return int Value in pixels */ - public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont) + public static function cellDimensionToPixels($pValue = 0, \PHPExcel\Style\Font $pDefaultFont) { // Font name and size $name = $pDefaultFont->getName(); $size = $pDefaultFont->getSize(); - if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) { + if (isset(\PHPExcel\Shared\Font::$defaultColumnWidths[$name][$size])) { // Exact width can be determined - $colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']; + $colWidth = $pValue * \PHPExcel\Shared\Font::$defaultColumnWidths[$name][$size]['px'] / \PHPExcel\Shared\Font::$defaultColumnWidths[$name][$size]['width']; } else { // We don't have data for this particular font and size, use approximation by // extrapolating from Calibri 11 - $colWidth = $pValue * $size * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11; + $colWidth = $pValue * $size * \PHPExcel\Shared\Font::$defaultColumnWidths['Calibri'][11]['px'] / \PHPExcel\Shared\Font::$defaultColumnWidths['Calibri'][11]['width'] / 11; } // Round pixels to closest integer diff --git a/src/PhpSpreadsheet/Shared/Escher.php b/src/PhpSpreadsheet/Shared/Escher.php index 7921f77f..b9039a16 100644 --- a/src/PhpSpreadsheet/Shared/Escher.php +++ b/src/PhpSpreadsheet/Shared/Escher.php @@ -32,21 +32,21 @@ class Escher /** * Drawing Group Container * - * @var PHPExcel_Shared_Escher_DggContainer + * @var Escher\DggContainer */ private $dggContainer; /** * Drawing Container * - * @var PHPExcel_Shared_Escher_DgContainer + * @var Escher\DgContainer */ private $dgContainer; /** * Get Drawing Group Container * - * @return PHPExcel_Shared_Escher_DgContainer + * @return Escher\DgContainer */ public function getDggContainer() { @@ -56,7 +56,7 @@ class Escher /** * Set Drawing Group Container * - * @param PHPExcel_Shared_Escher_DggContainer $dggContainer + * @param Escher\DggContainer $dggContainer */ public function setDggContainer($dggContainer) { @@ -66,7 +66,7 @@ class Escher /** * Get Drawing Container * - * @return PHPExcel_Shared_Escher_DgContainer + * @return Escher\DgContainer */ public function getDgContainer() { @@ -76,7 +76,7 @@ class Escher /** * Set Drawing Container * - * @param PHPExcel_Shared_Escher_DgContainer $dgContainer + * @param Escher\DgContainer $dgContainer */ public function setDgContainer($dgContainer) { diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php index 739cd902..ebdd1cae 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php @@ -1,5 +1,7 @@ children as $child) { - if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) { + if ($child instanceof SpgrContainer) { $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers()); } else { $allSpContainers[] = $child; diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php index a1f1a460..f1d71f00 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php @@ -1,5 +1,7 @@ getParent(); - while ($parent instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) { + while ($parent instanceof \PHPExcel\Shared\Escher\DgContainer\SpgrContainer) { ++$nestingLevel; $parent = $parent->getParent(); } diff --git a/src/PhpSpreadsheet/Shared/Escher/DggContainer.php b/src/PhpSpreadsheet/Shared/Escher/DggContainer.php index b116b1bd..24f4da77 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DggContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DggContainer.php @@ -1,5 +1,7 @@ getWidth(); - $pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font); + $pixelWidth = \PHPExcel\Shared\Drawing::cellDimensionToPixels($width, $font); } elseif ($sheet->getDefaultColumnDimension()->getWidth() != -1) { // then we have default column dimension with explicit width $defaultColumnDimension = $sheet->getDefaultColumnDimension(); $width = $defaultColumnDimension->getWidth(); - $pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font); + $pixelWidth = \PHPExcel\Shared\Drawing::cellDimensionToPixels($width, $font); } else { // we don't even have any default column dimension. Width depends on default font - $pixelWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($font, true); + $pixelWidth = \PHPExcel\Shared\Font::getDefaultColumnWidthByFont($font, true); } // now find the effective column width in pixels @@ -76,7 +76,7 @@ class Excel5 * the relationship is: y = 4/3x. If the height hasn't been set by the user we * use the default value. If the row is hidden we use a value of zero. * - * @param PHPExcel_Worksheet $sheet The sheet + * @param \PHPExcel\Worksheet $sheet The sheet * @param integer $row The row index (1-based) * @return integer The width in pixels */ @@ -97,11 +97,11 @@ class Excel5 // then we have a default row dimension with explicit height $defaultRowDimension = $sheet->getDefaultRowDimension(); $rowHeight = $defaultRowDimension->getRowHeight(); - $pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight); + $pixelRowHeight = \PHPExcel\Shared\Drawing::pointsToPixels($rowHeight); } else { // we don't even have any default row dimension. Height depends on default font - $pointRowHeight = PHPExcel_Shared_Font::getDefaultRowHeightByFont($font); - $pixelRowHeight = PHPExcel_Shared_Font::fontSizeToPixels($pointRowHeight); + $pointRowHeight = \PHPExcel\Shared\Font::getDefaultRowHeightByFont($font); + $pixelRowHeight = \PHPExcel\Shared\Font::fontSizeToPixels($pointRowHeight); } // now find the effective row height in pixels @@ -118,22 +118,22 @@ class Excel5 * Get the horizontal distance in pixels between two anchors * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets * - * @param PHPExcel_Worksheet $sheet + * @param \PHPExcel\Worksheet $sheet * @param string $startColumn * @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width * @param string $endColumn * @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width * @return integer Horizontal measured in pixels */ - public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0) + public static function getDistanceX(\PHPExcel\Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0) { $distanceX = 0; // add the widths of the spanning columns - $startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; // 1-based - $endColumnIndex = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; // 1-based + $startColumnIndex = \PHPExcel\Cell::columnIndexFromString($startColumn) - 1; // 1-based + $endColumnIndex = \PHPExcel\Cell::columnIndexFromString($endColumn) - 1; // 1-based for ($i = $startColumnIndex; $i <= $endColumnIndex; ++$i) { - $distanceX += self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($i)); + $distanceX += self::sizeCol($sheet, \PHPExcel\Cell::stringFromColumnIndex($i)); } // correct for offsetX in startcell @@ -149,14 +149,14 @@ class Excel5 * Get the vertical distance in pixels between two anchors * The distanceY is found as sum of all the spanning rows minus two offsets * - * @param PHPExcel_Worksheet $sheet + * @param \PHPExcel\Worksheet $sheet * @param integer $startRow (1-based) * @param integer $startOffsetY Offset within start cell measured in 1/256 of the cell height * @param integer $endRow (1-based) * @param integer $endOffsetY Offset within end cell measured in 1/256 of the cell height * @return integer Vertical distance measured in pixels */ - public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0) + public static function getDistanceY(\PHPExcel\Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0) { $distanceY = 0; @@ -218,7 +218,7 @@ class Excel5 * W is the width of the cell * H is the height of the cell * - * @param PHPExcel_Worksheet $sheet + * @param \PHPExcel\Worksheet $sheet * @param string $coordinates E.g. 'A1' * @param integer $offsetX Horizontal offset in pixels * @param integer $offsetY Vertical offset in pixels @@ -228,8 +228,8 @@ class Excel5 */ public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height) { - list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinates); - $col_start = PHPExcel_Cell::columnIndexFromString($column) - 1; + list($column, $row) = \PHPExcel\Cell::coordinateFromString($coordinates); + $col_start = \PHPExcel\Cell::columnIndexFromString($column) - 1; $row_start = $row - 1; $x1 = $offsetX; @@ -240,7 +240,7 @@ class Excel5 $row_end = $row_start; // Row containing bottom right corner of object // Zero the specified offset if greater than the cell dimensions - if ($x1 >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) { + if ($x1 >= self::sizeCol($sheet, \PHPExcel\Cell::stringFromColumnIndex($col_start))) { $x1 = 0; } if ($y1 >= self::sizeRow($sheet, $row_start + 1)) { @@ -251,8 +251,8 @@ class Excel5 $height = $height + $y1 -1; // Subtract the underlying cell widths to find the end cell of the image - while ($width >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) { - $width -= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)); + while ($width >= self::sizeCol($sheet, \PHPExcel\Cell::stringFromColumnIndex($col_end))) { + $width -= self::sizeCol($sheet, \PHPExcel\Cell::stringFromColumnIndex($col_end)); ++$col_end; } @@ -264,10 +264,10 @@ class Excel5 // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell // with zero height or width. - if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) { + if (self::sizeCol($sheet, \PHPExcel\Cell::stringFromColumnIndex($col_start)) == 0) { return; } - if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) { + if (self::sizeCol($sheet, \PHPExcel\Cell::stringFromColumnIndex($col_end)) == 0) { return; } if (self::sizeRow($sheet, $row_start + 1) == 0) { @@ -278,13 +278,13 @@ class Excel5 } // Convert the pixel values to the percentage value expected by Excel - $x1 = $x1 / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024; + $x1 = $x1 / self::sizeCol($sheet, \PHPExcel\Cell::stringFromColumnIndex($col_start)) * 1024; $y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256; - $x2 = ($width + 1) / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object + $x2 = ($width + 1) / self::sizeCol($sheet, \PHPExcel\Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object $y2 = ($height + 1) / self::sizeRow($sheet, $row_end + 1) * 256; // Distance to bottom of object - $startCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_start) . ($row_start + 1); - $endCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_end) . ($row_end + 1); + $startCoordinates = \PHPExcel\Cell::stringFromColumnIndex($col_start) . ($row_start + 1); + $endCoordinates = \PHPExcel\Cell::stringFromColumnIndex($col_end) . ($row_end + 1); $twoAnchor = array( 'startCoordinates' => $startCoordinates, diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index 4d191afb..a2c49204 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -237,16 +237,16 @@ class Font /** * Calculate an (approximate) OpenXML column width, based on font size and text contained * - * @param PHPExcel_Style_Font $font Font object - * @param PHPExcel_RichText|string $cellText Text to calculate width + * @param \PHPExcel\Style\Font $font Font object + * @param \PHPExcel\RichText|string $cellText Text to calculate width * @param integer $rotation Rotation angle - * @param PHPExcel_Style_Font|NULL $defaultFont Font object + * @param \PHPExcel\Style\Font|NULL $defaultFont Font object * @return integer Column width */ - public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null) + public static function calculateColumnWidth(\PHPExcel\Style\Font $font, $cellText = '', $rotation = 0, \PHPExcel\Style\Font $defaultFont = null) { // If it is rich text, use plain text - if ($cellText instanceof PHPExcel_RichText) { + if ($cellText instanceof \PHPExcel\RichText) { $cellText = $cellText->getPlainText(); } @@ -268,7 +268,7 @@ class Font // Width of text in pixels excl. padding // and addition because Excel adds some padding, just use approx width of 'n' glyph $columnWidth = self::getTextWidthPixelsExact($cellText, $font, $rotation) + $columnWidthAdjust; - } catch (PHPExcel_Exception $e) { + } catch (\PHPExcel\Exception $e) { $approximate = true; } } @@ -281,7 +281,7 @@ class Font } // Convert from pixel width to column width - $columnWidth = PHPExcel_Shared_Drawing::pixelsToCellDimension($columnWidth, $defaultFont); + $columnWidth = Drawing::pixelsToCellDimension($columnWidth, $defaultFont); // Return return round($columnWidth, 6); @@ -291,15 +291,15 @@ class Font * Get GD text width in pixels for a string of text in a certain font at a certain rotation angle * * @param string $text - * @param PHPExcel_Style_Font + * @param \PHPExcel\Style\Font * @param int $rotation * @return int - * @throws PHPExcel_Exception + * @throws \PHPExcel\Exception */ - public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0) + public static function getTextWidthPixelsExact($text, \PHPExcel\Style\Font $font, $rotation = 0) { if (!function_exists('imagettfbbox')) { - throw new PHPExcel_Exception('GD library needs to be enabled'); + throw new \PHPExcel\Exception('GD library needs to be enabled'); } // font size should really be supplied in pixels in GD2, @@ -327,11 +327,11 @@ class Font * Get approximate width in pixels for a string of text in a certain font at a certain rotation angle * * @param string $columnText - * @param PHPExcel_Style_Font $font + * @param \PHPExcel\Style\Font $font * @param int $rotation * @return int Text width in pixels (no padding added) */ - public static function getTextWidthPixelsApprox($columnText, PHPExcel_Style_Font $font = null, $rotation = 0) + public static function getTextWidthPixelsApprox($columnText, \PHPExcel\Style\Font $font = null, $rotation = 0) { $fontName = $font->getName(); $fontSize = $font->getSize(); @@ -340,27 +340,27 @@ class Font switch ($fontName) { case 'Calibri': // value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font. - $columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText)); + $columnWidth = (int) (8.26 * String::CountCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size break; case 'Arial': // value 7 was found via interpolation by inspecting real Excel files with Arial 10 font. -// $columnWidth = (int) (7 * PHPExcel_Shared_String::CountCharacters($columnText)); +// $columnWidth = (int) (7 * String::CountCharacters($columnText)); // value 8 was set because of experience in different exports at Arial 10 font. - $columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText)); + $columnWidth = (int) (8 * String::CountCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size break; case 'Verdana': // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font. - $columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText)); + $columnWidth = (int) (8 * String::CountCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size break; default: // just assume Calibri - $columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText)); + $columnWidth = (int) (8.26 * String::CountCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size break; } @@ -417,18 +417,18 @@ class Font /** * Returns the font path given the font * - * @param PHPExcel_Style_Font + * @param \PHPExcel\Style\Font * @return string Path to TrueType font file */ public static function getTrueTypeFontFileFromFont($font) { if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) { - throw new PHPExcel_Exception('Valid directory to TrueType Font files not specified'); + throw new \PHPExcel\Exception('Valid directory to TrueType Font files not specified'); } - $name = $font->getName(); - $bold = $font->getBold(); - $italic = $font->getItalic(); + $name = $font->getName(); + $bold = $font->getBold(); + $italic = $font->getItalic(); // Check if we can map font to true type font file switch ($name) { @@ -512,7 +512,7 @@ class Font ); break; default: - throw new PHPExcel_Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file'); + throw new \PHPExcel\Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file'); break; } @@ -520,7 +520,7 @@ class Font // Check if file actually exists if (!file_exists($fontFile)) { - throw new PHPExcel_Exception('TrueType Font file not found'); + throw new \PHPExcel\Exception('TrueType Font file not found'); } return $fontFile; @@ -553,11 +553,11 @@ class Font * Get the effective column width for columns without a column dimension or column with width -1 * For example, for Calibri 11 this is 9.140625 (64 px) * - * @param PHPExcel_Style_Font $font The workbooks default font + * @param \PHPExcel\Style\Font $font The workbooks default font * @param boolean $pPixels true = return column width in pixels, false = return in OOXML units * @return mixed Column width */ - public static function getDefaultColumnWidthByFont(PHPExcel_Style_Font $font, $pPixels = false) + public static function getDefaultColumnWidthByFont(\PHPExcel\Style\Font $font, $pPixels = false) { if (isset(self::$defaultColumnWidths[$font->getName()][$font->getSize()])) { // Exact width can be determined @@ -586,10 +586,10 @@ class Font * Get the effective row height for rows without a row dimension or rows with height -1 * For example, for Calibri 11 this is 15 points * - * @param PHPExcel_Style_Font $font The workbooks default font + * @param \PHPExcel\Style\Font $font The workbooks default font * @return float Row height in points */ - public static function getDefaultRowHeightByFont(PHPExcel_Style_Font $font) + public static function getDefaultRowHeightByFont(\PHPExcel\Style\Font $font) { switch ($font->getName()) { case 'Arial': diff --git a/src/PhpSpreadsheet/Shared/OLE.php b/src/PhpSpreadsheet/Shared/OLE.php index fe31059f..fa391b64 100644 --- a/src/PhpSpreadsheet/Shared/OLE.php +++ b/src/PhpSpreadsheet/Shared/OLE.php @@ -95,23 +95,24 @@ class OLE * @acces public * @param string $file * @return mixed true on success, PEAR_Error on failure + * @throws \PHPExcel\Reader\Exception */ public function read($file) { $fh = fopen($file, "r"); if (!$fh) { - throw new PHPExcel_Reader_Exception("Can't open file $file"); + throw new \PHPExcel\Reader\Exception("Can't open file $file"); } $this->_file_handle = $fh; $signature = fread($fh, 8); if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) { - throw new PHPExcel_Reader_Exception("File doesn't seem to be an OLE container."); + throw new \PHPExcel\Reader\Exception("File doesn't seem to be an OLE container."); } fseek($fh, 28); if (fread($fh, 2) != "\xFE\xFF") { // This shouldn't be a problem in practice - throw new PHPExcel_Reader_Exception("Only Little-Endian encoding is supported."); + throw new \PHPExcel\Reader\Exception("Only Little-Endian encoding is supported."); } // Size of blocks and short blocks in bytes $this->bigBlockSize = pow(2, self::_readInt2($fh)); @@ -193,7 +194,7 @@ class OLE /** * Returns a stream for use with fread() etc. External callers should - * use PHPExcel_Shared_OLE_PPS_File::getStream(). + * use \PHPExcel\Shared\OLE\PPS\File::getStream(). * @param int|PPS block id or PPS * @return resource read-only stream */ @@ -201,7 +202,7 @@ class OLE { static $isRegistered = false; if (!$isRegistered) { - stream_wrapper_register('ole-chainedblockstream', 'PHPExcel_Shared_OLE_ChainedBlockStream'); + stream_wrapper_register('ole-chainedblockstream', '\\PHPExcel\\Shared\\OLE\\ChainedBlockStream'); $isRegistered = true; } @@ -212,7 +213,7 @@ class OLE $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES'])); $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId; - if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) { + if ($blockIdOrPps instanceof OLE\PPS) { $path .= '&blockId=' . $blockIdOrPps->_StartBlock; $path .= '&size=' . $blockIdOrPps->Size; } else { @@ -278,14 +279,14 @@ class OLE $type = self::_readInt1($fh); switch ($type) { case self::OLE_PPS_TYPE_ROOT: - $pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array()); + $pps = new OLE\PPS_Root(null, null, array()); $this->root = $pps; break; case self::OLE_PPS_TYPE_DIR: - $pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, null, null, null, null, array()); + $pps = new OLE\PPS(null, null, null, null, null, null, null, null, null, array()); break; case self::OLE_PPS_TYPE_FILE: - $pps = new PHPExcel_Shared_OLE_PPS_File($name); + $pps = new OLE\PPS\File($name); break; default: continue; diff --git a/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php b/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php index 84d2cc50..e3fc5249 100644 --- a/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php +++ b/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php @@ -1,5 +1,7 @@ Time1st) // 108 - . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116 + . \PHPExcel\Shared\OLE::LocalDate2OLE($this->Time1st) // 108 + . \PHPExcel\Shared\OLE::LocalDate2OLE($this->Time2nd) // 116 . pack("V", isset($this->_StartBlock)? $this->_StartBlock:0) // 120 . pack("V", $this->Size) // 124 diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS/File.php b/src/PhpSpreadsheet/Shared/OLE/PPS/File.php index 1ca337cb..5dc333cf 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS/File.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS/File.php @@ -1,4 +1,7 @@ _tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); + $this->_tempDir = \PHPExcel\Shared\File::sys_get_temp_dir(); - parent::__construct(null, PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'), PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT, null, null, null, $time_1st, $time_2nd, null, $raChild); + parent::__construct(null, \PHPExcel\Shared\OLE::Asc2Ucs('Root Entry'), \PHPExcel\Shared\OLE::OLE_PPS_TYPE_ROOT, null, null, null, $time_1st, $time_2nd, null, $raChild); } /** @@ -57,6 +60,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS * @param string|resource $filename The name of the file or stream where to save the OLE container. * @access public * @return mixed true on success + * @throws \PHPExcel\Writer\Exception */ public function save($filename) { @@ -74,22 +78,22 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS $this->_FILEH_ = $filename; } elseif ($filename == '-' || $filename == '') { if ($this->tempDirectory === null) { - $this->tempDirectory = PHPExcel_Shared_File::sys_get_temp_dir(); + $this->tempDirectory = \PHPExcel\Shared\File::sys_get_temp_dir(); } $this->_tmp_filename = tempnam($this->tempDirectory, "OLE_PPS_Root"); $this->_FILEH_ = fopen($this->_tmp_filename, "w+b"); if ($this->_FILEH_ == false) { - throw new PHPExcel_Writer_Exception("Can't create temporary file."); + throw new \PHPExcel\Writer\Exception("Can't create temporary file."); } } else { $this->_FILEH_ = fopen($filename, "wb"); } if ($this->_FILEH_ == false) { - throw new PHPExcel_Writer_Exception("Can't open $filename. It may be in use or protected."); + throw new \PHPExcel\Writer\Exception("Can't open $filename. It may be in use or protected."); } // Make an array of PPS's (for Save) $aList = array(); - PHPExcel_Shared_OLE_PPS::_savePpsSetPnt($aList, array($this)); + \PHPExcel\Shared\OLE\PPS::_savePpsSetPnt($aList, array($this)); // calculate values for header list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo); // Save Header @@ -127,9 +131,9 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS $iSBcnt = 0; $iCount = count($raList); for ($i = 0; $i < $iCount; ++$i) { - if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) { + if ($raList[$i]->Type == \PHPExcel\Shared\OLE::OLE_PPS_TYPE_FILE) { $raList[$i]->Size = $raList[$i]->_DataLen(); - if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) { + if ($raList[$i]->Size < \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) { $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); } else { @@ -139,12 +143,12 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } } $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE; - $iSlCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE); + $iSlCnt = floor($this->_BIG_BLOCK_SIZE / \PHPExcel\Shared\OLE::OLE_LONG_INT_SIZE); $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0); $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) + (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0)); $iCnt = count($raList); - $iBdCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE; + $iBdCnt = $this->_BIG_BLOCK_SIZE / \PHPExcel\Shared\OLE::OLE_PPS_SIZE; $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0)); return array($iSBDcnt, $iBBcnt, $iPPScnt); @@ -177,8 +181,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS $FILE = $this->_FILEH_; // Calculate Basic Setting - $iBlCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; - $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; + $iBlCnt = $this->_BIG_BLOCK_SIZE / \PHPExcel\Shared\OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / \PHPExcel\Shared\OLE::OLE_LONG_INT_SIZE; $iBdExL = 0; $iAll = $iBBcnt + $iPPScnt + $iSBDcnt; @@ -246,7 +250,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } /** - * Saving big data (PPS's with data bigger than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) + * Saving big data (PPS's with data bigger than \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) * * @access public * @param integer $iStBlk @@ -259,9 +263,9 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS // cycle through PPS's $iCount = count($raList); for ($i = 0; $i < $iCount; ++$i) { - if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) { + 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; @@ -294,7 +298,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } /** - * get small data (PPS's with data smaller than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) + * get small data (PPS's with data smaller than \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) * * @access public * @param array &$raList Reference to array of PPS's @@ -308,11 +312,11 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS $iCount = count($raList); for ($i = 0; $i < $iCount; ++$i) { // Make SBD, small data string - if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) { + if ($raList[$i]->Type == \PHPExcel\Shared\OLE::OLE_PPS_TYPE_FILE) { if ($raList[$i]->Size <= 0) { continue; } - if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) { + if ($raList[$i]->Size < \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) { $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); // Add to SBD @@ -340,7 +344,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } } } - $iSbCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE); + $iSbCnt = floor($this->_BIG_BLOCK_SIZE / \PHPExcel\Shared\OLE::OLE_LONG_INT_SIZE); if ($iSmBlk % $iSbCnt) { $iB = $iSbCnt - ($iSmBlk % $iSbCnt); for ($i = 0; $i < $iB; ++$i) { @@ -365,9 +369,9 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS } // Adjust for Block $iCnt = count($raList); - $iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE; + $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)); } } @@ -383,8 +387,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS { $FILE = $this->_FILEH_; // Calculate Basic Setting - $iBbCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; - $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; + $iBbCnt = $this->_BIG_BLOCK_SIZE / \PHPExcel\Shared\OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / \PHPExcel\Shared\OLE::OLE_LONG_INT_SIZE; $iBdExL = 0; $iAll = $iBsize + $iPpsCnt + $iSbdSize; diff --git a/src/PhpSpreadsheet/Shared/OLERead.php b/src/PhpSpreadsheet/Shared/OLERead.php index 829e3251..14cddedc 100644 --- a/src/PhpSpreadsheet/Shared/OLERead.php +++ b/src/PhpSpreadsheet/Shared/OLERead.php @@ -75,13 +75,13 @@ class OLERead * Read the file * * @param $sFileName string Filename - * @throws PHPExcel_Reader_Exception + * @throws \PHPExcel\Reader\Exception */ public function read($sFileName) { // Check if file exists and is readable if (!is_readable($sFileName)) { - throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable."); + throw new \PHPExcel\Reader\Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable."); } // Get the file identifier @@ -90,7 +90,7 @@ class OLERead // Check OLE identifier if ($this->data != self::IDENTIFIER_OLE) { - throw new PHPExcel_Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file'); + throw new \PHPExcel\Reader\Exception('The filename ' . $sFileName . ' is not recognised as an OLE file'); } // Get the file data diff --git a/src/PhpSpreadsheet/Shared/String.php b/src/PhpSpreadsheet/Shared/String.php index c7181de4..6954e850 100644 --- a/src/PhpSpreadsheet/Shared/String.php +++ b/src/PhpSpreadsheet/Shared/String.php @@ -681,7 +681,7 @@ class String if (preg_match('/^'.self::STRING_REGEXP_FRACTION.'$/i', $operand, $match)) { $sign = ($match[1] == '-') ? '-' : '+'; $fractionFormula = '='.$sign.$match[2].$sign.$match[3]; - $operand = PHPExcel_Calculation::getInstance()->_calculateFormulaValue($fractionFormula); + $operand = \PHPExcel\Calculation::getInstance()->_calculateFormulaValue($fractionFormula); return true; } return false; @@ -709,8 +709,8 @@ class String } /** - * Set the decimal separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() - * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF + * Set the decimal separator. Only used by \PHPExcel\Style\NumberFormat::toFormattedString() + * to format output by \PHPExcel\Writer\HTML and \PHPExcel\Writer\PDF * * @param string $pValue Character for decimal separator */ @@ -741,8 +741,8 @@ class String } /** - * Set the thousands separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() - * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF + * Set the thousands separator. Only used by \PHPExcel\Style\NumberFormat::toFormattedString() + * to format output by \PHPExcel\Writer\HTML and \PHPExcel\Writer\PDF * * @param string $pValue Character for thousands separator */ @@ -773,8 +773,8 @@ class String } /** - * Set the currency code. Only used by PHPExcel_Style_NumberFormat::toFormattedString() - * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF + * Set the currency code. Only used by \PHPExcel\Style\NumberFormat::toFormattedString() + * to format output by \PHPExcel\Writer\HTML and \PHPExcel\Writer\PDF * * @param string $pValue Character for currency code */ diff --git a/src/PhpSpreadsheet/Shared/TimeZone.php b/src/PhpSpreadsheet/Shared/TimeZone.php index b067a358..8dab9db2 100644 --- a/src/PhpSpreadsheet/Shared/TimeZone.php +++ b/src/PhpSpreadsheet/Shared/TimeZone.php @@ -106,16 +106,16 @@ class TimeZone * Return the Timezone offset used for date/time conversions to/from UST * This requires both the timezone and the calculated date/time to allow for local DST * - * @param string $timezone The timezone for finding the adjustment to UST - * @param integer $timestamp PHP date/time value - * @return integer Number of seconds for timezone adjustment - * @throws PHPExcel_Exception + * @param string $timezone The timezone for finding the adjustment to UST + * @param integer $timestamp PHP date/time value + * @return integer Number of seconds for timezone adjustment + * @throws \PHPExcel\Exception */ public static function getTimeZoneAdjustment($timezone, $timestamp) { if ($timezone !== null) { if (!self::_validateTimezone($timezone)) { - throw new PHPExcel_Exception("Invalid timezone " . $timezone); + throw new \PHPExcel\Exception("Invalid timezone " . $timezone); } } else { $timezone = self::$timezone; @@ -125,7 +125,7 @@ class TimeZone return 0; } - $objTimezone = new DateTimeZone($timezone); + $objTimezone = new \DateTimeZone($timezone); if (version_compare(PHP_VERSION, '5.3.0') >= 0) { $transitions = $objTimezone->getTransitions($timestamp, $timestamp); } else { diff --git a/src/PhpSpreadsheet/Shared/XMLWriter.php b/src/PhpSpreadsheet/Shared/XMLWriter.php index 98a2615b..9f460fb0 100644 --- a/src/PhpSpreadsheet/Shared/XMLWriter.php +++ b/src/PhpSpreadsheet/Shared/XMLWriter.php @@ -49,7 +49,7 @@ class XMLWriter extends \XMLWriter private $tempFileName = ''; /** - * Create a new PHPExcel_Shared_XMLWriter instance + * Create a new XMLWriter instance * * @param int $pTemporaryStorage Temporary storage location * @param string $pTemporaryStorageFolder Temporary storage folder @@ -62,7 +62,7 @@ class XMLWriter extends \XMLWriter } else { // Create temporary filename if ($pTemporaryStorageFolder === null) { - $pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir(); + $pTemporaryStorageFolder = File::sys_get_temp_dir(); } $this->tempFileName = @tempnam($pTemporaryStorageFolder, 'xml'); diff --git a/src/PhpSpreadsheet/Shared/ZipArchive.php b/src/PhpSpreadsheet/Shared/ZipArchive.php index f8e614f4..03fe528b 100644 --- a/src/PhpSpreadsheet/Shared/ZipArchive.php +++ b/src/PhpSpreadsheet/Shared/ZipArchive.php @@ -3,7 +3,7 @@ namespace PHPExcel\Shared; if (!defined('PCLZIP_TEMPORARY_DIR')) { - define('PCLZIP_TEMPORARY_DIR', PHPExcel_Shared_File::sys_get_temp_dir() . DIRECTORY_SEPARATOR); + define('PCLZIP_TEMPORARY_DIR', File::sys_get_temp_dir() . DIRECTORY_SEPARATOR); } require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php'; @@ -63,7 +63,7 @@ class ZipArchive */ public function open($fileName) { - $this->tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); + $this->tempDir = File::sys_get_temp_dir(); $this->zip = new PclZip($fileName); return true; @@ -84,6 +84,7 @@ class ZipArchive * * @param string $localname Directory/Name of the file to add to the zip archive * @param string $contents String of data to add to the zip archive + * @throws \PHPExcel\Writer\Exception */ public function addFromString($localname, $contents) { @@ -95,7 +96,7 @@ class ZipArchive $res = $this->zip->add($this->tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]); if ($res == 0) { - throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->zip->errorInfo(true)); + throw new \PHPExcel\Writer\Exception("Error zipping files : " . $this->zip->errorInfo(true)); } unlink($this->tempDir.'/'.$filenameParts["basename"]); diff --git a/src/PhpSpreadsheet/Shared/ZipStreamWrapper.php b/src/PhpSpreadsheet/Shared/ZipStreamWrapper.php index 2c837dba..32590290 100644 --- a/src/PhpSpreadsheet/Shared/ZipStreamWrapper.php +++ b/src/PhpSpreadsheet/Shared/ZipStreamWrapper.php @@ -73,13 +73,14 @@ class ZipStreamWrapper * @param string $mode only "r" is supported * @param int $options mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH * @param string &$openedPath absolute path of the opened stream (out parameter) - * @return bool true on success + * @return bool true on success + * @throws \PHPExcel\Reader\Exception */ public function stream_open($path, $mode, $options, &$opened_path) { // Check for mode if ($mode{0} != 'r') { - throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); + throw new \PHPExcel\Reader\Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); } $pos = strrpos($path, '#');