Complete a few more namespace renaming

This commit is contained in:
Adrien Crivelli 2016-08-25 11:43:27 +09:00
parent ba70544846
commit 942ad72d2a
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
15 changed files with 74 additions and 66 deletions

View File

@ -125,21 +125,21 @@ class Categories
} }
/** /**
* Get PhpSpreadsheet function name * Get Spreadsheet function name
* *
* @return string * @return string
*/ */
public function getPhpSpreadsheetName() public function getSpreadsheetName()
{ {
return $this->spreadsheetName; return $this->spreadsheetName;
} }
/** /**
* Set PhpSpreadsheet function name * Set Spreadsheet function name
* *
* @param string $value * @param string $value
*/ */
public function setPhpSpreadsheetName($value) public function setSpreadsheetName($value)
{ {
$this->spreadsheetName = $value; $this->spreadsheetName = $value;
} }

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Reader; namespace PhpSpreadsheet\Reader;
use PhpSpreadsheet\Spreadsheet;
/** /**
* Copyright (c) 2006 - 2016 PhpSpreadsheet * Copyright (c) 2006 - 2016 PhpSpreadsheet
* *
@ -100,7 +102,7 @@ class Excel2003XML extends BaseReader implements IReader
} }
/** /**
* Reads names of the worksheets from a file, without parsing the whole file to a PhpSpreadsheet object * Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object
* *
* @param string $pFilename * @param string $pFilename
* @throws Exception * @throws Exception
@ -208,7 +210,7 @@ class Excel2003XML extends BaseReader implements IReader
} }
/** /**
* Loads PhpSpreadsheet from file * Loads Spreadsheet from file
* *
* @param string $pFilename * @param string $pFilename
* @throws Exception * @throws Exception
@ -216,8 +218,8 @@ class Excel2003XML extends BaseReader implements IReader
*/ */
public function load($pFilename) public function load($pFilename)
{ {
// Create new PhpSpreadsheet // Create new Spreadsheet
$spreadsheet = new PhpSpreadsheet(); $spreadsheet = new Spreadsheet();
$spreadsheet->removeSheetByIndex(0); $spreadsheet->removeSheetByIndex(0);
// Load into this instance // Load into this instance
@ -273,7 +275,7 @@ class Excel2003XML extends BaseReader implements IReader
} }
/** /**
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance * Loads from file into Spreadsheet instance
* *
* @param string $pFilename * @param string $pFilename
* @param \PhpSpreadsheet\Spreadsheet $spreadsheet * @param \PhpSpreadsheet\Spreadsheet $spreadsheet
@ -371,7 +373,7 @@ class Excel2003XML extends BaseReader implements IReader
if (isset($xml->CustomDocumentProperties)) { if (isset($xml->CustomDocumentProperties)) {
foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
$propertyAttributes = $propertyValue->attributes($namespaces['dt']); $propertyAttributes = $propertyValue->attributes($namespaces['dt']);
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', '\\PhpSpreadsheet\\Reader\\Excel2003XML::hex2str', $propertyName); $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', ['self', 'hex2str'], $propertyName);
$propertyType = \PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_UNKNOWN; $propertyType = \PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_UNKNOWN;
switch ((string) $propertyAttributes) { switch ((string) $propertyAttributes) {
case 'string': case 'string':

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Reader; namespace PhpSpreadsheet\Reader;
use PhpSpreadsheet\Spreadsheet;
/** /**
* Copyright (c) 2006 - 2016 PhpSpreadsheet * Copyright (c) 2006 - 2016 PhpSpreadsheet
* *
@ -83,7 +85,7 @@ class Gnumeric extends BaseReader implements IReader
} }
/** /**
* Reads names of the worksheets from a file, without parsing the whole file to a PhpSpreadsheet object * Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object
* *
* @param string $pFilename * @param string $pFilename
* @throws Exception * @throws Exception
@ -178,30 +180,30 @@ class Gnumeric extends BaseReader implements IReader
} }
/** /**
* Loads PhpSpreadsheet from file * Loads Spreadsheet from file
* *
* @param string $pFilename * @param string $pFilename
* @throws Exception * @throws Exception
* @return PhpSpreadsheet * @return Spreadsheet
*/ */
public function load($pFilename) public function load($pFilename)
{ {
// Create new PhpSpreadsheet // Create new Spreadsheet
$spreadsheet = new PhpSpreadsheet(); $spreadsheet = new Spreadsheet();
// Load into this instance // Load into this instance
return $this->loadIntoExisting($pFilename, $spreadsheet); return $this->loadIntoExisting($pFilename, $spreadsheet);
} }
/** /**
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance * Loads from file into Spreadsheet instance
* *
* @param string $pFilename * @param string $pFilename
* @param \PhpSpreadsheet\Spreadsheet $spreadsheet * @param Spreadsheet $spreadsheet
* @throws Exception * @throws Exception
* @return PhpSpreadsheet * @return PhpSpreadsheet
*/ */
public function loadIntoExisting($pFilename, \PhpSpreadsheet\Spreadsheet $spreadsheet) public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
{ {
// Check if file exists // Check if file exists
if (!file_exists($pFilename)) { if (!file_exists($pFilename)) {

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Writer; namespace PhpSpreadsheet\Writer;
use PhpSpreadsheet\Spreadsheet;
/** /**
* PhpSpreadsheet\Writer\Excel2007 * PhpSpreadsheet\Writer\Excel2007
* *
@ -113,7 +115,7 @@ class Excel2007 extends BaseWriter implements IWriter
public function __construct(\PhpSpreadsheet\Spreadsheet $spreadsheet = null) public function __construct(\PhpSpreadsheet\Spreadsheet $spreadsheet = null)
{ {
// Assign PhpSpreadsheet // Assign PhpSpreadsheet
$this->setPhpSpreadsheet($spreadsheet); $this->setSpreadsheet($spreadsheet);
$writerPartsArray = [ $writerPartsArray = [
'stringtable' => '\\PhpSpreadsheet\\Writer\\Excel2007\\StringTable', 'stringtable' => '\\PhpSpreadsheet\\Writer\\Excel2007\\StringTable',
@ -397,28 +399,28 @@ class Excel2007 extends BaseWriter implements IWriter
} }
/** /**
* Get PhpSpreadsheet object * Get Spreadsheet object
* *
* @throws \PhpSpreadsheet\Writer\Exception * @throws \PhpSpreadsheet\Writer\Exception
* @return PhpSpreadsheet * @return Spreadsheet
*/ */
public function getPhpSpreadsheet() public function getSpreadsheet()
{ {
if ($this->spreadSheet !== null) { if ($this->spreadSheet !== null) {
return $this->spreadSheet; return $this->spreadSheet;
} else { } else {
throw new \PhpSpreadsheet\Writer\Exception('No PhpSpreadsheet object assigned.'); throw new \PhpSpreadsheet\Writer\Exception('No Spreadsheet object assigned.');
} }
} }
/** /**
* Set PhpSpreadsheet object * Set Spreadsheet object
* *
* @param \PhpSpreadsheet\Spreadsheet $spreadsheet PhpSpreadsheet object * @param \PhpSpreadsheet\Spreadsheet $spreadsheet PhpSpreadsheet object
* @throws Exception * @throws Exception
* @return Excel2007 * @return Excel2007
*/ */
public function setPhpSpreadsheet(\PhpSpreadsheet\Spreadsheet $spreadsheet = null) public function setSpreadsheet(Spreadsheet $spreadsheet = null)
{ {
$this->spreadSheet = $spreadsheet; $this->spreadSheet = $spreadsheet;

View File

@ -211,7 +211,7 @@ class Worksheet extends WriterPart
// Sheet selected? // Sheet selected?
$sheetSelected = false; $sheetSelected = false;
if ($this->getParentWriter()->getPhpSpreadsheet()->getIndex($pSheet) == $this->getParentWriter()->getPhpSpreadsheet()->getActiveSheetIndex()) { if ($this->getParentWriter()->getSpreadsheet()->getIndex($pSheet) == $this->getParentWriter()->getSpreadsheet()->getActiveSheetIndex()) {
$sheetSelected = true; $sheetSelected = true;
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Spreadsheet\Writer; namespace PhpSpreadsheet\Writer;
use Spreadsheet\Calculation; use Spreadsheet\Calculation;
use Spreadsheet\Shared\Font; use Spreadsheet\Shared\Font;

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Writer; namespace PhpSpreadsheet\Writer;
use PhpSpreadsheet\Spreadsheet;
/** /**
* Copyright (c) 2006 - 2015 PhpSpreadsheet * Copyright (c) 2006 - 2015 PhpSpreadsheet
* *
@ -47,7 +49,7 @@ class OpenDocument extends BaseWriter implements IWriter
*/ */
public function __construct(\PhpSpreadsheet\SpreadSheet $spreadsheet = null) public function __construct(\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
{ {
$this->setPhpSpreadsheet($spreadsheet); $this->setSpreadsheet($spreadsheet);
$writerPartsArray = [ $writerPartsArray = [
'content' => \PhpSpreadsheet\Writer\OpenDocument\Content::class, 'content' => \PhpSpreadsheet\Writer\OpenDocument\Content::class,
@ -160,12 +162,12 @@ class OpenDocument extends BaseWriter implements IWriter
} }
/** /**
* Get PhpSpreadsheet object * Get Spreadsheet object
* *
* @throws \PhpSpreadsheet\Writer\Exception * @throws \PhpSpreadsheet\Writer\Exception
* @return PhpSpreadsheet * @return Spreadsheet
*/ */
public function getPhpSpreadsheet() public function getSpreadsheet()
{ {
if ($this->spreadSheet !== null) { if ($this->spreadSheet !== null) {
return $this->spreadSheet; return $this->spreadSheet;
@ -181,7 +183,7 @@ class OpenDocument extends BaseWriter implements IWriter
* @throws \PhpSpreadsheet\Writer\Exception * @throws \PhpSpreadsheet\Writer\Exception
* @return Excel2007 * @return Excel2007
*/ */
public function setPhpSpreadsheet(\PhpSpreadsheet\SpreadSheet $spreadsheet = null) public function setSpreadsheet(\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
{ {
$this->spreadSheet = $spreadsheet; $this->spreadSheet = $spreadsheet;

View File

@ -47,7 +47,7 @@ class Content extends WriterPart
public function write(\PhpSpreadsheet\SpreadSheet $spreadsheet = null) public function write(\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
{ {
if (!$spreadsheet) { if (!$spreadsheet) {
$spreadsheet = $this->getParentWriter()->getPhpSpreadsheet(); /* @var $spreadsheet PhpSpreadsheet */ $spreadsheet = $this->getParentWriter()->getSpreadsheet(); /* @var $spreadsheet PhpSpreadsheet */
} }
$objWriter = null; $objWriter = null;
@ -119,7 +119,7 @@ class Content extends WriterPart
*/ */
private function writeSheets(\PhpSpreadsheet\Shared\XMLWriter $objWriter) private function writeSheets(\PhpSpreadsheet\Shared\XMLWriter $objWriter)
{ {
$spreadsheet = $this->getParentWriter()->getPhpSpreadsheet(); /* @var $spreadsheet PhpSpreadsheet */ $spreadsheet = $this->getParentWriter()->getSpreadsheet(); /* @var $spreadsheet PhpSpreadsheet */
$sheet_count = $spreadsheet->getSheetCount(); $sheet_count = $spreadsheet->getSheetCount();
for ($i = 0; $i < $sheet_count; ++$i) { for ($i = 0; $i < $sheet_count; ++$i) {

View File

@ -36,7 +36,7 @@ class Meta extends WriterPart
public function write(\PhpSpreadsheet\SpreadSheet $spreadsheet = null) public function write(\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
{ {
if (!$spreadsheet) { if (!$spreadsheet) {
$spreadsheet = $this->getParentWriter()->getPhpSpreadsheet(); $spreadsheet = $this->getParentWriter()->getSpreadsheet();
} }
$objWriter = null; $objWriter = null;

View File

@ -36,7 +36,7 @@ class MetaInf extends WriterPart
public function writeManifest(\PhpSpreadsheet\SpreadSheet $spreadsheet = null) public function writeManifest(\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
{ {
if (!$spreadsheet) { if (!$spreadsheet) {
$spreadsheet = $this->getParentWriter()->getPhpSpreadsheet(); $spreadsheet = $this->getParentWriter()->getSpreadsheet();
} }
$objWriter = null; $objWriter = null;

View File

@ -36,7 +36,7 @@ class Settings extends WriterPart
public function write(\PhpSpreadsheet\SpreadSheet $spreadsheet = null) public function write(\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
{ {
if (!$spreadsheet) { if (!$spreadsheet) {
$spreadsheet = $this->getParentWriter()->getPhpSpreadsheet(); $spreadsheet = $this->getParentWriter()->getSpreadsheet();
} }
$objWriter = null; $objWriter = null;

View File

@ -36,7 +36,7 @@ class Styles extends WriterPart
public function write(\PhpSpreadsheet\SpreadSheet $spreadsheet = null) public function write(\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
{ {
if (!$spreadsheet) { if (!$spreadsheet) {
$spreadsheet = $this->getParentWriter()->getPhpSpreadsheet(); $spreadsheet = $this->getParentWriter()->getSpreadsheet();
} }
$objWriter = null; $objWriter = null;

View File

@ -59,15 +59,15 @@ class DomPDF extends Core implements \PhpSpreadsheet\Writer\IWriter
// Check for paper size and page orientation // Check for paper size and page orientation
if (is_null($this->getSheetIndex())) { if (is_null($this->getSheetIndex())) {
$orientation = ($this->phpSpreadsheet->getSheet(0)->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation()
== \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->phpSpreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->phpSpreadsheet->getSheet(0)->getPageMargins(); $printMargins = $this->spreadsheet->getSheet(0)->getPageMargins();
} else { } else {
$orientation = ($this->phpSpreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
== \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->phpSpreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->phpSpreadsheet->getSheet($this->getSheetIndex())->getPageMargins(); $printMargins = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageMargins();
} }
$orientation = ($orientation == 'L') ? 'landscape' : 'portrait'; $orientation = ($orientation == 'L') ? 'landscape' : 'portrait';

View File

@ -59,15 +59,15 @@ class MPDF extends Core implements \PhpSpreadsheet\Writer\IWriter
// Check for paper size and page orientation // Check for paper size and page orientation
if (is_null($this->getSheetIndex())) { if (is_null($this->getSheetIndex())) {
$orientation = ($this->phpSpreadsheet->getSheet(0)->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation()
== \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->phpSpreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->phpSpreadsheet->getSheet(0)->getPageMargins(); $printMargins = $this->spreadsheet->getSheet(0)->getPageMargins();
} else { } else {
$orientation = ($this->phpSpreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
== \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->phpSpreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->phpSpreadsheet->getSheet($this->getSheetIndex())->getPageMargins(); $printMargins = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageMargins();
} }
$this->setOrientation($orientation); $this->setOrientation($orientation);
@ -96,11 +96,11 @@ class MPDF extends Core implements \PhpSpreadsheet\Writer\IWriter
$pdf->AddPage($orientation); $pdf->AddPage($orientation);
// Document info // Document info
$pdf->SetTitle($this->phpSpreadsheet->getProperties()->getTitle()); $pdf->SetTitle($this->spreadsheet->getProperties()->getTitle());
$pdf->SetAuthor($this->phpSpreadsheet->getProperties()->getCreator()); $pdf->SetAuthor($this->spreadsheet->getProperties()->getCreator());
$pdf->SetSubject($this->phpSpreadsheet->getProperties()->getSubject()); $pdf->SetSubject($this->spreadsheet->getProperties()->getSubject());
$pdf->SetKeywords($this->phpSpreadsheet->getProperties()->getKeywords()); $pdf->SetKeywords($this->spreadsheet->getProperties()->getKeywords());
$pdf->SetCreator($this->phpSpreadsheet->getProperties()->getCreator()); $pdf->SetCreator($this->spreadsheet->getProperties()->getCreator());
$pdf->WriteHTML( $pdf->WriteHTML(
$this->generateHTMLHeader(false) . $this->generateHTMLHeader(false) .

View File

@ -60,15 +60,15 @@ class TcPDF extends Core implements \PhpSpreadsheet\Writer\IWriter
// Check for paper size and page orientation // Check for paper size and page orientation
if (is_null($this->getSheetIndex())) { if (is_null($this->getSheetIndex())) {
$orientation = ($this->phpSpreadsheet->getSheet(0)->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation()
== \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->phpSpreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->phpSpreadsheet->getSheet(0)->getPageMargins(); $printMargins = $this->spreadsheet->getSheet(0)->getPageMargins();
} else { } else {
$orientation = ($this->phpSpreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
== \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->phpSpreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->phpSpreadsheet->getSheet($this->getSheetIndex())->getPageMargins(); $printMargins = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageMargins();
} }
// Override Page Orientation // Override Page Orientation
@ -107,11 +107,11 @@ class TcPDF extends Core implements \PhpSpreadsheet\Writer\IWriter
); );
// Document info // Document info
$pdf->SetTitle($this->phpSpreadsheet->getProperties()->getTitle()); $pdf->SetTitle($this->spreadsheet->getProperties()->getTitle());
$pdf->SetAuthor($this->phpSpreadsheet->getProperties()->getCreator()); $pdf->SetAuthor($this->spreadsheet->getProperties()->getCreator());
$pdf->SetSubject($this->phpSpreadsheet->getProperties()->getSubject()); $pdf->SetSubject($this->spreadsheet->getProperties()->getSubject());
$pdf->SetKeywords($this->phpSpreadsheet->getProperties()->getKeywords()); $pdf->SetKeywords($this->spreadsheet->getProperties()->getKeywords());
$pdf->SetCreator($this->phpSpreadsheet->getProperties()->getCreator()); $pdf->SetCreator($this->spreadsheet->getProperties()->getCreator());
// Write to file // Write to file
fwrite($fileHandle, $pdf->output($pFilename, 'S')); fwrite($fileHandle, $pdf->output($pFilename, 'S'));