From ed087dd396a42da9c8deca6095c7e6c2b2815b75 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Wed, 3 Jun 2015 08:21:50 +0100 Subject: [PATCH] More namespacing work --- src/PhpSpreadsheet/Calculation.php | 6 +- src/PhpSpreadsheet/Calculation/Categories.php | 14 ++-- src/PhpSpreadsheet/Calculation/DateTime.php | 2 +- src/PhpSpreadsheet/Calculation/TextData.php | 2 +- src/PhpSpreadsheet/IOFactory.php | 8 +- src/PhpSpreadsheet/Reader/CSV.php | 8 +- src/PhpSpreadsheet/Reader/Excel2003XML.php | 2 +- src/PhpSpreadsheet/Reader/Excel2007.php | 2 +- src/PhpSpreadsheet/Reader/Excel5.php | 2 +- src/PhpSpreadsheet/Reader/OOCalc.php | 12 +-- src/PhpSpreadsheet/Reader/SYLK.php | 12 +-- src/PhpSpreadsheet/Writer/CSV.php | 4 +- src/PhpSpreadsheet/Writer/Excel2007.php | 73 ++++++++++--------- .../Writer/Excel2007/StringTable.php | 6 +- .../Writer/Excel2007/WriterPart.php | 24 +++--- src/PhpSpreadsheet/Writer/PDF/Core.php | 4 +- src/PhpSpreadsheet/Writer/PDF/DomPDF.php | 6 +- src/PhpSpreadsheet/Writer/PDF/mPDF.php | 4 +- src/PhpSpreadsheet/Writer/PDF/tcPDF.php | 4 +- 19 files changed, 101 insertions(+), 94 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index 32577143..d649d23b 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -2102,7 +2102,7 @@ class Calculation * Get an instance of this class * * @access public - * @param PHPExcel $spreadsheet Injected spreadsheet for working with a PHPExcel object, + * @param Spreadsheet $spreadsheet Injected spreadsheet for working with a PHPExcel Spreadsheet object, * or NULL to create a standalone claculation engine * @return Calculation */ @@ -2126,9 +2126,9 @@ class Calculation * Unset an instance of this class * * @access public - * @param PHPExcel $spreadsheet Injected spreadsheet identifying the instance to unset + * @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset */ - public static function unsetInstance(PHPExcel $spreadsheet = null) + public static function unsetInstance(Spreadsheet $spreadsheet = null) { if ($spreadsheet !== null) { if (isset(self::$spreadsheetSets[$spreadsheet->getID()])) { diff --git a/src/PhpSpreadsheet/Calculation/Categories.php b/src/PhpSpreadsheet/Calculation/Categories.php index 57766207..8fe2b4db 100644 --- a/src/PhpSpreadsheet/Calculation/Categories.php +++ b/src/PhpSpreadsheet/Calculation/Categories.php @@ -50,14 +50,14 @@ class Categories private $category; /** - * Excel name + * Excel function name * * @var string */ private $excelName; /** - * PHPExcel name + * PHPExcel function name * * @var string */ @@ -67,7 +67,7 @@ class Categories * Create a new Categories * @param string $pCategory Category (represented by CATEGORY_*) * @param string $pExcelName Excel function name - * @param string $pPHPExcelName PHPExcel function mapping + * @param string $pPHPExcelName PHPExcel internal function name * @throws Exception */ public function __construct($pCategory = null, $pExcelName = null, $pPHPExcelName = null) @@ -108,7 +108,7 @@ class Categories } /** - * Get Excel name + * Get Excel function name * * @return string */ @@ -118,7 +118,7 @@ class Categories } /** - * Set Excel name + * Set Excel function name * * @param string $value */ @@ -128,7 +128,7 @@ class Categories } /** - * Get PHPExcel name + * Get PHPExcel function name * * @return string */ @@ -138,7 +138,7 @@ class Categories } /** - * Set PHPExcel name + * Set PHPExcel function name * * @param string $value */ diff --git a/src/PhpSpreadsheet/Calculation/DateTime.php b/src/PhpSpreadsheet/Calculation/DateTime.php index c2d38600..291a982a 100644 --- a/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/src/PhpSpreadsheet/Calculation/DateTime.php @@ -430,7 +430,7 @@ class DateTime case Functions::RETURNDATE_EXCEL: $date = 0; $calendar = \PHPExcel\Shared\Date::getExcelCalendar(); - if ($calendar != PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900) { + if ($calendar != \PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900) { $date = 1; } return (float) \PHPExcel\Shared\Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); diff --git a/src/PhpSpreadsheet/Calculation/TextData.php b/src/PhpSpreadsheet/Calculation/TextData.php index f8102738..9e29391b 100644 --- a/src/PhpSpreadsheet/Calculation/TextData.php +++ b/src/PhpSpreadsheet/Calculation/TextData.php @@ -593,7 +593,7 @@ class TextData $value = Functions::flattenSingleValue($value); $format = Functions::flattenSingleValue($format); - if ((is_string($value)) && (!is_numeric($value)) && PHPExcel\Shared\Date::isDateTimeFormatCode($format)) { + if ((is_string($value)) && (!is_numeric($value)) && \PHPExcel\Shared\Date::isDateTimeFormatCode($format)) { $value = DateTime::DATEVALUE($value); } diff --git a/src/PhpSpreadsheet/IOFactory.php b/src/PhpSpreadsheet/IOFactory.php index 2fbce12b..a5aaafbd 100644 --- a/src/PhpSpreadsheet/IOFactory.php +++ b/src/PhpSpreadsheet/IOFactory.php @@ -114,12 +114,12 @@ class IOFactory * * @static * @access public - * @param PHPExcel $phpExcel + * @param Spreadsheet $phpExcel * @param string $writerType Example: Excel2007 * @return Writer\IWriter * @throws Writer\Exception */ - public static function createWriter(PHPExcel $phpExcel, $writerType = '') + public static function createWriter(Spreadsheet $phpExcel, $writerType = '') { // Search type $searchType = 'IWriter'; @@ -171,12 +171,12 @@ class IOFactory } /** - * Loads PHPExcel from file using automatic Reader\IReader resolution + * Loads Spreadsheet from file using automatic Reader\IReader resolution * * @static * @access public * @param string $pFilename The name of the spreadsheet file - * @return PHPExcel + * @return Spreadsheet * @throws Reader\Exception */ public static function load($pFilename) diff --git a/src/PhpSpreadsheet/Reader/CSV.php b/src/PhpSpreadsheet/Reader/CSV.php index 33a1e00c..937feee0 100644 --- a/src/PhpSpreadsheet/Reader/CSV.php +++ b/src/PhpSpreadsheet/Reader/CSV.php @@ -194,16 +194,16 @@ class CSV extends BaseReader implements IReader } /** - * Loads PHPExcel from file + * Loads Spreadsheet from file * * @param string $pFilename - * @return PHPExcel + * @return \PHPExcel\Spreadsheet * @throws Exception */ public function load($pFilename) { - // Create new PHPExcel - $objPHPExcel = new PHPExcel(); + // Create new Spreadsheet + $objPHPExcel = new \PHPExcel\Spreadsheet(); // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); diff --git a/src/PhpSpreadsheet/Reader/Excel2003XML.php b/src/PhpSpreadsheet/Reader/Excel2003XML.php index f57478e4..8ba1c0f6 100644 --- a/src/PhpSpreadsheet/Reader/Excel2003XML.php +++ b/src/PhpSpreadsheet/Reader/Excel2003XML.php @@ -218,7 +218,7 @@ class Excel2003XML extends BaseReader implements IReader * Loads PHPExcel from file * * @param string $pFilename - * @return Spreadsheet + * @return \PHPExcel\Spreadsheet * @throws Exception */ public function load($pFilename) diff --git a/src/PhpSpreadsheet/Reader/Excel2007.php b/src/PhpSpreadsheet/Reader/Excel2007.php index d690abb7..74376c8d 100644 --- a/src/PhpSpreadsheet/Reader/Excel2007.php +++ b/src/PhpSpreadsheet/Reader/Excel2007.php @@ -364,7 +364,7 @@ class Excel2007 extends BaseReader implements IReader } // Initialisations - $excel = new Spreadsheet; + $excel = new \PHPExcel\Spreadsheet; $excel->removeSheetByIndex(0); if (!$this->readDataOnly) { $excel->removeCellStyleXfByIndex(0); // remove the default style diff --git a/src/PhpSpreadsheet/Reader/Excel5.php b/src/PhpSpreadsheet/Reader/Excel5.php index 54f67eaa..7243a717 100644 --- a/src/PhpSpreadsheet/Reader/Excel5.php +++ b/src/PhpSpreadsheet/Reader/Excel5.php @@ -195,7 +195,7 @@ class Excel5 extends BaseReader implements IReader /** * Workbook to be returned by the reader. * - * @var Spreadsheet + * @var \PHPExcel\Spreadsheet */ private $phpExcel; diff --git a/src/PhpSpreadsheet/Reader/OOCalc.php b/src/PhpSpreadsheet/Reader/OOCalc.php index 12080507..81a827d1 100644 --- a/src/PhpSpreadsheet/Reader/OOCalc.php +++ b/src/PhpSpreadsheet/Reader/OOCalc.php @@ -290,13 +290,13 @@ class OOCalc extends BaseReader implements IReader * Loads PHPExcel from file * * @param string $pFilename - * @return Spreadsheet + * @return \PHPExcel\Spreadsheet * @throws Exception */ public function load($pFilename) { - // Create new PHPExcel - $objPHPExcel = new PHPExcel(); + // Create new Spreadsheet + $objPHPExcel = new \PHPExcel\Spreadsheet(); // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); @@ -318,8 +318,8 @@ class OOCalc extends BaseReader implements IReader * Loads PHPExcel from file into PHPExcel instance * * @param string $pFilename - * @param Spreadsheet $objPHPExcel - * @return Spreadsheet + * @param \PHPExcel\Spreadsheet $objPHPExcel + * @return \PHPExcel\Spreadsheet * @throws Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) @@ -330,7 +330,7 @@ class OOCalc extends BaseReader implements IReader } $timezoneObj = new DateTimeZone('Europe/London'); - $GMT = new DateTimeZone('UTC'); + $GMT = new \DateTimeZone('UTC'); $zipClass = \PHPExcel\Settings::getZipClass(); diff --git a/src/PhpSpreadsheet/Reader/SYLK.php b/src/PhpSpreadsheet/Reader/SYLK.php index a28f2d53..126a3650 100644 --- a/src/PhpSpreadsheet/Reader/SYLK.php +++ b/src/PhpSpreadsheet/Reader/SYLK.php @@ -184,13 +184,13 @@ class SYLK extends BaseReader implements IReader * Loads PHPExcel from file * * @param string $pFilename - * @return Spreadsheet + * @return \PHPExcel\Spreadsheet * @throws Exception */ public function load($pFilename) { - // Create new PHPExcel - $objPHPExcel = new Spreadsheet(); + // Create new Spreadsheet + $objPHPExcel = new \PHPExcel\Spreadsheet(); // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); @@ -200,11 +200,11 @@ class SYLK extends BaseReader implements IReader * Loads PHPExcel from file into PHPExcel instance * * @param string $pFilename - * @param Spreadsheet $objPHPExcel - * @return Spreadsheet + * @param \PHPExcel\Spreadsheet $objPHPExcel + * @return \PHPExcel\Spreadsheet * @throws Exception */ - public function loadIntoExisting($pFilename, Spreadsheet $objPHPExcel) + public function loadIntoExisting($pFilename, \PHPExcel\Spreadsheet $objPHPExcel) { // Open file $this->openFile($pFilename); diff --git a/src/PhpSpreadsheet/Writer/CSV.php b/src/PhpSpreadsheet/Writer/CSV.php index e4dad06c..3bcee0ca 100644 --- a/src/PhpSpreadsheet/Writer/CSV.php +++ b/src/PhpSpreadsheet/Writer/CSV.php @@ -81,9 +81,9 @@ class CSV extends BaseWriter implements IWriter /** * Create a new CSV * - * @param Spreadsheet $phpExcel Spreadsheet object + * @param \PHPExcel\Spreadsheet $phpExcel Spreadsheet object */ - public function __construct(Spreadsheet $phpExcel) + public function __construct(\PHPExcel\Spreadsheet $phpExcel) { $this->phpExcel = $phpExcel; } diff --git a/src/PhpSpreadsheet/Writer/Excel2007.php b/src/PhpSpreadsheet/Writer/Excel2007.php index 8f2eaa00..f1469e04 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007.php +++ b/src/PhpSpreadsheet/Writer/Excel2007.php @@ -1,5 +1,7 @@ setPHPExcel($pPHPExcel); - $writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable', - 'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes', - 'docprops' => 'PHPExcel_Writer_Excel2007_DocProps', - 'rels' => 'PHPExcel_Writer_Excel2007_Rels', - 'theme' => 'PHPExcel_Writer_Excel2007_Theme', - 'style' => 'PHPExcel_Writer_Excel2007_Style', - 'workbook' => 'PHPExcel_Writer_Excel2007_Workbook', - 'worksheet' => 'PHPExcel_Writer_Excel2007_Worksheet', - 'drawing' => 'PHPExcel_Writer_Excel2007_Drawing', - 'comments' => 'PHPExcel_Writer_Excel2007_Comments', - 'chart' => 'PHPExcel_Writer_Excel2007_Chart', - 'relsvba' => 'PHPExcel_Writer_Excel2007_RelsVBA', - 'relsribbonobjects' => 'PHPExcel_Writer_Excel2007_RelsRibbon' - ); + $writerPartsArray = [ + 'stringtable' => '\\PHPExcel\\Writer\\Excel2007\\StringTable', + 'contenttypes' => '\\PHPExcel\\Writer\\Excel2007\\ContentTypes', + 'docprops' => '\\PHPExcel\\Writer\\Excel2007\\DocProps', + 'rels' => '\\PHPExcel\\Writer\\Excel2007\\Rels', + 'theme' => '\\PHPExcel\\Writer\\Excel2007\\Theme', + 'style' => '\\PHPExcel\\Writer\\Excel2007\\Style', + 'workbook' => '\\PHPExcel\\Writer\\Excel2007\\Workbook', + 'worksheet' => '\\PHPExcel\\Writer\\Excel2007\\Worksheet', + 'drawing' => '\\PHPExcel\\Writer\\Excel2007\\Drawing', + 'comments' => '\\PHPExcel\\Writer\\Excel2007\\Comments', + 'chart' => '\\PHPExcel\\Writer\\Excel2007\\Chart', + 'relsvba' => '\\PHPExcel\\Writer\\Excel2007\\RelsVBA', + 'relsribbonobjects' => '\\PHPExcel\\Writer\\Excel2007\\RelsRibbon' + ]; // Initialise writer parts // and Assign their parent IWriters @@ -419,11 +422,11 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE /** * Set PHPExcel object * - * @param PHPExcel $pPHPExcel PHPExcel object - * @throws PHPExcel_Writer_Exception - * @return PHPExcel_Writer_Excel2007 + * @param \PHPExcel\Spreadsheet $pPHPExcel PHPExcel object + * @throws Exception + * @return Excel2007 */ - public function setPHPExcel(PHPExcel $pPHPExcel = null) + public function setPHPExcel(\PHPExcel\Spreadsheet $pPHPExcel = null) { $this->spreadSheet = $pPHPExcel; return $this; diff --git a/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php b/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php index fccec669..d1ce0ae5 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php @@ -1,5 +1,7 @@ parentWriter = $pWriter; } @@ -48,25 +50,25 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart /** * Get parent IWriter object * - * @return PHPExcel_Writer_IWriter - * @throws PHPExcel_Writer_Exception + * @return \PHPExcel\Writer\IWriter + * @throws \PHPExcel\Writer\Exception */ public function getParentWriter() { if (!is_null($this->parentWriter)) { return $this->parentWriter; } else { - throw new PHPExcel_Writer_Exception("No parent PHPExcel_Writer_IWriter assigned."); + throw new \PHPExcel\Writer\Exception("No parent \PHPExcel\Writer\IWriter assigned."); } } /** * Set parent IWriter object * - * @param PHPExcel_Writer_IWriter $pWriter - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Writer\IWriter $pWriter + * @throws \PHPExcel\Writer\Exception */ - public function __construct(PHPExcel_Writer_IWriter $pWriter = null) + public function __construct(\PHPExcel\Writer\IWriter $pWriter = null) { if (!is_null($pWriter)) { $this->parentWriter = $pWriter; diff --git a/src/PhpSpreadsheet/Writer/PDF/Core.php b/src/PhpSpreadsheet/Writer/PDF/Core.php index 71a614f1..5a96bcf1 100644 --- a/src/PhpSpreadsheet/Writer/PDF/Core.php +++ b/src/PhpSpreadsheet/Writer/PDF/Core.php @@ -208,9 +208,9 @@ abstract class Core extends \PHPExcel\Writer\HTML /** * Create a new PDF Writer instance * - * @param Spreadsheet $phpExcel Spreadsheet object + * @param \PHPExcel\Spreadsheet $phpExcel Spreadsheet object */ - public function __construct(Spreadsheet $phpExcel) + public function __construct(\PHPExcel\Spreadsheet $phpExcel) { parent::__construct($phpExcel); $this->setUseInlineCss(true); diff --git a/src/PhpSpreadsheet/Writer/PDF/DomPDF.php b/src/PhpSpreadsheet/Writer/PDF/DomPDF.php index 1e02cb0e..fffde763 100644 --- a/src/PhpSpreadsheet/Writer/PDF/DomPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/DomPDF.php @@ -40,9 +40,9 @@ class DomPDF extends Core implements \PHPExcel\Writer\IWriter /** * Create a new DomPDF Writer instance * - * @param Spreadsheet $phpExcel Spreadsheet object + * @param \PHPExcel\Spreadsheet $phpExcel Spreadsheet object */ - public function __construct(Spreadsheet $phpExcel) + public function __construct(\PHPExcel\Spreadsheet $phpExcel) { parent::__construct($phpExcel); } @@ -51,7 +51,7 @@ class DomPDF extends Core implements \PHPExcel\Writer\IWriter * Save Spreadsheet to file * * @param string $pFilename Name of the file to save as - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function save($pFilename = null) { diff --git a/src/PhpSpreadsheet/Writer/PDF/mPDF.php b/src/PhpSpreadsheet/Writer/PDF/mPDF.php index 0627fdd0..7ae5570b 100644 --- a/src/PhpSpreadsheet/Writer/PDF/mPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/mPDF.php @@ -40,9 +40,9 @@ class mPDF extends Core implements \PHPExcel\Writer\IWriter /** * Create a mPDF Writer instance * - * @param Spreadsheet $phpExcel Spreadsheet object + * @param \PHPExcel\Spreadsheet $phpExcel Spreadsheet object */ - public function __construct(Spreadsheet $phpExcel) + public function __construct(\PHPExcel\Spreadsheet $phpExcel) { parent::__construct($phpExcel); } diff --git a/src/PhpSpreadsheet/Writer/PDF/tcPDF.php b/src/PhpSpreadsheet/Writer/PDF/tcPDF.php index f5fc92a3..854cf1d7 100644 --- a/src/PhpSpreadsheet/Writer/PDF/tcPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/tcPDF.php @@ -41,9 +41,9 @@ class tcPDF extends Core implements \PHPExcel\Writer\IWriter /** * Create a new tcPDF Writer instance * - * @param Spreadsheet $phpExcel Spreadsheet object + * @param \PHPExcel\Spreadsheet $phpExcel Spreadsheet object */ - public function __construct(Spreadsheet $phpExcel) + public function __construct(\PHPExcel\Spreadsheet $phpExcel) { parent::__construct($phpExcel); }