diff --git a/CHANGELOG.md b/CHANGELOG.md index a5672cd8..5887b78f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Standardization of array keys used for style, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). - Easier usage of PDF writers, and other custom readers and writers, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). +- Easier usage of chart renderers, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). +- Rename a few more classes to keep them in their related namespaces: + - `CalcEngine` => `Calculation\Engine` + - `PhpSpreadsheet\Calculation` => `PhpSpreadsheet\Calculation\Calculation` + - `PhpSpreadsheet\Cell` => `PhpSpreadsheet\Cell\Cell` + - `PhpSpreadsheet\Chart` => `PhpSpreadsheet\Chart\Chart` + - `PhpSpreadsheet\RichText` => `PhpSpreadsheet\RichText\RichText` + - `PhpSpreadsheet\Style` => `PhpSpreadsheet\Style\Style` + - `PhpSpreadsheet\Worksheet` => `PhpSpreadsheet\Worksheet\Worksheet` ## [1.0.0-beta] - 2017-08-17 diff --git a/docs/topics/accessing-cells.md b/docs/topics/accessing-cells.md index f5416ed7..7cc7ed73 100644 --- a/docs/topics/accessing-cells.md +++ b/docs/topics/accessing-cells.md @@ -389,7 +389,7 @@ $worksheet = $spreadsheet->getActiveSheet(); // Get the highest row and column numbers referenced in the worksheet $highestRow = $worksheet->getHighestRow(); // e.g. 10 $highestColumn = $worksheet->getHighestColumn(); // e.g 'F' -$highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($highestColumn); // e.g. 5 +$highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell\Cell::columnIndexFromString($highestColumn); // e.g. 5 echo '' . "\n"; for ($row = 1; $row <= $highestRow; ++$row) { @@ -459,7 +459,7 @@ value binder in PhpSpreadsheet: require_once 'src/Boostrap.php'; // Set value binder -\PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); +\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); // Create new Spreadsheet object $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); diff --git a/docs/topics/reading-files.md b/docs/topics/reading-files.md index 5b07a81d..d15f2649 100644 --- a/docs/topics/reading-files.md +++ b/docs/topics/reading-files.md @@ -575,7 +575,7 @@ these values during the load process within a Value Binder. A Value Binder is a class that implement the \PhpOffice\PhpSpreadsheet\Cell\IValueBinder interface. It must contain a -bindValue() method that accepts a \PhpOffice\PhpSpreadsheet\Cell and a +bindValue() method that accepts a `\PhpOffice\PhpSpreadsheet\Cell\Cell` and a value as arguments, and return a boolean true or false that indicates whether the workbook cell has been populated with the value or not. The Advanced Value Binder implements such a class: amongst other tests, it @@ -593,7 +593,7 @@ loader logic when reading unformatted text files. ``` php /** Tell PhpSpreadsheet that we want to use the Advanced Value Binder **/ -\PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); +\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); $inputFileType = 'Csv'; $inputFileName = './sampleData/example1.tsv'; diff --git a/docs/topics/recipes.md b/docs/topics/recipes.md index 6a8bf44a..05664580 100644 --- a/docs/topics/recipes.md +++ b/docs/topics/recipes.md @@ -71,7 +71,7 @@ method that suits you the best. Here are some examples: ``` php // MySQL-like timestamp '2008-12-31' or date string -\PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); +\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); $spreadsheet->getActiveSheet() ->setCellValue('D1', '2008-12-31'); @@ -248,7 +248,7 @@ when it sees a newline character in a string that you are inserting in a cell. Just like Microsoft Office Excel. Try this: ``` php -\PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); +\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); $spreadsheet->getActiveSheet()->getCell('A1')->setValue("hello\nworld"); ``` @@ -743,13 +743,13 @@ easy manner. ### Valid array keys for style `applyFromArray()` The following table lists the valid array keys for -\PhpOffice\PhpSpreadsheet\Style applyFromArray() classes. If the "Maps +`\PhpOffice\PhpSpreadsheet\Style\Style::applyFromArray()` classes. If the "Maps to property" column maps a key to a setter, the value provided for that key will be applied directly. If the "Maps to property" column maps a key to a getter, the value provided for that key will be applied as another style array. -**\PhpOffice\PhpSpreadsheet\Style** +**\PhpOffice\PhpSpreadsheet\Style\Style** Array key | Maps to property -------------|------------------- diff --git a/samples/Basic/02_Types.php b/samples/Basic/02_Types.php index a61a9d6a..13137586 100644 --- a/samples/Basic/02_Types.php +++ b/samples/Basic/02_Types.php @@ -1,6 +1,6 @@ log('Set value binder'); -Cell::setValueBinder(new Cell\AdvancedValueBinder()); +Cell::setValueBinder(new AdvancedValueBinder()); // Create new Spreadsheet object $helper->log('Create new Spreadsheet object'); diff --git a/samples/Basic/40_Duplicate_style.php b/samples/Basic/40_Duplicate_style.php index 9d167641..eaff8bd6 100644 --- a/samples/Basic/40_Duplicate_style.php +++ b/samples/Basic/40_Duplicate_style.php @@ -1,8 +1,8 @@ diff --git a/samples/Chart/33_Chart_create_area.php b/samples/Chart/33_Chart_create_area.php index c9f1c7f9..f44232fb 100644 --- a/samples/Chart/33_Chart_create_area.php +++ b/samples/Chart/33_Chart_create_area.php @@ -1,6 +1,6 @@ setShowVal(true); $layout1->setShowPercent(true); @@ -137,7 +138,7 @@ $series2 = new DataSeries( ); // Set up a layout object for the Pie chart -$layout2 = new Chart\Layout(); +$layout2 = new Layout(); $layout2->setShowVal(true); $layout2->setShowCatName(true); diff --git a/samples/Chart/33_Chart_create_radar.php b/samples/Chart/33_Chart_create_radar.php index 50179ea2..9d05f858 100644 --- a/samples/Chart/33_Chart_create_radar.php +++ b/samples/Chart/33_Chart_create_radar.php @@ -1,8 +1,9 @@ delta = 1 * pow(10, 0 - ini_get('precision')); $this->spreadsheet = $spreadsheet; - $this->cyclicReferenceStack = new CalcEngine\CyclicReferenceStack(); - $this->debugLog = new CalcEngine\Logger($this->cyclicReferenceStack); + $this->cyclicReferenceStack = new CyclicReferenceStack(); + $this->debugLog = new Logger($this->cyclicReferenceStack); } private static function loadLocales() @@ -2049,7 +2045,7 @@ class Calculation /** * Get the Logger for this calculation engine instance. * - * @return CalcEngine\Logger + * @return Logger */ public function getDebugLog() { @@ -2059,11 +2055,11 @@ class Calculation /** * __clone implementation. Cloning should not be allowed in a Singleton! * - * @throws Calculation\Exception + * @throws Exception */ final public function __clone() { - throw new Calculation\Exception('Cloning the calculation engine is not allowed!'); + throw new Exception('Cloning the calculation engine is not allowed!'); } /** @@ -2446,7 +2442,7 @@ class Calculation return '"' . $value . '"'; // Convert numeric errors to NaN error } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { - return Calculation\Functions::NAN(); + return Functions::NAN(); } return $value; @@ -2467,7 +2463,7 @@ class Calculation } // Convert numeric errors to NAN error } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { - return Calculation\Functions::NAN(); + return Functions::NAN(); } return $value; @@ -2479,7 +2475,7 @@ class Calculation * * @param Cell $pCell Cell to calculate * - * @throws Calculation\Exception + * @throws Exception * * @return mixed */ @@ -2487,8 +2483,8 @@ class Calculation { try { return $this->calculateCellValue($pCell); - } catch (Exception $e) { - throw new Calculation\Exception($e->getMessage()); + } catch (\Exception $e) { + throw new Exception($e->getMessage()); } } @@ -2498,7 +2494,7 @@ class Calculation * @param Cell $pCell Cell to calculate * @param bool $resetLog Flag indicating whether the debug log should be reset or not * - * @throws Calculation\Exception + * @throws Exception * * @return mixed */ @@ -2529,18 +2525,18 @@ class Calculation $result = self::unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell)); $cellAddress = array_pop($this->cellStack); $this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']); - } catch (Exception $e) { + } catch (\Exception $e) { $cellAddress = array_pop($this->cellStack); $this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']); - throw new Calculation\Exception($e->getMessage()); + throw new Exception($e->getMessage()); } if ((is_array($result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) { self::$returnArrayAsType = $returnArrayAsType; - $testResult = Calculation\Functions::flattenArray($result); + $testResult = Functions::flattenArray($result); if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) { - return Calculation\Functions::VALUE(); + return Functions::VALUE(); } // If there's only a single cell in the array, then we allow it if (count($testResult) != 1) { @@ -2548,13 +2544,13 @@ class Calculation $r = array_keys($result); $r = array_shift($r); if (!is_numeric($r)) { - return Calculation\Functions::VALUE(); + return Functions::VALUE(); } if (is_array($result[$r])) { $c = array_keys($result[$r]); $c = array_shift($c); if (!is_numeric($c)) { - return Calculation\Functions::VALUE(); + return Functions::VALUE(); } } } @@ -2565,7 +2561,7 @@ class Calculation if ($result === null) { return 0; } elseif ((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) { - return Calculation\Functions::NAN(); + return Functions::NAN(); } return $result; @@ -2576,7 +2572,7 @@ class Calculation * * @param string $formula Formula to parse * - * @throws Calculation\Exception + * @throws Exception * * @return array */ @@ -2604,7 +2600,7 @@ class Calculation * @param string $cellID Address of the cell to calculate * @param Cell $pCell Cell to calculate * - * @throws Calculation\Exception + * @throws Exception * * @return mixed */ @@ -2628,8 +2624,8 @@ class Calculation // Execute the calculation try { $result = self::unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); - } catch (Exception $e) { - throw new Calculation\Exception($e->getMessage()); + } catch (\Exception $e) { + throw new Exception($e->getMessage()); } if ($this->spreadsheet === null) { @@ -2680,7 +2676,7 @@ class Calculation * @param string $cellID The ID (e.g. A3) of the cell that we are calculating * @param Cell $pCell Cell to calculate * - * @throws Calculation\Exception + * @throws Exception * * @return mixed */ @@ -2908,7 +2904,7 @@ class Calculation private function showValue($value) { if ($this->debugLog->getWriteDebugLog()) { - $testArray = Calculation\Functions::flattenArray($value); + $testArray = Functions::flattenArray($value); if (count($testArray) == 1) { $value = array_pop($testArray); } @@ -2933,7 +2929,7 @@ class Calculation } } - return Calculation\Functions::flattenSingleValue($value); + return Functions::flattenSingleValue($value); } /** @@ -2946,7 +2942,7 @@ class Calculation private function showTypeDetails($value) { if ($this->debugLog->getWriteDebugLog()) { - $testArray = Calculation\Functions::flattenArray($value); + $testArray = Functions::flattenArray($value); if (count($testArray) == 1) { $value = array_pop($testArray); } @@ -3070,7 +3066,7 @@ class Calculation /** * @param string $formula - * @param null|Cell $pCell + * @param null|\PhpOffice\PhpSpreadsheet\Cell\Cell $pCell * * @return bool */ @@ -3507,7 +3503,7 @@ class Calculation } $stack->push('Cell Reference', $cellValue, $cellRef); } else { - $stack->push('Error', Calculation\Functions::REF(), null); + $stack->push('Error', Functions::REF(), null); } break; @@ -3551,7 +3547,7 @@ class Calculation // Perform the required operation against the operand 1 matrix, passing in operand 2 $matrixResult = $matrix->concat($operand2); $result = $matrixResult->getArray(); - } catch (Exception $ex) { + } catch (\Exception $ex) { $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $result = '#VALUE!'; } @@ -3599,7 +3595,7 @@ class Calculation $matrix1 = new Shared\JAMA\Matrix($arg); $matrixResult = $matrix1->arrayTimesEquals($multiplier); $result = $matrixResult->getArray(); - } catch (Exception $ex) { + } catch (\Exception $ex) { $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $result = '#VALUE!'; } @@ -3613,7 +3609,7 @@ class Calculation if (isset($matches[8])) { if ($pCell === null) { // We can't access the range, so return a REF error - $cellValue = Calculation\Functions::REF(); + $cellValue = Functions::REF(); } else { $cellRef = $matches[6] . $matches[7] . ':' . $matches[9] . $matches[10]; if ($matches[2] > '') { @@ -3643,7 +3639,7 @@ class Calculation } else { if ($pCell === null) { // We can't access the cell, so return a REF error - $cellValue = Calculation\Functions::REF(); + $cellValue = Functions::REF(); } else { $cellRef = $matches[6] . $matches[7]; if ($matches[2] > '') { @@ -3734,7 +3730,7 @@ class Calculation if ($functionName != 'MKMATRIX') { if ($this->debugLog->getWriteDebugLog()) { krsort($argArrayVals); - $this->debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Calculation\Functions::flattenArray($argArrayVals)), ' )'); + $this->debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Functions::flattenArray($argArrayVals)), ' )'); } } @@ -3745,7 +3741,7 @@ class Calculation if (!is_array($functionCall)) { foreach ($args as &$arg) { - $arg = Calculation\Functions::flattenSingleValue($arg); + $arg = Functions::flattenSingleValue($arg); } unset($arg); } @@ -3887,7 +3883,7 @@ class Calculation } // Use case insensitive comparaison if not OpenOffice mode - if (Calculation\Functions::getCompatibilityMode() != Calculation\Functions::COMPATIBILITY_OPENOFFICE) { + if (Functions::getCompatibilityMode() != Functions::COMPATIBILITY_OPENOFFICE) { if (is_string($operand1)) { $operand1 = strtoupper($operand1); } @@ -3896,7 +3892,7 @@ class Calculation } } - $useLowercaseFirstComparison = is_string($operand1) && is_string($operand2) && Calculation\Functions::getCompatibilityMode() == Calculation\Functions::COMPATIBILITY_OPENOFFICE; + $useLowercaseFirstComparison = is_string($operand1) && is_string($operand2) && Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE; // execute the necessary operation switch ($operation) { @@ -4016,15 +4012,15 @@ class Calculation // Perform the required operation against the operand 1 matrix, passing in operand 2 $matrixResult = $matrix->$matrixFunction($operand2); $result = $matrixResult->getArray(); - } catch (Exception $ex) { + } catch (\Exception $ex) { $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $result = '#VALUE!'; } } else { - if ((Calculation\Functions::getCompatibilityMode() != Calculation\Functions::COMPATIBILITY_OPENOFFICE) && + if ((Functions::getCompatibilityMode() != Functions::COMPATIBILITY_OPENOFFICE) && ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1) > 0) || (is_string($operand2) && !is_numeric($operand2) && strlen($operand2) > 0))) { - $result = Calculation\Functions::VALUE(); + $result = Functions::VALUE(); } else { // If we're dealing with non-matrix operations, execute the necessary operation switch ($operation) { @@ -4078,7 +4074,7 @@ class Calculation $this->formulaError = $errorMessage; $this->cyclicReferenceStack->clear(); if (!$this->suppressFormulaErrors) { - throw new Calculation\Exception($errorMessage); + throw new Exception($errorMessage); } trigger_error($errorMessage, E_USER_ERROR); } @@ -4090,7 +4086,7 @@ class Calculation * @param Worksheet $pSheet Worksheet * @param bool $resetLog Flag indicating whether calculation log should be reset or not * - * @throws Calculation\Exception + * @throws Exception * * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. */ @@ -4141,7 +4137,7 @@ class Calculation * @param Worksheet $pSheet Worksheet * @param bool $resetLog Flag indicating whether calculation log should be reset or not * - * @throws Calculation\Exception + * @throws Exception * * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. */ @@ -4170,7 +4166,7 @@ class Calculation $pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1]; } } else { - return Calculation\Functions::REF(); + return Functions::REF(); } // Extract range @@ -4218,7 +4214,7 @@ class Calculation /** * Get a list of all implemented functions as an array of function objects. * - * @return array of Calculation\Category + * @return array of Category */ public function getFunctions() { diff --git a/src/PhpSpreadsheet/Calculation/Database.php b/src/PhpSpreadsheet/Calculation/Database.php index a322d0f5..f6d9d8bb 100644 --- a/src/PhpSpreadsheet/Calculation/Database.php +++ b/src/PhpSpreadsheet/Calculation/Database.php @@ -2,8 +2,6 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation; - class Database { /** diff --git a/src/PhpSpreadsheet/CalcEngine/CyclicReferenceStack.php b/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php similarity index 95% rename from src/PhpSpreadsheet/CalcEngine/CyclicReferenceStack.php rename to src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php index 36fae9e5..3ef0c20e 100644 --- a/src/PhpSpreadsheet/CalcEngine/CyclicReferenceStack.php +++ b/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php @@ -1,6 +1,6 @@ dataType = $pDataType; } elseif (!self::getValueBinder()->bindValue($this, $pValue)) { @@ -193,7 +198,7 @@ class Cell * Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder). * * @param mixed $pValue Value - * @param string $pDataType Explicit data type, see Cell\DataType::TYPE_* + * @param string $pDataType Explicit data type, see DataType::TYPE_* * * @throws Exception * @@ -203,34 +208,34 @@ class Cell { // set the value according to data type switch ($pDataType) { - case Cell\DataType::TYPE_NULL: + case DataType::TYPE_NULL: $this->value = $pValue; break; - case Cell\DataType::TYPE_STRING2: - $pDataType = Cell\DataType::TYPE_STRING; + case DataType::TYPE_STRING2: + $pDataType = DataType::TYPE_STRING; // no break - case Cell\DataType::TYPE_STRING: + case DataType::TYPE_STRING: // Synonym for string - case Cell\DataType::TYPE_INLINE: + case DataType::TYPE_INLINE: // Rich text - $this->value = Cell\DataType::checkString($pValue); + $this->value = DataType::checkString($pValue); break; - case Cell\DataType::TYPE_NUMERIC: + case DataType::TYPE_NUMERIC: $this->value = (float) $pValue; break; - case Cell\DataType::TYPE_FORMULA: + case DataType::TYPE_FORMULA: $this->value = (string) $pValue; break; - case Cell\DataType::TYPE_BOOL: + case DataType::TYPE_BOOL: $this->value = (bool) $pValue; break; - case Cell\DataType::TYPE_ERROR: - $this->value = Cell\DataType::checkErrorCode($pValue); + case DataType::TYPE_ERROR: + $this->value = DataType::checkErrorCode($pValue); break; default: @@ -255,7 +260,7 @@ class Cell */ public function getCalculatedValue($resetLog = true) { - if ($this->dataType == Cell\DataType::TYPE_FORMULA) { + if ($this->dataType == DataType::TYPE_FORMULA) { try { $result = Calculation::getInstance( $this->getWorksheet()->getParent() @@ -271,7 +276,7 @@ class Cell return $this->calculatedValue; // Fallback for calculations referencing external files. } - throw new Calculation\Exception( + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception( $this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage() ); } @@ -332,14 +337,14 @@ class Cell /** * Set cell data type. * - * @param string $pDataType see Cell\DataType::TYPE_* + * @param string $pDataType see DataType::TYPE_* * * @return Cell */ public function setDataType($pDataType) { - if ($pDataType == Cell\DataType::TYPE_STRING2) { - $pDataType = Cell\DataType::TYPE_STRING; + if ($pDataType == DataType::TYPE_STRING2) { + $pDataType = DataType::TYPE_STRING; } $this->dataType = $pDataType; @@ -353,7 +358,7 @@ class Cell */ public function isFormula() { - return $this->dataType == Cell\DataType::TYPE_FORMULA; + return $this->dataType == DataType::TYPE_FORMULA; } /** @@ -377,7 +382,7 @@ class Cell * * @throws Exception * - * @return Cell\DataValidation + * @return DataValidation */ public function getDataValidation() { @@ -391,13 +396,13 @@ class Cell /** * Set Data validation rules. * - * @param Cell\DataValidation $pDataValidation + * @param DataValidation $pDataValidation * * @throws Exception * * @return Cell */ - public function setDataValidation(Cell\DataValidation $pDataValidation = null) + public function setDataValidation(DataValidation $pDataValidation = null) { if (!isset($this->parent)) { throw new Exception('Cannot set data validation for cell that is not bound to a worksheet'); @@ -429,7 +434,7 @@ class Cell * * @throws Exception * - * @return Cell\Hyperlink + * @return Hyperlink */ public function getHyperlink() { @@ -443,13 +448,13 @@ class Cell /** * Set Hyperlink. * - * @param Cell\Hyperlink $pHyperlink + * @param Hyperlink $pHyperlink * * @throws Exception * * @return Cell */ - public function setHyperlink(Cell\Hyperlink $pHyperlink = null) + public function setHyperlink(Hyperlink $pHyperlink = null) { if (!isset($this->parent)) { throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); @@ -1033,12 +1038,12 @@ class Cell /** * Get value binder to use. * - * @return Cell\IValueBinder + * @return IValueBinder */ public static function getValueBinder() { if (self::$valueBinder === null) { - self::$valueBinder = new Cell\DefaultValueBinder(); + self::$valueBinder = new DefaultValueBinder(); } return self::$valueBinder; @@ -1047,11 +1052,11 @@ class Cell /** * Set value binder to use. * - * @param Cell\IValueBinder $binder + * @param IValueBinder $binder * * @throws Exception */ - public static function setValueBinder(Cell\IValueBinder $binder) + public static function setValueBinder(IValueBinder $binder) { self::$valueBinder = $binder; } diff --git a/src/PhpSpreadsheet/Cell/DataType.php b/src/PhpSpreadsheet/Cell/DataType.php index f0374edb..2d8b45be 100644 --- a/src/PhpSpreadsheet/Cell/DataType.php +++ b/src/PhpSpreadsheet/Cell/DataType.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; class DataType diff --git a/src/PhpSpreadsheet/Cell/DefaultValueBinder.php b/src/PhpSpreadsheet/Cell/DefaultValueBinder.php index ae33c8f2..b394d8ab 100644 --- a/src/PhpSpreadsheet/Cell/DefaultValueBinder.php +++ b/src/PhpSpreadsheet/Cell/DefaultValueBinder.php @@ -3,8 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; use DateTime; -use PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; class DefaultValueBinder implements IValueBinder diff --git a/src/PhpSpreadsheet/Cell/IValueBinder.php b/src/PhpSpreadsheet/Cell/IValueBinder.php index e51b203c..5db3530e 100644 --- a/src/PhpSpreadsheet/Cell/IValueBinder.php +++ b/src/PhpSpreadsheet/Cell/IValueBinder.php @@ -2,8 +2,6 @@ namespace PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\Cell; - interface IValueBinder { /** diff --git a/src/PhpSpreadsheet/Chart.php b/src/PhpSpreadsheet/Chart/Chart.php similarity index 89% rename from src/PhpSpreadsheet/Chart.php rename to src/PhpSpreadsheet/Chart/Chart.php index 9ea037ee..d5f9a6b9 100644 --- a/src/PhpSpreadsheet/Chart.php +++ b/src/PhpSpreadsheet/Chart/Chart.php @@ -1,6 +1,9 @@ name = $name; $this->title = $title; @@ -185,7 +188,7 @@ class Chart * * @param Worksheet $pValue * - * @throws Chart\Exception + * @throws Exception * * @return Chart */ @@ -199,7 +202,7 @@ class Chart /** * Get Title. * - * @return Chart\Title + * @return Title */ public function getTitle() { @@ -209,11 +212,11 @@ class Chart /** * Set Title. * - * @param Chart\Title $title + * @param Title $title * * @return Chart */ - public function setTitle(Chart\Title $title) + public function setTitle(Title $title) { $this->title = $title; @@ -223,7 +226,7 @@ class Chart /** * Get Legend. * - * @return Chart\Legend + * @return Legend */ public function getLegend() { @@ -233,11 +236,11 @@ class Chart /** * Set Legend. * - * @param Chart\Legend $legend + * @param Legend $legend * * @return Chart */ - public function setLegend(Chart\Legend $legend) + public function setLegend(Legend $legend) { $this->legend = $legend; @@ -247,7 +250,7 @@ class Chart /** * Get X-Axis Label. * - * @return Chart\Title + * @return Title */ public function getXAxisLabel() { @@ -257,11 +260,11 @@ class Chart /** * Set X-Axis Label. * - * @param Chart\Title $label + * @param Title $label * * @return Chart */ - public function setXAxisLabel(Chart\Title $label) + public function setXAxisLabel(Title $label) { $this->xAxisLabel = $label; @@ -271,7 +274,7 @@ class Chart /** * Get Y-Axis Label. * - * @return Chart\Title + * @return Title */ public function getYAxisLabel() { @@ -281,11 +284,11 @@ class Chart /** * Set Y-Axis Label. * - * @param Chart\Title $label + * @param Title $label * * @return Chart */ - public function setYAxisLabel(Chart\Title $label) + public function setYAxisLabel(Title $label) { $this->yAxisLabel = $label; @@ -295,7 +298,7 @@ class Chart /** * Get Plot Area. * - * @return Chart\PlotArea + * @return PlotArea */ public function getPlotArea() { @@ -351,7 +354,7 @@ class Chart /** * Get yAxis. * - * @return Chart\Axis + * @return Axis */ public function getChartAxisY() { @@ -359,13 +362,13 @@ class Chart return $this->yAxis; } - return new Chart\Axis(); + return new Axis(); } /** * Get xAxis. * - * @return Chart\Axis + * @return Axis */ public function getChartAxisX() { @@ -373,13 +376,13 @@ class Chart return $this->xAxis; } - return new Chart\Axis(); + return new Axis(); } /** * Get Major Gridlines. * - * @return Chart\GridLines + * @return GridLines */ public function getMajorGridlines() { @@ -387,13 +390,13 @@ class Chart return $this->majorGridlines; } - return new Chart\GridLines(); + return new GridLines(); } /** * Get Minor Gridlines. * - * @return Chart\GridLines + * @return GridLines */ public function getMinorGridlines() { @@ -401,7 +404,7 @@ class Chart return $this->minorGridlines; } - return new Chart\GridLines(); + return new GridLines(); } /** diff --git a/src/PhpSpreadsheet/Chart/DataSeries.php b/src/PhpSpreadsheet/Chart/DataSeries.php index 11aaefcd..105f6505 100644 --- a/src/PhpSpreadsheet/Chart/DataSeries.php +++ b/src/PhpSpreadsheet/Chart/DataSeries.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class DataSeries { diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index 12c5acb6..20a60ee8 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -2,10 +2,10 @@ namespace PhpOffice\PhpSpreadsheet\Chart; -use PhpOffice\PhpSpreadsheet\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class DataSeriesValues { diff --git a/src/PhpSpreadsheet/Chart/PlotArea.php b/src/PhpSpreadsheet/Chart/PlotArea.php index 49adfcb2..5646671e 100644 --- a/src/PhpSpreadsheet/Chart/PlotArea.php +++ b/src/PhpSpreadsheet/Chart/PlotArea.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class PlotArea { diff --git a/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php b/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php index b1336fa5..c6fcfbfc 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php +++ b/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php @@ -2,14 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Chart\Renderer; -use PhpOffice\PhpSpreadsheet\Chart; +use PhpOffice\PhpSpreadsheet\Chart\Chart; interface IRenderer { /** * IRenderer constructor. * - * @param Chart $chart + * @param \PhpOffice\PhpSpreadsheet\Chart\Chart $chart */ public function __construct(Chart $chart); diff --git a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php index 2ddff99e..95308f1b 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php +++ b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart\Renderer; -use PhpOffice\PhpSpreadsheet\Chart; +use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; require_once __DIR__ . '/Polyfill.php'; diff --git a/src/PhpSpreadsheet/Collection/Cells.php b/src/PhpSpreadsheet/Collection/Cells.php index 583eaa8e..9c20e2c6 100644 --- a/src/PhpSpreadsheet/Collection/Cells.php +++ b/src/PhpSpreadsheet/Collection/Cells.php @@ -2,9 +2,9 @@ namespace PhpOffice\PhpSpreadsheet\Collection; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use Psr\SimpleCache\CacheInterface; class Cells @@ -390,7 +390,7 @@ class Cells * * @throws PhpSpreadsheetException * - * @return Cell + * @return \PhpOffice\PhpSpreadsheet\Cell\Cell */ public function add($pCoord, Cell $cell) { @@ -413,7 +413,7 @@ class Cells * * @throws PhpSpreadsheetException * - * @return Cell Cell that was found, or null if not found + * @return \PhpOffice\PhpSpreadsheet\Cell\Cell Cell that was found, or null if not found */ public function get($pCoord) { diff --git a/src/PhpSpreadsheet/Collection/CellsFactory.php b/src/PhpSpreadsheet/Collection/CellsFactory.php index 035acc2b..46d3cf7e 100644 --- a/src/PhpSpreadsheet/Collection/CellsFactory.php +++ b/src/PhpSpreadsheet/Collection/CellsFactory.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Collection; use PhpOffice\PhpSpreadsheet\Settings; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; abstract class CellsFactory { diff --git a/src/PhpSpreadsheet/Comment.php b/src/PhpSpreadsheet/Comment.php index 04f78fa8..772e9229 100644 --- a/src/PhpSpreadsheet/Comment.php +++ b/src/PhpSpreadsheet/Comment.php @@ -2,6 +2,8 @@ namespace PhpOffice\PhpSpreadsheet; +use PhpOffice\PhpSpreadsheet\RichText\RichText; + class Comment implements IComparable { /** diff --git a/src/PhpSpreadsheet/Helper/Html.php b/src/PhpSpreadsheet/Helper/Html.php index 284592c8..78b3a571 100644 --- a/src/PhpSpreadsheet/Helper/Html.php +++ b/src/PhpSpreadsheet/Helper/Html.php @@ -6,7 +6,7 @@ use DOMDocument; use DOMElement; use DOMNode; use DOMText; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Style\Font; diff --git a/src/PhpSpreadsheet/Helper/Migrator.php b/src/PhpSpreadsheet/Helper/Migrator.php index bdfcad13..6b2883a1 100644 --- a/src/PhpSpreadsheet/Helper/Migrator.php +++ b/src/PhpSpreadsheet/Helper/Migrator.php @@ -85,8 +85,8 @@ class Migrator 'PHPExcel_Writer_Excel2007_Worksheet' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet::class, 'PHPExcel_Writer_Excel2007_WriterPart' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart::class, 'PHPExcel_CachedObjectStorage_CacheBase' => \PhpOffice\PhpSpreadsheet\Collection\Cells::class, - 'PHPExcel_CalcEngine_CyclicReferenceStack' => \PhpOffice\PhpSpreadsheet\CalcEngine\CyclicReferenceStack::class, - 'PHPExcel_CalcEngine_Logger' => \PhpOffice\PhpSpreadsheet\CalcEngine\Logger::class, + 'PHPExcel_CalcEngine_CyclicReferenceStack' => \PhpOffice\PhpSpreadsheet\Calculation\Engine\CyclicReferenceStack::class, + 'PHPExcel_CalcEngine_Logger' => \PhpOffice\PhpSpreadsheet\Calculation\Engine\Logger::class, 'PHPExcel_Calculation_Functions' => \PhpOffice\PhpSpreadsheet\Calculation\Functions::class, 'PHPExcel_Calculation_Function' => \PhpOffice\PhpSpreadsheet\Calculation\Category::class, 'PHPExcel_Calculation_Database' => \PhpOffice\PhpSpreadsheet\Calculation\Database::class, @@ -190,9 +190,9 @@ class Migrator 'PHPExcel_Writer_Excel5' => \PhpOffice\PhpSpreadsheet\Writer\Xls::class, 'PHPExcel_Writer_Excel2007' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx::class, 'PHPExcel_CachedObjectStorageFactory' => \PhpOffice\PhpSpreadsheet\Collection\CellsFactory::class, - 'PHPExcel_Calculation' => \PhpOffice\PhpSpreadsheet\Calculation::class, - 'PHPExcel_Cell' => \PhpOffice\PhpSpreadsheet\Cell::class, - 'PHPExcel_Chart' => \PhpOffice\PhpSpreadsheet\Chart::class, + 'PHPExcel_Calculation' => \PhpOffice\PhpSpreadsheet\Calculation\Calculation::class, + 'PHPExcel_Cell' => \PhpOffice\PhpSpreadsheet\Cell\Cell::class, + 'PHPExcel_Chart' => \PhpOffice\PhpSpreadsheet\Chart\Chart::class, 'PHPExcel_Comment' => \PhpOffice\PhpSpreadsheet\Comment::class, 'PHPExcel_Exception' => \PhpOffice\PhpSpreadsheet\Exception::class, 'PHPExcel_HashTable' => \PhpOffice\PhpSpreadsheet\HashTable::class, @@ -200,10 +200,10 @@ class Migrator 'PHPExcel_IOFactory' => \PhpOffice\PhpSpreadsheet\IOFactory::class, 'PHPExcel_NamedRange' => \PhpOffice\PhpSpreadsheet\NamedRange::class, 'PHPExcel_ReferenceHelper' => \PhpOffice\PhpSpreadsheet\ReferenceHelper::class, - 'PHPExcel_RichText' => \PhpOffice\PhpSpreadsheet\RichText::class, + 'PHPExcel_RichText' => \PhpOffice\PhpSpreadsheet\RichText\RichText::class, 'PHPExcel_Settings' => \PhpOffice\PhpSpreadsheet\Settings::class, - 'PHPExcel_Style' => \PhpOffice\PhpSpreadsheet\Style::class, - 'PHPExcel_Worksheet' => \PhpOffice\PhpSpreadsheet\Worksheet::class, + 'PHPExcel_Style' => \PhpOffice\PhpSpreadsheet\Style\Style::class, + 'PHPExcel_Worksheet' => \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::class, 'PHPExcel' => \PhpOffice\PhpSpreadsheet\Spreadsheet::class, // methods 'MINUTEOFHOUR' => 'MINUTE', diff --git a/src/PhpSpreadsheet/NamedRange.php b/src/PhpSpreadsheet/NamedRange.php index 4443e8cf..764884a0 100644 --- a/src/PhpSpreadsheet/NamedRange.php +++ b/src/PhpSpreadsheet/NamedRange.php @@ -2,6 +2,8 @@ namespace PhpOffice\PhpSpreadsheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; + class NamedRange { /** diff --git a/src/PhpSpreadsheet/Reader/Csv.php b/src/PhpSpreadsheet/Reader/Csv.php index 405c1c82..09a6b6f7 100644 --- a/src/PhpSpreadsheet/Reader/Csv.php +++ b/src/PhpSpreadsheet/Reader/Csv.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; diff --git a/src/PhpSpreadsheet/Reader/Gnumeric.php b/src/PhpSpreadsheet/Reader/Gnumeric.php index b688973f..5eb7f498 100644 --- a/src/PhpSpreadsheet/Reader/Gnumeric.php +++ b/src/PhpSpreadsheet/Reader/Gnumeric.php @@ -2,10 +2,11 @@ namespace PhpOffice\PhpSpreadsheet\Reader; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\NamedRange; use PhpOffice\PhpSpreadsheet\ReferenceHelper; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\File; @@ -404,7 +405,7 @@ class Gnumeric extends BaseReader implements IReader $ValueType = $cellAttributes->ValueType; $ExprID = (string) $cellAttributes->ExprID; - $type = Cell\DataType::TYPE_FORMULA; + $type = DataType::TYPE_FORMULA; if ($ExprID > '') { if (((string) $cell) > '') { $this->expressions[$ExprID] = [ @@ -423,15 +424,15 @@ class Gnumeric extends BaseReader implements IReader $worksheetName ); } - $type = Cell\DataType::TYPE_FORMULA; + $type = DataType::TYPE_FORMULA; } else { switch ($ValueType) { case '10': // NULL - $type = Cell\DataType::TYPE_NULL; + $type = DataType::TYPE_NULL; break; case '20': // Boolean - $type = Cell\DataType::TYPE_BOOL; + $type = DataType::TYPE_BOOL; $cell = ($cell == 'TRUE') ? true : false; break; @@ -440,15 +441,15 @@ class Gnumeric extends BaseReader implements IReader // Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case // no break case '40': // Float - $type = Cell\DataType::TYPE_NUMERIC; + $type = DataType::TYPE_NUMERIC; break; case '50': // Error - $type = Cell\DataType::TYPE_ERROR; + $type = DataType::TYPE_ERROR; break; case '60': // String - $type = Cell\DataType::TYPE_STRING; + $type = DataType::TYPE_STRING; break; case '70': // Cell Range diff --git a/src/PhpSpreadsheet/Reader/Html.php b/src/PhpSpreadsheet/Reader/Html.php index c9153bed..78850de5 100644 --- a/src/PhpSpreadsheet/Reader/Html.php +++ b/src/PhpSpreadsheet/Reader/Html.php @@ -6,12 +6,12 @@ use DOMDocument; use DOMElement; use DOMNode; use DOMText; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Style\Border; use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Style\Fill; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; /** PhpSpreadsheet root directory */ class Html extends BaseReader implements IReader diff --git a/src/PhpSpreadsheet/Reader/Ods.php b/src/PhpSpreadsheet/Reader/Ods.php index 45f4f030..e0437bc3 100644 --- a/src/PhpSpreadsheet/Reader/Ods.php +++ b/src/PhpSpreadsheet/Reader/Ods.php @@ -4,11 +4,11 @@ namespace PhpOffice\PhpSpreadsheet\Reader; use DateTime; use DateTimeZone; -use PhpOffice\PhpSpreadsheet\Calculation; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Document\Properties; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\File; diff --git a/src/PhpSpreadsheet/Reader/Slk.php b/src/PhpSpreadsheet/Reader/Slk.php index f316e1a0..362e437e 100644 --- a/src/PhpSpreadsheet/Reader/Slk.php +++ b/src/PhpSpreadsheet/Reader/Slk.php @@ -2,8 +2,8 @@ namespace PhpOffice\PhpSpreadsheet\Reader; -use PhpOffice\PhpSpreadsheet\Calculation; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Style\Border; diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index 0ab49287..8509dc05 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -2,11 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Reader; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Cell\DataValidation; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\NamedRange; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Shared\CodePage; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Escher; @@ -16,16 +17,16 @@ use PhpOffice\PhpSpreadsheet\Shared\OLE; use PhpOffice\PhpSpreadsheet\Shared\OLERead; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; -use PhpOffice\PhpSpreadsheet\Style; use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Borders; use PhpOffice\PhpSpreadsheet\Style\Font; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\Protection; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Style\Style; use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing; use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup; use PhpOffice\PhpSpreadsheet\Worksheet\SheetView; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; // Original file header of ParseXL (used as the base for this class): // -------------------------------------------------------------------------------- @@ -1175,7 +1176,7 @@ class Xls extends BaseReader implements IReader list($column, $row) = Cell::coordinateFromString($cell); if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) { $formula = $this->getFormulaFromStructure($this->sharedFormulas[$baseCell], $cell); - $this->phpSheet->getCell($cell)->setValueExplicit('=' . $formula, Cell\DataType::TYPE_FORMULA); + $this->phpSheet->getCell($cell)->setValueExplicit('=' . $formula, DataType::TYPE_FORMULA); } } } @@ -3740,7 +3741,7 @@ class Xls extends BaseReader implements IReader } // add cell - $cell->setValueExplicit($numValue, Cell\DataType::TYPE_NUMERIC); + $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC); } } @@ -3811,13 +3812,13 @@ class Xls extends BaseReader implements IReader } if ($this->readEmptyCells || trim($richText->getPlainText()) !== '') { $cell = $this->phpSheet->getCell($columnString . ($row + 1)); - $cell->setValueExplicit($richText, Cell\DataType::TYPE_STRING); + $cell->setValueExplicit($richText, DataType::TYPE_STRING); $emptyCell = false; } } else { if ($this->readEmptyCells || trim($this->sst[$index]['value']) !== '') { $cell = $this->phpSheet->getCell($columnString . ($row + 1)); - $cell->setValueExplicit($this->sst[$index]['value'], Cell\DataType::TYPE_STRING); + $cell->setValueExplicit($this->sst[$index]['value'], DataType::TYPE_STRING); $emptyCell = false; } } @@ -3875,7 +3876,7 @@ class Xls extends BaseReader implements IReader } // add cell value - $cell->setValueExplicit($numValue, Cell\DataType::TYPE_NUMERIC); + $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC); } $offset += 6; @@ -3919,7 +3920,7 @@ class Xls extends BaseReader implements IReader } // add cell value - $cell->setValueExplicit($numValue, Cell\DataType::TYPE_NUMERIC); + $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC); } } @@ -3986,7 +3987,7 @@ class Xls extends BaseReader implements IReader // offset: 6; size: 8; result of the formula if ((ord($recordData[6]) == 0) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) { // String formula. Result follows in appended STRING record - $dataType = Cell\DataType::TYPE_STRING; + $dataType = DataType::TYPE_STRING; // read possible SHAREDFMLA record $code = self::getUInt2d($this->data, $this->pos); @@ -4000,23 +4001,23 @@ class Xls extends BaseReader implements IReader && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) { // Boolean formula. Result is in +2; 0=false, 1=true - $dataType = Cell\DataType::TYPE_BOOL; + $dataType = DataType::TYPE_BOOL; $value = (bool) ord($recordData[8]); } elseif ((ord($recordData[6]) == 2) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) { // Error formula. Error code is in +2 - $dataType = Cell\DataType::TYPE_ERROR; + $dataType = DataType::TYPE_ERROR; $value = Xls\ErrorCode::lookup(ord($recordData[8])); } elseif ((ord($recordData[6]) == 3) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) { // Formula result is a null string - $dataType = Cell\DataType::TYPE_NULL; + $dataType = DataType::TYPE_NULL; $value = ''; } else { // forumla result is a number, first 14 bytes like _NUMBER record - $dataType = Cell\DataType::TYPE_NUMERIC; + $dataType = DataType::TYPE_NUMERIC; $value = self::extractNumber(substr($recordData, 6, 8)); } @@ -4035,7 +4036,7 @@ class Xls extends BaseReader implements IReader throw new Exception('Not BIFF8. Can only read BIFF8 formulas'); } $formula = $this->getFormulaFromStructure($formulaStructure); // get formula in human language - $cell->setValueExplicit('=' . $formula, Cell\DataType::TYPE_FORMULA); + $cell->setValueExplicit('=' . $formula, DataType::TYPE_FORMULA); } catch (PhpSpreadsheetException $e) { $cell->setValueExplicit($value, $dataType); } @@ -4147,14 +4148,14 @@ class Xls extends BaseReader implements IReader $value = (bool) $boolErr; // add cell value - $cell->setValueExplicit($value, Cell\DataType::TYPE_BOOL); + $cell->setValueExplicit($value, DataType::TYPE_BOOL); break; case 1: // error type $value = Xls\ErrorCode::lookup($boolErr); // add cell value - $cell->setValueExplicit($value, Cell\DataType::TYPE_ERROR); + $cell->setValueExplicit($value, DataType::TYPE_ERROR); break; } @@ -4246,7 +4247,7 @@ class Xls extends BaseReader implements IReader } if ($this->readEmptyCells || trim($value) !== '') { $cell = $this->phpSheet->getCell($columnString . ($row + 1)); - $cell->setValueExplicit($value, Cell\DataType::TYPE_STRING); + $cell->setValueExplicit($value, DataType::TYPE_STRING); if (!$this->readDataOnly) { // add cell style diff --git a/src/PhpSpreadsheet/Reader/Xls/Escher.php b/src/PhpSpreadsheet/Reader/Xls/Escher.php index 81254eb7..843f8fb4 100644 --- a/src/PhpSpreadsheet/Reader/Xls/Escher.php +++ b/src/PhpSpreadsheet/Reader/Xls/Escher.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Reader\Xls; use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer; use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer; diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 4365d4db..e2e7b052 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -2,12 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Reader; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Document\Properties; use PhpOffice\PhpSpreadsheet\NamedRange; use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Chart; use PhpOffice\PhpSpreadsheet\ReferenceHelper; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Drawing; @@ -15,10 +15,16 @@ use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Shared\Font; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; -use PhpOffice\PhpSpreadsheet\Style; +use PhpOffice\PhpSpreadsheet\Style\Border; +use PhpOffice\PhpSpreadsheet\Style\Borders; +use PhpOffice\PhpSpreadsheet\Style\Color; +use PhpOffice\PhpSpreadsheet\Style\Conditional; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Style\Protection; +use PhpOffice\PhpSpreadsheet\Style\Style; use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column; +use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use XMLReader; use ZipArchive; @@ -969,7 +975,7 @@ class Xlsx extends BaseReader implements IReader if (!$this->readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { foreach ($xmlSheet->conditionalFormatting as $conditional) { foreach ($conditional->cfRule as $cfRule) { - if (((string) $cfRule['type'] == Style\Conditional::CONDITION_NONE || (string) $cfRule['type'] == Style\Conditional::CONDITION_CELLIS || (string) $cfRule['type'] == Style\Conditional::CONDITION_CONTAINSTEXT || (string) $cfRule['type'] == Style\Conditional::CONDITION_EXPRESSION) && isset($dxfs[(int) ($cfRule['dxfId'])])) { + if (((string) $cfRule['type'] == Conditional::CONDITION_NONE || (string) $cfRule['type'] == Conditional::CONDITION_CELLIS || (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSTEXT || (string) $cfRule['type'] == Conditional::CONDITION_EXPRESSION) && isset($dxfs[(int) ($cfRule['dxfId'])])) { $conditionals[(string) $conditional['sqref']][(int) ($cfRule['priority'])] = $cfRule; } } @@ -979,7 +985,7 @@ class Xlsx extends BaseReader implements IReader ksort($cfRules); $conditionalStyles = []; foreach ($cfRules as $cfRule) { - $objConditional = new Style\Conditional(); + $objConditional = new Conditional(); $objConditional->setConditionType((string) $cfRule['type']); $objConditional->setOperatorType((string) $cfRule['operator']); @@ -1475,7 +1481,7 @@ class Xlsx extends BaseReader implements IReader $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office'); $style = self::toCSSArray((string) $shape['style']); - $hfImages[(string) $shape['id']] = new Worksheet\HeaderFooterDrawing(); + $hfImages[(string) $shape['id']] = new HeaderFooterDrawing(); if (isset($imageData['title'])) { $hfImages[(string) $shape['id']]->setName((string) $imageData['title']); } @@ -1555,7 +1561,7 @@ class Xlsx extends BaseReader implements IReader $xfrm = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm; /** @var \SimpleXMLElement $outerShdw */ $outerShdw = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw; - $objDrawing = new Worksheet\Drawing(); + $objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); $objDrawing->setName((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'name')); $objDrawing->setDescription((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'descr')); $objDrawing->setPath( @@ -1602,7 +1608,7 @@ class Xlsx extends BaseReader implements IReader $blip = $twoCellAnchor->pic->blipFill->children('http://schemas.openxmlformats.org/drawingml/2006/main')->blip; $xfrm = $twoCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm; $outerShdw = $twoCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw; - $objDrawing = new Worksheet\Drawing(); + $objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); $objDrawing->setName((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'name')); $objDrawing->setDescription((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'descr')); $objDrawing->setPath( @@ -1869,13 +1875,13 @@ class Xlsx extends BaseReader implements IReader if (isset($color['rgb'])) { return (string) $color['rgb']; } elseif (isset($color['indexed'])) { - return Style\Color::indexedColor($color['indexed'] - 7, $background)->getARGB(); + return Color::indexedColor($color['indexed'] - 7, $background)->getARGB(); } elseif (isset($color['theme'])) { if (self::$theme !== null) { $returnColour = self::$theme->getColourByIndex((int) $color['theme']); if (isset($color['tint'])) { $tintAdjust = (float) $color['tint']; - $returnColour = Style\Color::changeBrightness($returnColour, $tintAdjust); + $returnColour = Color::changeBrightness($returnColour, $tintAdjust); } return 'FF' . $returnColour; @@ -1913,7 +1919,7 @@ class Xlsx extends BaseReader implements IReader $docStyle->getFont()->getColor()->setARGB(self::readColor($style->font->color)); if (isset($style->font->u) && !isset($style->font->u['val'])) { - $docStyle->getFont()->setUnderline(Style\Font::UNDERLINE_SINGLE); + $docStyle->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE); } elseif (isset($style->font->u, $style->font->u['val'])) { $docStyle->getFont()->setUnderline((string) $style->font->u['val']); } @@ -1960,13 +1966,13 @@ class Xlsx extends BaseReader implements IReader $diagonalUp = self::boolean((string) $style->border['diagonalUp']); $diagonalDown = self::boolean((string) $style->border['diagonalDown']); if (!$diagonalUp && !$diagonalDown) { - $docStyle->getBorders()->setDiagonalDirection(Style\Borders::DIAGONAL_NONE); + $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_NONE); } elseif ($diagonalUp && !$diagonalDown) { - $docStyle->getBorders()->setDiagonalDirection(Style\Borders::DIAGONAL_UP); + $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_UP); } elseif (!$diagonalUp && $diagonalDown) { - $docStyle->getBorders()->setDiagonalDirection(Style\Borders::DIAGONAL_DOWN); + $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_DOWN); } else { - $docStyle->getBorders()->setDiagonalDirection(Style\Borders::DIAGONAL_BOTH); + $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_BOTH); } self::readBorder($docStyle->getBorders()->getLeft(), $style->border->left); self::readBorder($docStyle->getBorders()->getRight(), $style->border->right); @@ -1998,17 +2004,17 @@ class Xlsx extends BaseReader implements IReader if (isset($style->protection)) { if (isset($style->protection['locked'])) { if (self::boolean((string) $style->protection['locked'])) { - $docStyle->getProtection()->setLocked(Style\Protection::PROTECTION_PROTECTED); + $docStyle->getProtection()->setLocked(Protection::PROTECTION_PROTECTED); } else { - $docStyle->getProtection()->setLocked(Style\Protection::PROTECTION_UNPROTECTED); + $docStyle->getProtection()->setLocked(Protection::PROTECTION_UNPROTECTED); } } if (isset($style->protection['hidden'])) { if (self::boolean((string) $style->protection['hidden'])) { - $docStyle->getProtection()->setHidden(Style\Protection::PROTECTION_PROTECTED); + $docStyle->getProtection()->setHidden(Protection::PROTECTION_PROTECTED); } else { - $docStyle->getProtection()->setHidden(Style\Protection::PROTECTION_UNPROTECTED); + $docStyle->getProtection()->setHidden(Protection::PROTECTION_UNPROTECTED); } } } @@ -2020,10 +2026,10 @@ class Xlsx extends BaseReader implements IReader } /** - * @param Style\Border $docBorder + * @param Border $docBorder * @param \SimpleXMLElement $eleBorder */ - private static function readBorder($docBorder, $eleBorder) + private static function readBorder(Border $docBorder, $eleBorder) { if (isset($eleBorder['style'])) { $docBorder->setBorderStyle((string) $eleBorder['style']); @@ -2059,7 +2065,7 @@ class Xlsx extends BaseReader implements IReader $objText->getFont()->setSize((string) $run->rPr->sz['val']); } if (isset($run->rPr->color)) { - $objText->getFont()->setColor(new Style\Color(self::readColor($run->rPr->color))); + $objText->getFont()->setColor(new Color(self::readColor($run->rPr->color))); } if ((isset($run->rPr->b['val']) && self::boolean((string) $run->rPr->b['val'])) || (isset($run->rPr->b) && !isset($run->rPr->b['val']))) { @@ -2079,7 +2085,7 @@ class Xlsx extends BaseReader implements IReader } } if (isset($run->rPr->u) && !isset($run->rPr->u['val'])) { - $objText->getFont()->setUnderline(Style\Font::UNDERLINE_SINGLE); + $objText->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE); } elseif (isset($run->rPr->u, $run->rPr->u['val'])) { $objText->getFont()->setUnderline((string) $run->rPr->u['val']); } diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Chart.php b/src/PhpSpreadsheet/Reader/Xlsx/Chart.php index fd6f2cc3..a4f40460 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Chart.php @@ -9,7 +9,7 @@ use PhpOffice\PhpSpreadsheet\Chart\Layout; use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\Title; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Style\Font; use SimpleXMLElement; @@ -210,7 +210,7 @@ class Chart } } } - $chart = new \PhpOffice\PhpSpreadsheet\Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); + $chart = new \PhpOffice\PhpSpreadsheet\Chart\Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); return $chart; } diff --git a/src/PhpSpreadsheet/Reader/Xml.php b/src/PhpSpreadsheet/Reader/Xml.php index 6124761b..18f90728 100644 --- a/src/PhpSpreadsheet/Reader/Xml.php +++ b/src/PhpSpreadsheet/Reader/Xml.php @@ -2,9 +2,10 @@ namespace PhpOffice\PhpSpreadsheet\Reader; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Document\Properties; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\File; @@ -648,7 +649,7 @@ class Xml extends BaseReader implements IReader } if (isset($cell->Data)) { $cellValue = $cellData = $cell->Data; - $type = Cell\DataType::TYPE_NULL; + $type = DataType::TYPE_NULL; $cellData_ss = $cellData->attributes($namespaces['ss']); if (isset($cellData_ss['Type'])) { $cellDataType = $cellData_ss['Type']; @@ -664,11 +665,11 @@ class Xml extends BaseReader implements IReader */ case 'String': $cellValue = self::convertStringEncoding($cellValue, $this->charSet); - $type = Cell\DataType::TYPE_STRING; + $type = DataType::TYPE_STRING; break; case 'Number': - $type = Cell\DataType::TYPE_NUMERIC; + $type = DataType::TYPE_NUMERIC; $cellValue = (float) $cellValue; if (floor($cellValue) == $cellValue) { $cellValue = (int) $cellValue; @@ -676,24 +677,24 @@ class Xml extends BaseReader implements IReader break; case 'Boolean': - $type = Cell\DataType::TYPE_BOOL; + $type = DataType::TYPE_BOOL; $cellValue = ($cellValue != 0); break; case 'DateTime': - $type = Cell\DataType::TYPE_NUMERIC; + $type = DataType::TYPE_NUMERIC; $cellValue = Date::PHPToExcel(strtotime($cellValue)); break; case 'Error': - $type = Cell\DataType::TYPE_ERROR; + $type = DataType::TYPE_ERROR; break; } } if ($hasCalculatedValue) { - $type = Cell\DataType::TYPE_FORMULA; + $type = DataType::TYPE_FORMULA; $columnNumber = Cell::columnIndexFromString($columnID); if (substr($cellDataFormula, 0, 3) == 'of:') { $cellDataFormula = substr($cellDataFormula, 3); diff --git a/src/PhpSpreadsheet/ReferenceHelper.php b/src/PhpSpreadsheet/ReferenceHelper.php index 9e6e7b2b..a7944727 100644 --- a/src/PhpSpreadsheet/ReferenceHelper.php +++ b/src/PhpSpreadsheet/ReferenceHelper.php @@ -2,6 +2,10 @@ namespace PhpOffice\PhpSpreadsheet; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Cell\DataType; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; + class ReferenceHelper { /** Constants */ @@ -384,7 +388,7 @@ class ReferenceHelper $coordinate = Cell::stringFromColumnIndex($j) . $i; $pSheet->removeConditionalStyles($coordinate); if ($pSheet->cellExists($coordinate)) { - $pSheet->getCell($coordinate)->setValueExplicit('', Cell\DataType::TYPE_NULL); + $pSheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); $pSheet->getCell($coordinate)->setXfIndex(0); } } @@ -398,7 +402,7 @@ class ReferenceHelper $coordinate = Cell::stringFromColumnIndex($i) . $j; $pSheet->removeConditionalStyles($coordinate); if ($pSheet->cellExists($coordinate)) { - $pSheet->getCell($coordinate)->setValueExplicit('', Cell\DataType::TYPE_NULL); + $pSheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); $pSheet->getCell($coordinate)->setXfIndex(0); } } @@ -427,7 +431,7 @@ class ReferenceHelper $pSheet->getCell($newCoordinate)->setXfIndex($cell->getXfIndex()); // Insert this cell at its new location - if ($cell->getDataType() == Cell\DataType::TYPE_FORMULA) { + if ($cell->getDataType() == DataType::TYPE_FORMULA) { // Formula should be adjusted $pSheet->getCell($newCoordinate) ->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle())); @@ -441,7 +445,7 @@ class ReferenceHelper } else { /* We don't need to update styles for rows/columns before our insertion position, but we do still need to adjust any formulae in those cells */ - if ($cell->getDataType() == Cell\DataType::TYPE_FORMULA) { + if ($cell->getDataType() == DataType::TYPE_FORMULA) { // Formula should be adjusted $cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle())); } @@ -798,12 +802,12 @@ class ReferenceHelper foreach ($spreadsheet->getWorksheetIterator() as $sheet) { foreach ($sheet->getCoordinates(false) as $coordinate) { $cell = $sheet->getCell($coordinate); - if (($cell !== null) && ($cell->getDataType() == Cell\DataType::TYPE_FORMULA)) { + if (($cell !== null) && ($cell->getDataType() == DataType::TYPE_FORMULA)) { $formula = $cell->getValue(); if (strpos($formula, $oldName) !== false) { $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula); $formula = str_replace($oldName . '!', $newName . '!', $formula); - $cell->setValueExplicit($formula, Cell\DataType::TYPE_FORMULA); + $cell->setValueExplicit($formula, DataType::TYPE_FORMULA); } } } diff --git a/src/PhpSpreadsheet/RichText.php b/src/PhpSpreadsheet/RichText/RichText.php similarity index 80% rename from src/PhpSpreadsheet/RichText.php rename to src/PhpSpreadsheet/RichText/RichText.php index 84617df9..29e194e6 100644 --- a/src/PhpSpreadsheet/RichText.php +++ b/src/PhpSpreadsheet/RichText/RichText.php @@ -1,13 +1,18 @@ getValue() != '') { - $objRun = new RichText\Run($pCell->getValue()); + $objRun = new Run($pCell->getValue()); $objRun->setFont(clone $pCell->getWorksheet()->getStyle($pCell->getCoordinate())->getFont()); $this->addText($objRun); } // Set parent value - $pCell->setValueExplicit($this, Cell\DataType::TYPE_STRING); + $pCell->setValueExplicit($this, DataType::TYPE_STRING); } } /** * Add text. * - * @param RichText\ITextElement $pText Rich text element + * @param ITextElement $pText Rich text element * * @throws Exception * * @return RichText */ - public function addText(RichText\ITextElement $pText) + public function addText(ITextElement $pText) { $this->richTextElements[] = $pText; @@ -60,11 +65,11 @@ class RichText implements IComparable * * @throws Exception * - * @return RichText\TextElement + * @return TextElement */ public function createText($pText) { - $objText = new RichText\TextElement($pText); + $objText = new TextElement($pText); $this->addText($objText); return $objText; @@ -77,11 +82,11 @@ class RichText implements IComparable * * @throws Exception * - * @return RichText\Run + * @return Run */ public function createTextRun($pText) { - $objText = new RichText\Run($pText); + $objText = new Run($pText); $this->addText($objText); return $objText; @@ -97,7 +102,7 @@ class RichText implements IComparable // Return value $returnValue = ''; - // Loop through all RichText\ITextElements + // Loop through all ITextElements foreach ($this->richTextElements as $text) { $returnValue .= $text->getText(); } @@ -118,7 +123,7 @@ class RichText implements IComparable /** * Get Rich Text elements. * - * @return RichText\ITextElement[] + * @return ITextElement[] */ public function getRichTextElements() { @@ -128,7 +133,7 @@ class RichText implements IComparable /** * Set Rich Text elements. * - * @param RichText\ITextElement[] $textElements Array of elements + * @param ITextElement[] $textElements Array of elements * * @throws Exception * diff --git a/src/PhpSpreadsheet/Settings.php b/src/PhpSpreadsheet/Settings.php index faea0501..22196b7e 100644 --- a/src/PhpSpreadsheet/Settings.php +++ b/src/PhpSpreadsheet/Settings.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheet; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Chart\Renderer\IRenderer; use PhpOffice\PhpSpreadsheet\Collection\Memory; use Psr\SimpleCache\CacheInterface; diff --git a/src/PhpSpreadsheet/Shared/Date.php b/src/PhpSpreadsheet/Shared/Date.php index b9f8426f..da7b86e9 100644 --- a/src/PhpSpreadsheet/Shared/Date.php +++ b/src/PhpSpreadsheet/Shared/Date.php @@ -6,7 +6,7 @@ use DateTimeInterface; use DateTimeZone; use PhpOffice\PhpSpreadsheet\Calculation\DateTime; use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; class Date diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index f9bb4c70..2ed5f0ef 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; class Font { diff --git a/src/PhpSpreadsheet/Shared/StringHelper.php b/src/PhpSpreadsheet/Shared/StringHelper.php index 068ce99b..9fa05385 100644 --- a/src/PhpSpreadsheet/Shared/StringHelper.php +++ b/src/PhpSpreadsheet/Shared/StringHelper.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; -use PhpOffice\PhpSpreadsheet\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; class StringHelper { diff --git a/src/PhpSpreadsheet/Shared/Xls.php b/src/PhpSpreadsheet/Shared/Xls.php index 6b3740c7..be1f7494 100644 --- a/src/PhpSpreadsheet/Shared/Xls.php +++ b/src/PhpSpreadsheet/Shared/Xls.php @@ -2,8 +2,8 @@ namespace PhpOffice\PhpSpreadsheet\Shared; -use PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class Xls { diff --git a/src/PhpSpreadsheet/Spreadsheet.php b/src/PhpSpreadsheet/Spreadsheet.php index d0c8a965..62987a4f 100644 --- a/src/PhpSpreadsheet/Spreadsheet.php +++ b/src/PhpSpreadsheet/Spreadsheet.php @@ -2,6 +2,11 @@ namespace PhpOffice\PhpSpreadsheet; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; +use PhpOffice\PhpSpreadsheet\Style\Style; +use PhpOffice\PhpSpreadsheet\Worksheet\Iterator; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; + class Spreadsheet { /** @@ -858,11 +863,11 @@ class Spreadsheet /** * Get worksheet iterator. * - * @return Worksheet\Iterator + * @return Iterator */ public function getWorksheetIterator() { - return new Worksheet\Iterator($this); + return new Iterator($this); } /** diff --git a/src/PhpSpreadsheet/Style/Conditional.php b/src/PhpSpreadsheet/Style/Conditional.php index 42cedf91..20333a2e 100644 --- a/src/PhpSpreadsheet/Style/Conditional.php +++ b/src/PhpSpreadsheet/Style/Conditional.php @@ -4,7 +4,6 @@ namespace PhpOffice\PhpSpreadsheet\Style; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\IComparable; -use PhpOffice\PhpSpreadsheet\Style; class Conditional implements IComparable { @@ -60,7 +59,7 @@ class Conditional implements IComparable /** * Style. * - * @var \PhpOffice\PhpSpreadsheet\Style + * @var Style */ private $style; @@ -193,7 +192,7 @@ class Conditional implements IComparable /** * Get Style. * - * @return \PhpOffice\PhpSpreadsheet\Style + * @return Style */ public function getStyle() { diff --git a/src/PhpSpreadsheet/Style.php b/src/PhpSpreadsheet/Style/Style.php similarity index 94% rename from src/PhpSpreadsheet/Style.php rename to src/PhpSpreadsheet/Style/Style.php index 40bf40d6..11707fbb 100644 --- a/src/PhpSpreadsheet/Style.php +++ b/src/PhpSpreadsheet/Style/Style.php @@ -1,55 +1,59 @@ conditionalStyles = []; - $this->font = new Style\Font($isSupervisor, $isConditional); - $this->fill = new Style\Fill($isSupervisor, $isConditional); - $this->borders = new Style\Borders($isSupervisor, $isConditional); - $this->alignment = new Style\Alignment($isSupervisor, $isConditional); - $this->numberFormat = new Style\NumberFormat($isSupervisor, $isConditional); - $this->protection = new Style\Protection($isSupervisor, $isConditional); + $this->font = new Font($isSupervisor, $isConditional); + $this->fill = new Fill($isSupervisor, $isConditional); + $this->borders = new Borders($isSupervisor, $isConditional); + $this->alignment = new Alignment($isSupervisor, $isConditional); + $this->numberFormat = new NumberFormat($isSupervisor, $isConditional); + $this->protection = new Protection($isSupervisor, $isConditional); // bind parent if we are a supervisor if ($isSupervisor) { @@ -154,7 +158,7 @@ class Style extends Style\Supervisor implements IComparable * 'name' => 'Arial', * 'bold' => true, * 'italic' => false, - * 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE, + * 'underline' => Font::UNDERLINE_DOUBLE, * 'strikethrough' => false, * 'color' => array( * 'rgb' => '808080' @@ -455,7 +459,7 @@ class Style extends Style\Supervisor implements IComparable /** * Get Fill. * - * @return Style\Fill + * @return Fill */ public function getFill() { @@ -465,7 +469,7 @@ class Style extends Style\Supervisor implements IComparable /** * Get Font. * - * @return Style\Font + * @return Font */ public function getFont() { @@ -475,11 +479,11 @@ class Style extends Style\Supervisor implements IComparable /** * Set font. * - * @param Style\Font $font + * @param Font $font * * @return Style */ - public function setFont(Style\Font $font) + public function setFont(Font $font) { $this->font = $font; @@ -489,7 +493,7 @@ class Style extends Style\Supervisor implements IComparable /** * Get Borders. * - * @return Style\Borders + * @return Borders */ public function getBorders() { @@ -499,7 +503,7 @@ class Style extends Style\Supervisor implements IComparable /** * Get Alignment. * - * @return Style\Alignment + * @return Alignment */ public function getAlignment() { @@ -509,7 +513,7 @@ class Style extends Style\Supervisor implements IComparable /** * Get Number Format. * - * @return Style\NumberFormat + * @return NumberFormat */ public function getNumberFormat() { @@ -519,7 +523,7 @@ class Style extends Style\Supervisor implements IComparable /** * Get Conditional Styles. Only used on supervisor. * - * @return Style\Conditional[] + * @return Conditional[] */ public function getConditionalStyles() { @@ -529,7 +533,7 @@ class Style extends Style\Supervisor implements IComparable /** * Set Conditional Styles. Only used on supervisor. * - * @param Style\Conditional[] $pValue Array of conditional styles + * @param Conditional[] $pValue Array of conditional styles * * @return Style */ @@ -543,7 +547,7 @@ class Style extends Style\Supervisor implements IComparable /** * Get Protection. * - * @return Style\Protection + * @return Protection */ public function getProtection() { diff --git a/src/PhpSpreadsheet/Style/Supervisor.php b/src/PhpSpreadsheet/Style/Supervisor.php index a82ab495..1a63ec43 100644 --- a/src/PhpSpreadsheet/Style/Supervisor.php +++ b/src/PhpSpreadsheet/Style/Supervisor.php @@ -14,7 +14,7 @@ abstract class Supervisor /** * Parent. Only used for supervisor. * - * @var \PhpOffice\PhpSpreadsheet\Style + * @var Style */ protected $parent; @@ -67,7 +67,7 @@ abstract class Supervisor /** * Get the currently active sheet. Only used for supervisor. * - * @return \PhpOffice\PhpSpreadsheet\Worksheet + * @return Worksheet */ public function getActiveSheet() { diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index ac04c715..71b02ce2 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -2,13 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; -use PhpOffice\PhpSpreadsheet\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\DateTime; use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Shared\Date; -use PhpOffice\PhpSpreadsheet\Worksheet; class AutoFilter { @@ -850,7 +849,7 @@ class AutoFilter $this->{$key} = clone $value; } } elseif ((is_array($value)) && ($key == 'columns')) { - // The columns array of \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter objects + // The columns array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter objects $this->{$key} = []; foreach ($value as $k => $v) { $this->{$key}[$k] = clone $v; diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php index 97a80931..537e13f4 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php @@ -145,7 +145,7 @@ class Column /** * Set this Column's AutoFilter Parent. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter + * @param AutoFilter $pParent * * @return Column */ @@ -377,7 +377,7 @@ class Column // Detach from autofilter parent $this->parent = null; } elseif ($key === 'ruleset') { - // The columns array of \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter objects + // The columns array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter objects $this->ruleset = []; foreach ($value as $k => $v) { $cloned = clone $v; diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php index 3f2d97c7..450bccdb 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php @@ -422,7 +422,7 @@ class Rule /** * Set this Rule's AutoFilter Column Parent. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column + * @param Column $pParent * * @return Rule */ diff --git a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php index 9bf2cf35..3e226377 100644 --- a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php @@ -4,7 +4,6 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\IComparable; -use PhpOffice\PhpSpreadsheet\Worksheet; class BaseDrawing implements IComparable { @@ -39,7 +38,7 @@ class BaseDrawing implements IComparable /** * Worksheet. * - * @var \PhpOffice\PhpSpreadsheet\Worksheet + * @var Worksheet */ protected $worksheet; @@ -183,7 +182,7 @@ class BaseDrawing implements IComparable /** * Get Worksheet. * - * @return \PhpOffice\PhpSpreadsheet\Worksheet + * @return Worksheet */ public function getWorksheet() { @@ -203,13 +202,13 @@ class BaseDrawing implements IComparable public function setWorksheet(Worksheet $pValue = null, $pOverrideOld = false) { if ($this->worksheet === null) { - // Add drawing to \PhpOffice\PhpSpreadsheet\Worksheet + // Add drawing to \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $this->worksheet = $pValue; $this->worksheet->getCell($this->coordinates); $this->worksheet->getDrawingCollection()->append($this); } else { if ($pOverrideOld) { - // Remove drawing from old \PhpOffice\PhpSpreadsheet\Worksheet + // Remove drawing from old \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $iterator = $this->worksheet->getDrawingCollection()->getIterator(); while ($iterator->valid()) { @@ -221,7 +220,7 @@ class BaseDrawing implements IComparable } } - // Set new \PhpOffice\PhpSpreadsheet\Worksheet + // Set new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $this->setWorksheet($pValue); } else { throw new PhpSpreadsheetException("A Worksheet has already been assigned. Drawings can only exist on one \PhpOffice\PhpSpreadsheet\Worksheet."); diff --git a/src/PhpSpreadsheet/Worksheet/CellIterator.php b/src/PhpSpreadsheet/Worksheet/CellIterator.php index 56119dc3..ce6475a9 100644 --- a/src/PhpSpreadsheet/Worksheet/CellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/CellIterator.php @@ -9,7 +9,7 @@ abstract class CellIterator /** * Worksheet to iterate. * - * @var \PhpOffice\PhpSpreadsheet\Worksheet + * @var Worksheet */ protected $subject; diff --git a/src/PhpSpreadsheet/Worksheet/Column.php b/src/PhpSpreadsheet/Worksheet/Column.php index af3d8c8c..4baaae1f 100644 --- a/src/PhpSpreadsheet/Worksheet/Column.php +++ b/src/PhpSpreadsheet/Worksheet/Column.php @@ -2,14 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; -use PhpOffice\PhpSpreadsheet\Worksheet; - class Column { /** - * \PhpOffice\PhpSpreadsheet\Worksheet. + * \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet. * - * @var \PhpOffice\PhpSpreadsheet\Worksheet + * @var Worksheet */ private $parent; diff --git a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php index d8ac0974..0646e5d4 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php @@ -2,9 +2,8 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; -use PhpOffice\PhpSpreadsheet\Worksheet; class ColumnCellIterator extends CellIterator implements \Iterator { @@ -121,7 +120,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator /** * Return the current cell in this worksheet column. * - * @return null|Cell + * @return null|\PhpOffice\PhpSpreadsheet\Cell\Cell */ public function current() { diff --git a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php index b5a5a4b4..7d12d5f6 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php @@ -2,17 +2,16 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Exception; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; -use PhpOffice\PhpSpreadsheet\Worksheet; class ColumnIterator implements \Iterator { /** * Worksheet to iterate. * - * @var \PhpOffice\PhpSpreadsheet\Worksheet + * @var Worksheet */ private $subject; diff --git a/src/PhpSpreadsheet/Worksheet/Iterator.php b/src/PhpSpreadsheet/Worksheet/Iterator.php index dc0b2892..311808c0 100644 --- a/src/PhpSpreadsheet/Worksheet/Iterator.php +++ b/src/PhpSpreadsheet/Worksheet/Iterator.php @@ -50,7 +50,7 @@ class Iterator implements \Iterator /** * Current Worksheet. * - * @return \PhpOffice\PhpSpreadsheet\Worksheet + * @return Worksheet */ public function current() { diff --git a/src/PhpSpreadsheet/Worksheet/PageSetup.php b/src/PhpSpreadsheet/Worksheet/PageSetup.php index 9258ebf5..8bf25a88 100644 --- a/src/PhpSpreadsheet/Worksheet/PageSetup.php +++ b/src/PhpSpreadsheet/Worksheet/PageSetup.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; /** diff --git a/src/PhpSpreadsheet/Worksheet/Row.php b/src/PhpSpreadsheet/Worksheet/Row.php index 64d2c970..5c6ab57b 100644 --- a/src/PhpSpreadsheet/Worksheet/Row.php +++ b/src/PhpSpreadsheet/Worksheet/Row.php @@ -2,14 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; -use PhpOffice\PhpSpreadsheet\Worksheet; - class Row { /** - * \PhpOffice\PhpSpreadsheet\Worksheet. + * \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet. * - * @var \PhpOffice\PhpSpreadsheet\Worksheet + * @var Worksheet */ private $worksheet; diff --git a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php index 39708538..a5c05301 100644 --- a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php @@ -2,9 +2,8 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; -use PhpOffice\PhpSpreadsheet\Worksheet; class RowCellIterator extends CellIterator implements \Iterator { @@ -124,7 +123,7 @@ class RowCellIterator extends CellIterator implements \Iterator /** * Return the current cell in this worksheet row. * - * @return Cell + * @return \PhpOffice\PhpSpreadsheet\Cell\Cell */ public function current() { diff --git a/src/PhpSpreadsheet/Worksheet/RowIterator.php b/src/PhpSpreadsheet/Worksheet/RowIterator.php index d6c7318b..70b7b8f7 100644 --- a/src/PhpSpreadsheet/Worksheet/RowIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowIterator.php @@ -3,14 +3,13 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; -use PhpOffice\PhpSpreadsheet\Worksheet; class RowIterator implements \Iterator { /** * Worksheet to iterate. * - * @var \PhpOffice\PhpSpreadsheet\Worksheet + * @var Worksheet */ private $subject; diff --git a/src/PhpSpreadsheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php similarity index 95% rename from src/PhpSpreadsheet/Worksheet.php rename to src/PhpSpreadsheet/Worksheet/Worksheet.php index 4308e01a..d74de3e1 100644 --- a/src/PhpSpreadsheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -1,10 +1,28 @@ cellCollection = CellsFactory::getInstance($this); // Set page setup - $this->pageSetup = new Worksheet\PageSetup(); + $this->pageSetup = new PageSetup(); // Set page margins - $this->pageMargins = new Worksheet\PageMargins(); + $this->pageMargins = new PageMargins(); // Set page header/footer - $this->headerFooter = new Worksheet\HeaderFooter(); + $this->headerFooter = new HeaderFooter(); // Set sheet view - $this->sheetView = new Worksheet\SheetView(); + $this->sheetView = new SheetView(); // Drawing collection $this->drawingCollection = new \ArrayObject(); // Chart collection $this->chartCollection = new \ArrayObject(); // Protection - $this->protection = new Worksheet\Protection(); + $this->protection = new Protection(); // Default row dimension - $this->defaultRowDimension = new Worksheet\RowDimension(null); + $this->defaultRowDimension = new RowDimension(null); // Default column dimension - $this->defaultColumnDimension = new Worksheet\ColumnDimension(null); - $this->autoFilter = new Worksheet\AutoFilter(null, $this); + $this->defaultColumnDimension = new ColumnDimension(null); + $this->autoFilter = new AutoFilter(null, $this); } /** @@ -463,7 +481,7 @@ class Worksheet implements IComparable /** * Get collection of row dimensions. * - * @return Worksheet\RowDimension[] + * @return RowDimension[] */ public function getRowDimensions() { @@ -473,7 +491,7 @@ class Worksheet implements IComparable /** * Get default row dimension. * - * @return Worksheet\RowDimension + * @return RowDimension */ public function getDefaultRowDimension() { @@ -483,7 +501,7 @@ class Worksheet implements IComparable /** * Get collection of column dimensions. * - * @return Worksheet\ColumnDimension[] + * @return ColumnDimension[] */ public function getColumnDimensions() { @@ -493,7 +511,7 @@ class Worksheet implements IComparable /** * Get default column dimension. * - * @return Worksheet\ColumnDimension + * @return ColumnDimension */ public function getDefaultColumnDimension() { @@ -503,7 +521,7 @@ class Worksheet implements IComparable /** * Get collection of drawings. * - * @return Worksheet\BaseDrawing[] + * @return BaseDrawing[] */ public function getDrawingCollection() { @@ -725,7 +743,7 @@ class Worksheet implements IComparable if (!$isMerged || $isMergedButProceed) { // Calculated value // To formatted string - $cellValue = Style\NumberFormat::toFormattedString( + $cellValue = NumberFormat::toFormattedString( $cell->getCalculatedValue(), $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode() ); @@ -898,7 +916,7 @@ class Worksheet implements IComparable /** * Get page setup. * - * @return Worksheet\PageSetup + * @return PageSetup */ public function getPageSetup() { @@ -908,11 +926,11 @@ class Worksheet implements IComparable /** * Set page setup. * - * @param Worksheet\PageSetup $pValue + * @param PageSetup $pValue * * @return Worksheet */ - public function setPageSetup(Worksheet\PageSetup $pValue) + public function setPageSetup(PageSetup $pValue) { $this->pageSetup = $pValue; @@ -922,7 +940,7 @@ class Worksheet implements IComparable /** * Get page margins. * - * @return Worksheet\PageMargins + * @return PageMargins */ public function getPageMargins() { @@ -932,11 +950,11 @@ class Worksheet implements IComparable /** * Set page margins. * - * @param Worksheet\PageMargins $pValue + * @param PageMargins $pValue * * @return Worksheet */ - public function setPageMargins(Worksheet\PageMargins $pValue) + public function setPageMargins(PageMargins $pValue) { $this->pageMargins = $pValue; @@ -946,7 +964,7 @@ class Worksheet implements IComparable /** * Get page header/footer. * - * @return Worksheet\HeaderFooter + * @return HeaderFooter */ public function getHeaderFooter() { @@ -956,11 +974,11 @@ class Worksheet implements IComparable /** * Set page header/footer. * - * @param Worksheet\HeaderFooter $pValue + * @param HeaderFooter $pValue * * @return Worksheet */ - public function setHeaderFooter(Worksheet\HeaderFooter $pValue) + public function setHeaderFooter(HeaderFooter $pValue) { $this->headerFooter = $pValue; @@ -970,7 +988,7 @@ class Worksheet implements IComparable /** * Get sheet view. * - * @return Worksheet\SheetView + * @return SheetView */ public function getSheetView() { @@ -980,11 +998,11 @@ class Worksheet implements IComparable /** * Set sheet view. * - * @param Worksheet\SheetView $pValue + * @param SheetView $pValue * * @return Worksheet */ - public function setSheetView(Worksheet\SheetView $pValue) + public function setSheetView(SheetView $pValue) { $this->sheetView = $pValue; @@ -994,7 +1012,7 @@ class Worksheet implements IComparable /** * Get Protection. * - * @return Worksheet\Protection + * @return Protection */ public function getProtection() { @@ -1004,11 +1022,11 @@ class Worksheet implements IComparable /** * Set Protection. * - * @param Worksheet\Protection $pValue + * @param Protection $pValue * * @return Worksheet */ - public function setProtection(Worksheet\Protection $pValue) + public function setProtection(Protection $pValue) { $this->protection = $pValue; $this->dirty = true; @@ -1122,7 +1140,7 @@ class Worksheet implements IComparable * * @param string $pCoordinate Coordinate of the cell, eg: 'A1' * @param mixed $pValue Value of the cell - * @param string $pDataType Explicit data type, see Cell\DataType::TYPE_* + * @param string $pDataType Explicit data type, see DataType::TYPE_* * * @return Worksheet */ @@ -1140,7 +1158,7 @@ class Worksheet implements IComparable * @param int $pColumn Numeric column coordinate of the cell (A = 0) * @param int $pRow Numeric row coordinate of the cell * @param mixed $pValue Value of the cell - * @param string $pDataType Explicit data type, see Cell\DataType::TYPE_* + * @param string $pDataType Explicit data type, see DataType::TYPE_* * * @return Worksheet */ @@ -1232,7 +1250,7 @@ class Worksheet implements IComparable */ private function createNewCell($pCoordinate) { - $cell = new Cell(null, Cell\DataType::TYPE_NULL, $this); + $cell = new Cell(null, DataType::TYPE_NULL, $this); $this->cellCollection->add($pCoordinate, $cell); $this->cellCollectionIsSorted = false; @@ -1327,7 +1345,7 @@ class Worksheet implements IComparable * @param int $pRow Numeric index of the row * @param mixed $create * - * @return Worksheet\RowDimension + * @return RowDimension */ public function getRowDimension($pRow, $create = true) { @@ -1339,7 +1357,7 @@ class Worksheet implements IComparable if (!$create) { return null; } - $this->rowDimensions[$pRow] = new Worksheet\RowDimension($pRow); + $this->rowDimensions[$pRow] = new RowDimension($pRow); $this->cachedHighestRow = max($this->cachedHighestRow, $pRow); } @@ -1353,7 +1371,7 @@ class Worksheet implements IComparable * @param string $pColumn String index of the column eg: 'A' * @param mixed $create * - * @return Worksheet\ColumnDimension + * @return ColumnDimension */ public function getColumnDimension($pColumn, $create = true) { @@ -1365,7 +1383,7 @@ class Worksheet implements IComparable if (!$create) { return null; } - $this->columnDimensions[$pColumn] = new Worksheet\ColumnDimension($pColumn); + $this->columnDimensions[$pColumn] = new ColumnDimension($pColumn); if (Cell::columnIndexFromString($this->cachedHighestColumn) < Cell::columnIndexFromString($pColumn)) { $this->cachedHighestColumn = $pColumn; @@ -1380,7 +1398,7 @@ class Worksheet implements IComparable * * @param int $pColumn Numeric column coordinate of the cell (A = 0) * - * @return Worksheet\ColumnDimension + * @return ColumnDimension */ public function getColumnDimensionByColumn($pColumn) { @@ -1422,7 +1440,7 @@ class Worksheet implements IComparable * * @param string $pCoordinate eg: 'A1' * - * @return Style\Conditional[] + * @return Conditional[] */ public function getConditionalStyles($pCoordinate) { @@ -1478,7 +1496,7 @@ class Worksheet implements IComparable * Set conditional styles. * * @param string $pCoordinate eg: 'A1' - * @param $pValue Style\Conditional[] + * @param $pValue Conditional[] * * @return Worksheet */ @@ -1562,7 +1580,7 @@ class Worksheet implements IComparable * * Please note that this will overwrite existing cell styles for cells in range! * - * @param Style\Conditional[] $pCellStyle Cell style to duplicate + * @param Conditional[] $pCellStyle Cell style to duplicate * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") * * @throws Exception @@ -1572,7 +1590,7 @@ class Worksheet implements IComparable public function duplicateConditionalStyle(array $pCellStyle, $pRange = '') { foreach ($pCellStyle as $cellStyle) { - if (!($cellStyle instanceof Style\Conditional)) { + if (!($cellStyle instanceof Conditional)) { throw new Exception('Style is not a conditional style'); } } @@ -1676,14 +1694,14 @@ class Worksheet implements IComparable // create upper left cell if it does not already exist $upperLeft = $aReferences[0]; if (!$this->cellExists($upperLeft)) { - $this->getCell($upperLeft)->setValueExplicit(null, Cell\DataType::TYPE_NULL); + $this->getCell($upperLeft)->setValueExplicit(null, DataType::TYPE_NULL); } // Blank out the rest of the cells in the range (if they exist) $count = count($aReferences); for ($i = 1; $i < $count; ++$i) { if ($this->cellExists($aReferences[$i])) { - $this->getCell($aReferences[$i])->setValueExplicit(null, Cell\DataType::TYPE_NULL); + $this->getCell($aReferences[$i])->setValueExplicit(null, DataType::TYPE_NULL); } } } else { @@ -1882,7 +1900,7 @@ class Worksheet implements IComparable /** * Get Autofilter. * - * @return Worksheet\AutoFilter + * @return AutoFilter */ public function getAutoFilter() { @@ -1904,7 +1922,7 @@ class Worksheet implements IComparable $pValue = strtoupper($pValue); if (is_string($pValue)) { $this->autoFilter->setRange($pValue); - } elseif (is_object($pValue) && ($pValue instanceof Worksheet\AutoFilter)) { + } elseif (is_object($pValue) && ($pValue instanceof AutoFilter)) { $this->autoFilter = $pValue; } @@ -2538,9 +2556,9 @@ class Worksheet implements IComparable if ($formatData) { $style = $this->parent->getCellXfByIndex($cell->getXfIndex()); - $returnValue[$rRef][$cRef] = Style\NumberFormat::toFormattedString( + $returnValue[$rRef][$cRef] = NumberFormat::toFormattedString( $returnValue[$rRef][$cRef], - ($style && $style->getNumberFormat()) ? $style->getNumberFormat()->getFormatCode() : Style\NumberFormat::FORMAT_GENERAL + ($style && $style->getNumberFormat()) ? $style->getNumberFormat()->getFormatCode() : NumberFormat::FORMAT_GENERAL ); } } else { @@ -2614,11 +2632,11 @@ class Worksheet implements IComparable * @param int $startRow The row number at which to start iterating * @param int $endRow The row number at which to stop iterating * - * @return Worksheet\RowIterator + * @return RowIterator */ public function getRowIterator($startRow = 1, $endRow = null) { - return new Worksheet\RowIterator($this, $startRow, $endRow); + return new RowIterator($this, $startRow, $endRow); } /** @@ -2627,11 +2645,11 @@ class Worksheet implements IComparable * @param string $startColumn The column address at which to start iterating * @param string $endColumn The column address at which to stop iterating * - * @return Worksheet\ColumnIterator + * @return ColumnIterator */ public function getColumnIterator($startColumn = 'A', $endColumn = null) { - return new Worksheet\ColumnIterator($this, $startColumn, $endColumn); + return new ColumnIterator($this, $startColumn, $endColumn); } /** @@ -2724,7 +2742,7 @@ class Worksheet implements IComparable } // else create hyperlink - $this->hyperlinkCollection[$pCellCoordinate] = new Cell\Hyperlink(); + $this->hyperlinkCollection[$pCellCoordinate] = new Hyperlink(); return $this->hyperlinkCollection[$pCellCoordinate]; } @@ -2733,11 +2751,11 @@ class Worksheet implements IComparable * Set hyperlink. * * @param string $pCellCoordinate Cell coordinate to insert hyperlink, eg: 'A1' - * @param null|Cell\Hyperlink $pHyperlink + * @param null|Hyperlink $pHyperlink * * @return Worksheet */ - public function setHyperlink($pCellCoordinate, Cell\Hyperlink $pHyperlink = null) + public function setHyperlink($pCellCoordinate, Hyperlink $pHyperlink = null) { if ($pHyperlink === null) { unset($this->hyperlinkCollection[$pCellCoordinate]); @@ -2763,7 +2781,7 @@ class Worksheet implements IComparable /** * Get collection of hyperlinks. * - * @return Cell\Hyperlink[] + * @return Hyperlink[] */ public function getHyperlinkCollection() { @@ -2783,7 +2801,7 @@ class Worksheet implements IComparable } // else create data validation - $this->dataValidationCollection[$pCellCoordinate] = new Cell\DataValidation(); + $this->dataValidationCollection[$pCellCoordinate] = new DataValidation(); return $this->dataValidationCollection[$pCellCoordinate]; } @@ -2792,11 +2810,11 @@ class Worksheet implements IComparable * Set data validation. * * @param string $pCellCoordinate Cell coordinate to insert data validation, eg: 'A1' - * @param null|Cell\DataValidation $pDataValidation + * @param null|DataValidation $pDataValidation * * @return Worksheet */ - public function setDataValidation($pCellCoordinate, Cell\DataValidation $pDataValidation = null) + public function setDataValidation($pCellCoordinate, DataValidation $pDataValidation = null) { if ($pDataValidation === null) { unset($this->dataValidationCollection[$pCellCoordinate]); @@ -2822,7 +2840,7 @@ class Worksheet implements IComparable /** * Get collection of data validations. * - * @return Cell\DataValidation[] + * @return DataValidation[] */ public function getDataValidationCollection() { @@ -2869,12 +2887,12 @@ class Worksheet implements IComparable /** * Get tab color. * - * @return Style\Color + * @return Color */ public function getTabColor() { if ($this->tabColor === null) { - $this->tabColor = new Style\Color(); + $this->tabColor = new Color(); } return $this->tabColor; @@ -2937,7 +2955,7 @@ class Worksheet implements IComparable } } $this->drawingCollection = $newCollection; - } elseif (($key == 'autoFilter') && ($this->autoFilter instanceof Worksheet\AutoFilter)) { + } elseif (($key == 'autoFilter') && ($this->autoFilter instanceof AutoFilter)) { $newAutoFilter = clone $this->autoFilter; $this->autoFilter = $newAutoFilter; $this->autoFilter->setParent($this); @@ -2958,7 +2976,7 @@ class Worksheet implements IComparable * * @throws Exception * - * @return objWorksheet + * @return Worksheet */ public function setCodeName($pValue, $validate = true) { diff --git a/src/PhpSpreadsheet/Writer/Csv.php b/src/PhpSpreadsheet/Writer/Csv.php index 7cbdb2a1..34450bf8 100644 --- a/src/PhpSpreadsheet/Writer/Csv.php +++ b/src/PhpSpreadsheet/Writer/Csv.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; -use PhpOffice\PhpSpreadsheet\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Spreadsheet; class Csv extends BaseWriter implements IWriter diff --git a/src/PhpSpreadsheet/Writer/Html.php b/src/PhpSpreadsheet/Writer/Html.php index be1f2ea7..44527bd1 100644 --- a/src/PhpSpreadsheet/Writer/Html.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -2,25 +2,26 @@ namespace PhpOffice\PhpSpreadsheet\Writer; -use PhpOffice\PhpSpreadsheet\Calculation; -use PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\Chart; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Chart\Chart; +use PhpOffice\PhpSpreadsheet\RichText\RichText; +use PhpOffice\PhpSpreadsheet\RichText\Run; use PhpOffice\PhpSpreadsheet\Shared\Drawing as SharedDrawing; use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Shared\Font as SharedFont; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; -use PhpOffice\PhpSpreadsheet\Style; use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Border; use PhpOffice\PhpSpreadsheet\Style\Borders; use PhpOffice\PhpSpreadsheet\Style\Fill; use PhpOffice\PhpSpreadsheet\Style\Font; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Style\Style; use PhpOffice\PhpSpreadsheet\Worksheet\Drawing; use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException; class Html extends BaseWriter implements IWriter @@ -617,7 +618,7 @@ class Html extends BaseWriter implements IWriter /** * Generate image tag in cell. * - * @param Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet + * @param Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet * @param string $coordinates Cell coordinates * * @throws WriterException @@ -700,7 +701,7 @@ class Html extends BaseWriter implements IWriter /** * Generate chart tag in cell. * - * @param Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet + * @param Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet * @param string $coordinates Cell coordinates * * @throws WriterException @@ -1160,7 +1161,7 @@ class Html extends BaseWriter implements IWriter /** * Generate row. * - * @param Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet + * @param Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet * @param array $pValues Array containing cells in a row * @param int $pRow Row number (0-based) * @param mixed $cellType eg: 'td' @@ -1241,7 +1242,7 @@ class Html extends BaseWriter implements IWriter $elements = $cell->getValue()->getRichTextElements(); foreach ($elements as $element) { // Rich text start? - if ($element instanceof RichText\Run) { + if ($element instanceof Run) { $cellData .= ''; if ($element->getFont()->getSuperscript()) { @@ -1255,7 +1256,7 @@ class Html extends BaseWriter implements IWriter $cellText = $element->getText(); $cellData .= htmlspecialchars($cellText); - if ($element instanceof RichText\Run) { + if ($element instanceof Run) { if ($element->getFont()->getSuperscript()) { $cellData .= ''; } elseif ($element->getFont()->getSubscript()) { diff --git a/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php b/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php index df830b94..2f543be5 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php +++ b/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods\Cell; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; /** diff --git a/src/PhpSpreadsheet/Writer/Ods/Content.php b/src/PhpSpreadsheet/Writer/Ods/Content.php index 01825ef7..565037d8 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Content.php +++ b/src/PhpSpreadsheet/Writer/Ods/Content.php @@ -2,13 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Style\Fill; use PhpOffice\PhpSpreadsheet\Style\Font; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Row; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PhpOffice\PhpSpreadsheet\Writer\Exception; use PhpOffice\PhpSpreadsheet\Writer\Ods; use PhpOffice\PhpSpreadsheet\Writer\Ods\Cell\Comment; @@ -166,17 +167,17 @@ class Content extends WriterPart * Write cells of the specified row. * * @param XMLWriter $objWriter - * @param Worksheet\Row $row + * @param Row $row * * @throws Exception */ - private function writeCells(XMLWriter $objWriter, Worksheet\Row $row) + private function writeCells(XMLWriter $objWriter, Row $row) { $numberColsRepeated = self::NUMBER_COLS_REPEATED_MAX; $prevColumn = -1; $cells = $row->getCellIterator(); while ($cells->valid()) { - /** @var Cell $cell */ + /** @var \PhpOffice\PhpSpreadsheet\Cell\Cell $cell */ $cell = $cells->current(); $column = Cell::columnIndexFromString($cell->getColumn()) - 1; diff --git a/src/PhpSpreadsheet/Writer/Pdf.php b/src/PhpSpreadsheet/Writer/Pdf.php index 93a03acd..83d7587e 100644 --- a/src/PhpSpreadsheet/Writer/Pdf.php +++ b/src/PhpSpreadsheet/Writer/Pdf.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; -use PhpOffice\PhpSpreadsheet\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup; diff --git a/src/PhpSpreadsheet/Writer/Xls.php b/src/PhpSpreadsheet/Writer/Xls.php index 4fca377e..758b04f2 100644 --- a/src/PhpSpreadsheet/Writer/Xls.php +++ b/src/PhpSpreadsheet/Writer/Xls.php @@ -2,10 +2,11 @@ namespace PhpOffice\PhpSpreadsheet\Writer; -use PhpOffice\PhpSpreadsheet\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\RichText\RichText; +use PhpOffice\PhpSpreadsheet\RichText\Run; use PhpOffice\PhpSpreadsheet\Shared\Drawing as SharedDrawing; use PhpOffice\PhpSpreadsheet\Shared\Escher; use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer; @@ -164,7 +165,7 @@ class Xls extends BaseWriter implements IWriter if ($cVal instanceof RichText) { $elements = $cVal->getRichTextElements(); foreach ($elements as $element) { - if ($element instanceof RichText\Run) { + if ($element instanceof Run) { $font = $element->getFont(); $this->writerWorksheets[$i]->fontHashIndex[$font->getHashCode()] = $this->writerWorkbook->addFont($font); } diff --git a/src/PhpSpreadsheet/Writer/Xls/Escher.php b/src/PhpSpreadsheet/Writer/Xls/Escher.php index 658a7a6d..3811df5d 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Escher.php +++ b/src/PhpSpreadsheet/Writer/Xls/Escher.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer; use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer; use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer\SpContainer; diff --git a/src/PhpSpreadsheet/Writer/Xls/Workbook.php b/src/PhpSpreadsheet/Writer/Xls/Workbook.php index ac0f1cbc..fa901981 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Xls/Workbook.php @@ -2,11 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Style\Style; // Original file header of PEAR::Spreadsheet_Excel_Writer_Workbook (used as the base for this class): // ----------------------------------------------------------------------------------------- @@ -221,14 +222,14 @@ class Workbook extends BIFFwriter /** * Add a new XF writer. * - * @param \PhpOffice\PhpSpreadsheet\Style + * @param Style * @param bool Is it a style XF? * @param mixed $style * @param mixed $isStyleXf * * @return int Index to XF record */ - public function addXfWriter($style, $isStyleXf = false) + public function addXfWriter(Style $style, $isStyleXf = false) { $xfWriter = new Xf($style); $xfWriter->setIsStyleXf($isStyleXf); @@ -800,7 +801,7 @@ class Workbook extends BIFFwriter /** * Writes Excel BIFF BOUNDSHEET record. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet $sheet Worksheet name + * @param Worksheet $sheet Worksheet name * @param int $offset Location of worksheet BOF */ private function writeBoundSheet($sheet, $offset) @@ -810,15 +811,15 @@ class Workbook extends BIFFwriter // sheet state switch ($sheet->getSheetState()) { - case \PhpOffice\PhpSpreadsheet\Worksheet::SHEETSTATE_VISIBLE: + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break; - case \PhpOffice\PhpSpreadsheet\Worksheet::SHEETSTATE_HIDDEN: + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break; - case \PhpOffice\PhpSpreadsheet\Worksheet::SHEETSTATE_VERYHIDDEN: + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break; diff --git a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php index 222df5a6..6e9d8fdf 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -2,10 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Cell\DataValidation; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\RichText\RichText; +use PhpOffice\PhpSpreadsheet\RichText\Run; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\Xls; use PhpOffice\PhpSpreadsheet\Style\Alignment; @@ -174,7 +176,7 @@ class Worksheet extends BIFFwriter /** * Sheet object. * - * @var \PhpOffice\PhpSpreadsheet\Worksheet + * @var Worksheet */ public $phpSheet; @@ -219,7 +221,7 @@ class Worksheet extends BIFFwriter * @param mixed $parser The formula parser created for the Workbook * @param bool $preCalculateFormulas Flag indicating whether formulas should be calculated or just written * @param string $phpSheet The worksheet to write - * @param \PhpOffice\PhpSpreadsheet\Worksheet $phpSheet + * @param Worksheet $phpSheet */ public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet) { @@ -412,7 +414,7 @@ class Worksheet extends BIFFwriter $elements = $cVal->getRichTextElements(); foreach ($elements as $element) { // FONT Index - if ($element instanceof RichText\Run) { + if ($element instanceof Run) { $str_fontidx = $this->fontHashIndex[$element->getFont()->getHashCode()]; } else { $str_fontidx = 0; @@ -424,8 +426,8 @@ class Worksheet extends BIFFwriter $this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun); } else { switch ($cell->getDatatype()) { - case Cell\DataType::TYPE_STRING: - case Cell\DataType::TYPE_NULL: + case DataType::TYPE_STRING: + case DataType::TYPE_NULL: if ($cVal === '' || $cVal === null) { $this->writeBlank($row, $column, $xfIndex); } else { @@ -433,21 +435,21 @@ class Worksheet extends BIFFwriter } break; - case Cell\DataType::TYPE_NUMERIC: + case DataType::TYPE_NUMERIC: $this->writeNumber($row, $column, $cVal, $xfIndex); break; - case Cell\DataType::TYPE_FORMULA: + case DataType::TYPE_FORMULA: $calculatedValue = $this->preCalculateFormulas ? $cell->getCalculatedValue() : null; $this->writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue); break; - case Cell\DataType::TYPE_BOOL: + case DataType::TYPE_BOOL: $this->writeBoolErr($row, $column, $cVal, 0, $xfIndex); break; - case Cell\DataType::TYPE_ERROR: + case DataType::TYPE_ERROR: $this->writeBoolErr($row, $column, self::mapErrorCode($cVal), 1, $xfIndex); break; @@ -799,7 +801,7 @@ class Worksheet extends BIFFwriter // Numeric value $num = pack('d', $calculatedValue); } elseif (is_string($calculatedValue)) { - $errorCodes = Cell\DataType::getErrorCodes(); + $errorCodes = DataType::getErrorCodes(); if (isset($errorCodes[$calculatedValue])) { // Error value $num = pack('CCCvCv', 0x02, 0x00, self::mapErrorCode($calculatedValue), 0x00, 0x00, 0xFFFF); @@ -2038,17 +2040,17 @@ class Worksheet extends BIFFwriter // Decide what to do by the type of break switch ($breakType) { - case \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_COLUMN: + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_COLUMN: // Add to list of vertical breaks $vbreaks[] = Cell::columnIndexFromString($coordinates[0]) - 1; break; - case \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_ROW: + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_ROW: // Add to list of horizontal breaks $hbreaks[] = $coordinates[1]; break; - case \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_NONE: + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_NONE: default: // Nothing to do break; diff --git a/src/PhpSpreadsheet/Writer/Xls/Xf.php b/src/PhpSpreadsheet/Writer/Xls/Xf.php index ed957a03..ed54c3a6 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Xf.php +++ b/src/PhpSpreadsheet/Writer/Xls/Xf.php @@ -2,12 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; -use PhpOffice\PhpSpreadsheet\Style; use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Border; use PhpOffice\PhpSpreadsheet\Style\Borders; use PhpOffice\PhpSpreadsheet\Style\Fill; use PhpOffice\PhpSpreadsheet\Style\Protection; +use PhpOffice\PhpSpreadsheet\Style\Style; // Original file header of PEAR::Spreadsheet_Excel_Writer_Format (used as the base for this class): // ----------------------------------------------------------------------------------------- diff --git a/src/PhpSpreadsheet/Writer/Xlsx.php b/src/PhpSpreadsheet/Writer/Xlsx.php index 174180f5..3c0b0977 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx.php +++ b/src/PhpSpreadsheet/Writer/Xlsx.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; -use PhpOffice\PhpSpreadsheet\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\HashTable; use PhpOffice\PhpSpreadsheet\Shared\File; @@ -98,7 +98,7 @@ class Xlsx extends BaseWriter implements IWriter private $numFmtHashTable; /** - * Private unique \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing HashTable. + * Private unique \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable. * * @var HashTable */ @@ -488,7 +488,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing HashTable. + * Get \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable. * * @return HashTable */ diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php index e78fbd2a..1d8e0bd8 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php @@ -26,14 +26,14 @@ class Chart extends WriterPart /** * Write charts to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Chart $pChart + * @param \PhpOffice\PhpSpreadsheet\Chart\Chart $pChart * @param mixed $calculateCellValues * * @throws WriterException * * @return string XML Output */ - public function writeChart(\PhpOffice\PhpSpreadsheet\Chart $pChart, $calculateCellValues = true) + public function writeChart(\PhpOffice\PhpSpreadsheet\Chart\Chart $pChart, $calculateCellValues = true) { $this->calculateCellValues = $calculateCellValues; @@ -204,7 +204,7 @@ class Chart extends WriterPart * Write Chart Plot Area. * * @param XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet + * @param Worksheet $pSheet * @param PlotArea $plotArea * @param Title $xAxisLabel * @param Title $yAxisLabel @@ -213,7 +213,7 @@ class Chart extends WriterPart * * @throws WriterException */ - private function writePlotArea(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet, PlotArea $plotArea, Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null) + private function writePlotArea(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet, PlotArea $plotArea, Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null) { if ($plotArea === null) { return; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Comments.php b/src/PhpSpreadsheet/Writer/Xlsx/Comments.php index c64e2f9e..bb24c884 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Comments.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Comments.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Comment; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; @@ -11,13 +11,13 @@ class Comments extends WriterPart /** * Write comments to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * @param Worksheet $pWorksheet * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception * * @return string XML Output */ - public function writeComments(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet) + public function writeComments(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) { // Create XML writer $objWriter = null; @@ -94,13 +94,13 @@ class Comments extends WriterPart /** * Write VML comments to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * @param Worksheet $pWorksheet * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception * * @return string XML Output */ - public function writeVMLComments(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet) + public function writeVMLComments(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) { // Create XML writer $objWriter = null; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php b/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php index 1f9b827c..3bf30588 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing; @@ -14,14 +14,14 @@ class Drawing extends WriterPart /** * Write drawings to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * @param Worksheet $pWorksheet * @param bool $includeCharts Flag indicating if we should include drawing details for charts * * @throws WriterException * * @return string XML Output */ - public function writeDrawings(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet, $includeCharts = false) + public function writeDrawings(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, $includeCharts = false) { // Create XML writer $objWriter = null; @@ -69,12 +69,12 @@ class Drawing extends WriterPart * Write drawings to XML format. * * @param XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpSpreadsheet\Chart $pChart + * @param \PhpOffice\PhpSpreadsheet\Chart\Chart $pChart * @param int $pRelationId * * @throws WriterException */ - public function writeChart(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Chart $pChart, $pRelationId = -1) + public function writeChart(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Chart\Chart $pChart, $pRelationId = -1) { $tl = $pChart->getTopLeftPosition(); $tl['colRow'] = Cell::coordinateFromString($tl['cell']); @@ -271,13 +271,13 @@ class Drawing extends WriterPart /** * Write VML header/footer images to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * @param Worksheet $pWorksheet * * @throws WriterException * * @return string XML Output */ - public function writeVMLHeaderFooterImages(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet) + public function writeVMLHeaderFooterImages(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) { // Create XML writer $objWriter = null; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Rels.php b/src/PhpSpreadsheet/Writer/Xlsx/Rels.php index fce3015b..0d1610a1 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Rels.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Rels.php @@ -168,7 +168,7 @@ class Rels extends WriterPart * rId1 - Drawings * rId_hyperlink_x - Hyperlinks * - * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * @param Worksheet $pWorksheet * @param int $pWorksheetId * @param bool $includeCharts Flag indicating if we should write charts * @@ -176,7 +176,7 @@ class Rels extends WriterPart * * @return string XML Output */ - public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet, $pWorksheetId = 1, $includeCharts = false) + public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, $pWorksheetId = 1, $includeCharts = false) { // Create XML writer $objWriter = null; @@ -263,7 +263,7 @@ class Rels extends WriterPart /** * Write drawing relationships to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * @param Worksheet $pWorksheet * @param int &$chartRef Chart ID * @param bool $includeCharts Flag indicating if we should write charts * @@ -271,7 +271,7 @@ class Rels extends WriterPart * * @return string XML Output */ - public function writeDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet, &$chartRef, $includeCharts = false) + public function writeDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, &$chartRef, $includeCharts = false) { // Create XML writer $objWriter = null; @@ -330,13 +330,13 @@ class Rels extends WriterPart /** * Write header/footer drawing relationships to XML format. * - * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * @param Worksheet $pWorksheet * * @throws WriterException * * @return string XML Output */ - public function writeHeaderFooterDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet) + public function writeHeaderFooterDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) { // Create XML writer $objWriter = null; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php b/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php index eeb5ca90..82eac26b 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php @@ -2,11 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\Cell\DataType; +use PhpOffice\PhpSpreadsheet\RichText\RichText; +use PhpOffice\PhpSpreadsheet\RichText\Run; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException; class StringTable extends WriterPart @@ -44,7 +45,7 @@ class StringTable extends WriterPart ($cellValue !== null) && $cellValue !== '' && !isset($aFlippedStringTable[$cellValue]) && - ($cell->getDataType() == Cell\DataType::TYPE_STRING || $cell->getDataType() == Cell\DataType::TYPE_STRING2 || $cell->getDataType() == Cell\DataType::TYPE_NULL)) { + ($cell->getDataType() == DataType::TYPE_STRING || $cell->getDataType() == DataType::TYPE_STRING2 || $cell->getDataType() == DataType::TYPE_NULL)) { $aStringTable[] = $cellValue; $aFlippedStringTable[$cellValue] = true; } elseif ($cellValue instanceof RichText && @@ -131,7 +132,7 @@ class StringTable extends WriterPart $objWriter->startElement($prefix . 'r'); // rPr - if ($element instanceof RichText\Run) { + if ($element instanceof Run) { // rPr $objWriter->startElement($prefix . 'rPr'); diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Style.php b/src/PhpSpreadsheet/Writer/Xlsx/Style.php index 911938fa..eb04601f 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Style.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Style.php @@ -376,12 +376,12 @@ class Style extends WriterPart * Write Cell Style Xf. * * @param XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpSpreadsheet\Style $pStyle Style + * @param \PhpOffice\PhpSpreadsheet\Style\Style $pStyle Style * @param Spreadsheet $spreadsheet Workbook * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ - private function writeCellStyleXf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style $pStyle, Spreadsheet $spreadsheet) + private function writeCellStyleXf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle, Spreadsheet $spreadsheet) { // xf $objWriter->startElement('xf'); @@ -453,11 +453,11 @@ class Style extends WriterPart * Write Cell Style Dxf. * * @param XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpSpreadsheet\Style $pStyle Style + * @param \PhpOffice\PhpSpreadsheet\Style\Style $pStyle Style * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ - private function writeCellStyleDxf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style $pStyle) + private function writeCellStyleDxf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle) { // dxf $objWriter->startElement('dxf'); @@ -569,7 +569,7 @@ class Style extends WriterPart * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception * - * @return \PhpOffice\PhpSpreadsheet\Style[] All styles in PhpSpreadsheet + * @return \PhpOffice\PhpSpreadsheet\Style\Style[] All styles in PhpSpreadsheet */ public function allStyles(Spreadsheet $spreadsheet) { @@ -626,7 +626,7 @@ class Style extends WriterPart $aFills[] = $fill1; // The remaining fills $aStyles = $this->allStyles($spreadsheet); - /** @var \PhpOffice\PhpSpreadsheet\Style $style */ + /** @var \PhpOffice\PhpSpreadsheet\Style\Style $style */ foreach ($aStyles as $style) { if (!isset($aFills[$style->getFill()->getHashCode()])) { $aFills[$style->getFill()->getHashCode()] = $style->getFill(); @@ -651,7 +651,7 @@ class Style extends WriterPart $aFonts = []; $aStyles = $this->allStyles($spreadsheet); - /** @var \PhpOffice\PhpSpreadsheet\Style $style */ + /** @var \PhpOffice\PhpSpreadsheet\Style\Style $style */ foreach ($aStyles as $style) { if (!isset($aFonts[$style->getFont()->getHashCode()])) { $aFonts[$style->getFont()->getHashCode()] = $style->getFont(); @@ -676,7 +676,7 @@ class Style extends WriterPart $aBorders = []; $aStyles = $this->allStyles($spreadsheet); - /** @var \PhpOffice\PhpSpreadsheet\Style $style */ + /** @var \PhpOffice\PhpSpreadsheet\Style\Style $style */ foreach ($aStyles as $style) { if (!isset($aBorders[$style->getBorders()->getHashCode()])) { $aBorders[$style->getBorders()->getHashCode()] = $style->getBorders(); @@ -701,7 +701,7 @@ class Style extends WriterPart $aNumFmts = []; $aStyles = $this->allStyles($spreadsheet); - /** @var \PhpOffice\PhpSpreadsheet\Style $style */ + /** @var \PhpOffice\PhpSpreadsheet\Style\Style $style */ foreach ($aStyles as $style) { if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !isset($aNumFmts[$style->getNumberFormat()->getHashCode()])) { $aNumFmts[$style->getNumberFormat()->getHashCode()] = $style->getNumberFormat(); diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php index dff5a10a..c56db3ed 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php @@ -2,12 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use PhpOffice\PhpSpreadsheet\Cell; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\NamedRange; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; use PhpOffice\PhpSpreadsheet\Spreadsheet; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException; class Workbook extends WriterPart diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php index 3f3183bb..12668079 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php @@ -2,15 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\RichText; +use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; use PhpOffice\PhpSpreadsheet\Style\Conditional; -use PhpOffice\PhpSpreadsheet\Worksheet as PhpspreadsheetWorksheet; use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column; use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule; use PhpOffice\PhpSpreadsheet\Worksheet\SheetView; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet as PhpspreadsheetWorksheet; use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException; /** @@ -120,7 +120,7 @@ class Worksheet extends WriterPart return $objWriter->getData(); } - throw new WriterException('Invalid \\PhpOffice\\PhpSpreadsheet\\Worksheet object passed.'); + throw new WriterException('Invalid \\PhpOffice\\PhpSpreadsheet\\Worksheet\\Worksheet object passed.'); } /** @@ -531,7 +531,7 @@ class Worksheet extends WriterPart * Write DataValidations. * * @param XMLWriter $objWriter XML Writer - * @param PhpspreadsheetWorksheet $pSheet Worksheet + * @param \PhpOffice\PhpSpreadsheet\Worksheet\PhpspreadsheetWorksheet $pSheet Worksheet * * @throws WriterException */ @@ -697,7 +697,7 @@ class Worksheet extends WriterPart * Write PrintOptions. * * @param XMLWriter $objWriter XML Writer - * @param PhpspreadsheetWorksheet $pSheet Worksheet + * @param \PhpOffice\PhpSpreadsheet\Worksheet\PhpspreadsheetWorksheet $pSheet Worksheet * * @throws WriterException */ @@ -724,7 +724,7 @@ class Worksheet extends WriterPart * Write PageMargins. * * @param XMLWriter $objWriter XML Writer - * @param PhpspreadsheetWorksheet $pSheet Worksheet + * @param \PhpOffice\PhpSpreadsheet\Worksheet\PhpspreadsheetWorksheet $pSheet Worksheet * * @throws WriterException */ @@ -901,7 +901,7 @@ class Worksheet extends WriterPart * Write Breaks. * * @param XMLWriter $objWriter XML Writer - * @param PhpspreadsheetWorksheet $pSheet Worksheet + * @param \PhpOffice\PhpSpreadsheet\Worksheet\PhpspreadsheetWorksheet $pSheet Worksheet * * @throws WriterException */ @@ -1167,7 +1167,7 @@ class Worksheet extends WriterPart * Write Drawings. * * @param XMLWriter $objWriter XML Writer - * @param PhpspreadsheetWorksheet $pSheet Worksheet + * @param \PhpOffice\PhpSpreadsheet\Worksheet\PhpspreadsheetWorksheet $pSheet Worksheet * @param bool $includeCharts Flag indicating if we should include drawing details for charts * * @throws WriterException diff --git a/tests/PhpSpreadsheetTests/CalculationTest.php b/tests/PhpSpreadsheetTests/Calculation/CalculationTest.php similarity index 92% rename from tests/PhpSpreadsheetTests/CalculationTest.php rename to tests/PhpSpreadsheetTests/Calculation/CalculationTest.php index 3d89b9a0..c53ebc82 100644 --- a/tests/PhpSpreadsheetTests/CalculationTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/CalculationTest.php @@ -1,8 +1,8 @@ setLocale('en_us'); + } + /** * @dataProvider providerBinaryComparisonOperation * diff --git a/tests/PhpSpreadsheetTests/Calculation/MathTrigTest.php b/tests/PhpSpreadsheetTests/Calculation/MathTrigTest.php index 818ed11d..6bc5d6e3 100644 --- a/tests/PhpSpreadsheetTests/Calculation/MathTrigTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/MathTrigTest.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig; use PHPUnit_Framework_TestCase; diff --git a/tests/PhpSpreadsheetTests/Calculation/TextDataTest.php b/tests/PhpSpreadsheetTests/Calculation/TextDataTest.php index 84188689..21e67d6a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/TextDataTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/TextDataTest.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Calculation\TextData; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; diff --git a/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php b/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php index f189d1ff..109590f5 100644 --- a/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php +++ b/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php @@ -2,13 +2,13 @@ namespace PhpOffice\PhpSpreadsheetTests\Cell; -use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Collection\Cells; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit_Framework_TestCase; class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase diff --git a/tests/PhpSpreadsheetTests/CellTest.php b/tests/PhpSpreadsheetTests/Cell/CellTest.php similarity index 99% rename from tests/PhpSpreadsheetTests/CellTest.php rename to tests/PhpSpreadsheetTests/Cell/CellTest.php index 9708981c..a10f24c7 100644 --- a/tests/PhpSpreadsheetTests/CellTest.php +++ b/tests/PhpSpreadsheetTests/Cell/CellTest.php @@ -1,8 +1,8 @@ getSheetCount()); $firstSheet = $spreadsheet->getSheet(0); - self::assertInstanceOf('PhpOffice\PhpSpreadsheet\Worksheet', $firstSheet); + self::assertInstanceOf('PhpOffice\PhpSpreadsheet\Worksheet\Worksheet', $firstSheet); $secondSheet = $spreadsheet->getSheet(1); - self::assertInstanceOf('PhpOffice\PhpSpreadsheet\Worksheet', $secondSheet); + self::assertInstanceOf('PhpOffice\PhpSpreadsheet\Worksheet\Worksheet', $secondSheet); } public function testReadValueAndComments() diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php index 637358e5..1553c430 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php @@ -3,9 +3,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Worksheet; use PhpOffice\PhpSpreadsheet\Collection\Cells; -use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter; use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit_Framework_TestCase; class AutoFilterTest extends PHPUnit_Framework_TestCase @@ -148,7 +148,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase self::assertInstanceOf(AutoFilter::class, $result); $result = $this->testAutoFilterObject->getColumns(); - // Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column + // Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column // objects for each column we set indexed by the column ID self::assertInternalType('array', $result); self::assertCount(1, $result); @@ -176,7 +176,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase self::assertInstanceOf(AutoFilter::class, $result); $result = $this->testAutoFilterObject->getColumns(); - // Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column + // Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column // objects for each column we set indexed by the column ID self::assertInternalType('array', $result); self::assertCount(1, $result); @@ -211,7 +211,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase } $result = $this->testAutoFilterObject->getColumns(); - // Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column + // Result should be an array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column // objects for each column we set indexed by the column ID self::assertInternalType('array', $result); self::assertCount(count($columnIndexes), $result); @@ -230,7 +230,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase } // If we request a specific column by its column ID, we should - // get a \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column object returned + // get a \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column object returned foreach ($columnIndexes as $columnIndex) { $result = $this->testAutoFilterObject->getColumn($columnIndex); self::assertInstanceOf(Column::class, $result); @@ -246,7 +246,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase ]; // If we request a specific column by its offset, we should - // get a \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column object returned + // get a \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column object returned foreach ($columnIndexes as $columnIndex => $columnID) { $result = $this->testAutoFilterObject->getColumnByOffset($columnIndex); self::assertInstanceOf(Column::class, $result); @@ -257,7 +257,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase public function testGetColumnIfNotSet() { // If we request a specific column by its column ID, we should - // get a \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column object returned + // get a \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter\Column object returned $result = $this->testAutoFilterObject->getColumn('K'); self::assertInstanceOf(Column::class, $result); } diff --git a/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php index 7698b4c0..9cd58b58 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php @@ -2,9 +2,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Worksheet; -use PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit_Framework_TestCase; class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase diff --git a/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php index 0736fb16..e7cc9580 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php @@ -2,9 +2,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Worksheet; -use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Column; use PhpOffice\PhpSpreadsheet\Worksheet\ColumnIterator; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit_Framework_TestCase; class ColumnIteratorTest extends PHPUnit_Framework_TestCase diff --git a/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php index 2b42138b..7a74efc8 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php @@ -2,9 +2,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Worksheet; -use PhpOffice\PhpSpreadsheet\Cell; -use PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit_Framework_TestCase; class RowCellIteratorTest extends PHPUnit_Framework_TestCase diff --git a/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php index 629f66e0..7a758ea5 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php @@ -2,9 +2,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Worksheet; -use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Row; use PhpOffice\PhpSpreadsheet\Worksheet\RowIterator; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit_Framework_TestCase; class RowIteratorTest extends PHPUnit_Framework_TestCase diff --git a/tests/PhpSpreadsheetTests/Worksheet/WorksheetColumnTest.php b/tests/PhpSpreadsheetTests/Worksheet/WorksheetColumnTest.php index 56514fa5..ea47cd64 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/WorksheetColumnTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/WorksheetColumnTest.php @@ -2,9 +2,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Worksheet; -use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Column; use PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit_Framework_TestCase; class WorksheetColumnTest extends PHPUnit_Framework_TestCase diff --git a/tests/PhpSpreadsheetTests/Worksheet/WorksheetRowTest.php b/tests/PhpSpreadsheetTests/Worksheet/WorksheetRowTest.php index e81f821e..cec755b6 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/WorksheetRowTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/WorksheetRowTest.php @@ -2,9 +2,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Worksheet; -use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Row; use PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PHPUnit_Framework_TestCase; class WorksheetRowTest extends PHPUnit_Framework_TestCase diff --git a/tests/PhpSpreadsheetTests/WorksheetTest.php b/tests/PhpSpreadsheetTests/Worksheet/WorksheetTest.php similarity index 97% rename from tests/PhpSpreadsheetTests/WorksheetTest.php rename to tests/PhpSpreadsheetTests/Worksheet/WorksheetTest.php index 5605fc81..f02189fe 100644 --- a/tests/PhpSpreadsheetTests/WorksheetTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/WorksheetTest.php @@ -1,9 +1,9 @@