Another chunk of namespacing work

This commit is contained in:
MarkBaker 2015-06-01 21:08:48 +01:00
parent ebca5d1a57
commit c86a72ac1a
12 changed files with 649 additions and 635 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,42 +39,42 @@ class Chart
/**
* Worksheet
*
* @var \PHPExcel\Worksheet
* @var Worksheet
*/
private $worksheet;
/**
* Chart Title
*
* @var PHPExcel_Chart_Title
* @var Chart\Title
*/
private $title;
/**
* Chart Legend
*
* @var PHPExcel_Chart_Legend
* @var Chart\Legend
*/
private $legend;
/**
* X-Axis Label
*
* @var PHPExcel_Chart_Title
* @var Chart\Title
*/
private $xAxisLabel;
/**
* Y-Axis Label
*
* @var PHPExcel_Chart_Title
* @var Chart\Title
*/
private $yAxisLabel;
/**
* Chart Plot Area
*
* @var PHPExcel_Chart_PlotArea
* @var Chart\PlotArea
*/
private $plotArea;
@ -95,28 +95,28 @@ class Chart
/**
* Chart Asix Y as
*
* @var PHPExcel_Chart_Axis
* @var Chart\Axis
*/
private $yAxis;
/**
* Chart Asix X as
*
* @var PHPExcel_Chart_Axis
* @var Chart\Axis
*/
private $xAxis;
/**
* Chart Major Gridlines as
*
* @var PHPExcel_Chart_GridLines
* @var Chart\GridLines
*/
private $majorGridlines;
/**
* Chart Minor Gridlines as
*
* @var PHPExcel_Chart_GridLines
* @var Chart\GridLines
*/
private $minorGridlines;
@ -169,9 +169,9 @@ class Chart
/**
* Create a new PHPExcel_Chart
* Create a new Chart
*/
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
public function __construct($name, Chart\Title $title = null, Chart\Legend $legend = null, Chart\PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', Chart\Title $xAxisLabel = null, Chart\Title $yAxisLabel = null, Chart\Axis $xAxis = null, Chart\Axis $yAxis = null, Chart\GridLines $majorGridlines = null, Chart\GridLines $minorGridlines = null)
{
$this->name = $name;
$this->title = $title;
@ -200,7 +200,7 @@ class Chart
/**
* Get Worksheet
*
* @return PHPExcel_Worksheet
* @return Worksheet
*/
public function getWorksheet()
{
@ -210,11 +210,11 @@ class Chart
/**
* Set Worksheet
*
* @param PHPExcel_Worksheet $pValue
* @throws PHPExcel_Chart_Exception
* @return PHPExcel_Chart
* @param Worksheet $pValue
* @throws Chart\Exception
* @return Chart
*/
public function setWorksheet(PHPExcel_Worksheet $pValue = null)
public function setWorksheet(Worksheet $pValue = null)
{
$this->worksheet = $pValue;
@ -224,7 +224,7 @@ class Chart
/**
* Get Title
*
* @return PHPExcel_Chart_Title
* @return Chart\Title
*/
public function getTitle()
{
@ -234,10 +234,10 @@ class Chart
/**
* Set Title
*
* @param PHPExcel_Chart_Title $title
* @return PHPExcel_Chart
* @param Chart\Title $title
* @return Chart
*/
public function setTitle(PHPExcel_Chart_Title $title)
public function setTitle(Chart\Title $title)
{
$this->title = $title;
@ -247,7 +247,7 @@ class Chart
/**
* Get Legend
*
* @return PHPExcel_Chart_Legend
* @return Chart\Legend
*/
public function getLegend()
{
@ -257,10 +257,10 @@ class Chart
/**
* Set Legend
*
* @param PHPExcel_Chart_Legend $legend
* @return PHPExcel_Chart
* @param Chart\Legend $legend
* @return Chart
*/
public function setLegend(PHPExcel_Chart_Legend $legend)
public function setLegend(Chart\Legend $legend)
{
$this->legend = $legend;
@ -270,7 +270,7 @@ class Chart
/**
* Get X-Axis Label
*
* @return PHPExcel_Chart_Title
* @return Chart\Title
*/
public function getXAxisLabel()
{
@ -280,10 +280,10 @@ class Chart
/**
* Set X-Axis Label
*
* @param PHPExcel_Chart_Title $label
* @return PHPExcel_Chart
* @param Chart\Title $label
* @return Chart
*/
public function setXAxisLabel(PHPExcel_Chart_Title $label)
public function setXAxisLabel(Chart\Title $label)
{
$this->xAxisLabel = $label;
@ -293,7 +293,7 @@ class Chart
/**
* Get Y-Axis Label
*
* @return PHPExcel_Chart_Title
* @return Chart\Title
*/
public function getYAxisLabel()
{
@ -303,10 +303,10 @@ class Chart
/**
* Set Y-Axis Label
*
* @param PHPExcel_Chart_Title $label
* @return PHPExcel_Chart
* @param Chart\Title $label
* @return Chart
*/
public function setYAxisLabel(PHPExcel_Chart_Title $label)
public function setYAxisLabel(Chart\Title $label)
{
$this->yAxisLabel = $label;
@ -316,7 +316,7 @@ class Chart
/**
* Get Plot Area
*
* @return PHPExcel_Chart_PlotArea
* @return Chart\PlotArea
*/
public function getPlotArea()
{
@ -337,7 +337,7 @@ class Chart
* Set Plot Visible Only
*
* @param boolean $plotVisibleOnly
* @return PHPExcel_Chart
* @return Chart
*/
public function setPlotVisibleOnly($plotVisibleOnly = true)
{
@ -360,7 +360,7 @@ class Chart
* Set Display Blanks as
*
* @param string $displayBlanksAs
* @return PHPExcel_Chart
* @return Chart
*/
public function setDisplayBlanksAs($displayBlanksAs = '0')
{
@ -371,7 +371,7 @@ class Chart
/**
* Get yAxis
*
* @return PHPExcel_Chart_Axis
* @return Chart\Axis
*/
public function getChartAxisY()
{
@ -379,13 +379,13 @@ class Chart
return $this->yAxis;
}
return new PHPExcel_Chart_Axis();
return new Chart\Axis();
}
/**
* Get xAxis
*
* @return PHPExcel_Chart_Axis
* @return Chart\Axis
*/
public function getChartAxisX()
{
@ -393,13 +393,13 @@ class Chart
return $this->xAxis;
}
return new PHPExcel_Chart_Axis();
return new Chart\Axis();
}
/**
* Get Major Gridlines
*
* @return PHPExcel_Chart_GridLines
* @return Chart\GridLines
*/
public function getMajorGridlines()
{
@ -407,13 +407,13 @@ class Chart
return $this->majorGridlines;
}
return new PHPExcel_Chart_GridLines();
return new Chart\GridLines();
}
/**
* Get Minor Gridlines
*
* @return PHPExcel_Chart_GridLines
* @return Chart\GridLines
*/
public function getMinorGridlines()
{
@ -421,7 +421,7 @@ class Chart
return $this->minorGridlines;
}
return new PHPExcel_Chart_GridLines();
return new Chart\GridLines();
}
@ -431,7 +431,7 @@ class Chart
* @param string $cell
* @param integer $xOffset
* @param integer $yOffset
* @return PHPExcel_Chart
* @return Chart
*/
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
{
@ -474,7 +474,7 @@ class Chart
* Set the Top Left cell position for the chart
*
* @param string $cell
* @return PHPExcel_Chart
* @return Chart
*/
public function setTopLeftCell($cell)
{
@ -488,7 +488,7 @@ class Chart
*
* @param integer $xOffset
* @param integer $yOffset
* @return PHPExcel_Chart
* @return Chart
*/
public function setTopLeftOffset($xOffset = null, $yOffset = null)
{
@ -545,7 +545,7 @@ class Chart
* @param string $cell
* @param integer $xOffset
* @param integer $yOffset
* @return PHPExcel_Chart
* @return Chart
*/
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
{
@ -596,7 +596,7 @@ class Chart
*
* @param integer $xOffset
* @param integer $yOffset
* @return PHPExcel_Chart
* @return Chart
*/
public function setBottomRightOffset($xOffset = null, $yOffset = null)
{
@ -657,21 +657,21 @@ class Chart
public function render($outputDestination = null)
{
$libraryName = PHPExcel_Settings::getChartRendererName();
$libraryName = Settings::getChartRendererName();
if (is_null($libraryName)) {
return false;
}
// Ensure that data series values are up-to-date before we render
$this->refresh();
$libraryPath = PHPExcel_Settings::getChartRendererPath();
$libraryPath = Settings::getChartRendererPath();
$includePath = str_replace('\\', '/', get_include_path());
$rendererPath = str_replace('\\', '/', $libraryPath);
if (strpos($rendererPath, $includePath) === false) {
set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
}
$rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName;
$rendererName = '\\PHPExcel\\Chart\\Renderer\\'.$libraryName;
$renderer = new $rendererName($this);
if ($outputDestination == 'php://output') {

View File

@ -39,7 +39,7 @@ class Comment implements IComparable
/**
* Rich text comment
*
* @var PHPExcel_RichText
* @var RichText
*/
private $text;
@ -81,7 +81,7 @@ class Comment implements IComparable
/**
* Comment fill color
*
* @var PHPExcel_Style_Color
* @var Style\Color
*/
private $fillColor;
@ -93,17 +93,17 @@ class Comment implements IComparable
private $alignment;
/**
* Create a new PHPExcel_Comment
* Create a new Comment
*
* @throws PHPExcel_Exception
* @throws Exception
*/
public function __construct()
{
// Initialise variables
$this->author = 'Author';
$this->text = new PHPExcel_RichText();
$this->fillColor = new PHPExcel_Style_Color('FFFFFFE1');
$this->alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
$this->text = new RichText();
$this->fillColor = new Style\Color('FFFFFFE1');
$this->alignment = Style\Alignment::HORIZONTAL_GENERAL;
}
/**
@ -120,7 +120,7 @@ class Comment implements IComparable
* Set Author
*
* @param string $pValue
* @return PHPExcel_Comment
* @return Comment
*/
public function setAuthor($pValue = '')
{
@ -131,7 +131,7 @@ class Comment implements IComparable
/**
* Get Rich text comment
*
* @return PHPExcel_RichText
* @return RichText
*/
public function getText()
{
@ -141,10 +141,10 @@ class Comment implements IComparable
/**
* Set Rich text comment
*
* @param PHPExcel_RichText $pValue
* @return PHPExcel_Comment
* @param RichText $pValue
* @return Comment
*/
public function setText(PHPExcel_RichText $pValue)
public function setText(RichText $pValue)
{
$this->text = $pValue;
return $this;
@ -164,7 +164,7 @@ class Comment implements IComparable
* Set comment width (CSS style, i.e. XXpx or YYpt)
*
* @param string $value
* @return PHPExcel_Comment
* @return Comment
*/
public function setWidth($value = '96pt')
{
@ -186,7 +186,7 @@ class Comment implements IComparable
* Set comment height (CSS style, i.e. XXpx or YYpt)
*
* @param string $value
* @return PHPExcel_Comment
* @return Comment
*/
public function setHeight($value = '55.5pt')
{
@ -208,7 +208,7 @@ class Comment implements IComparable
* Set left margin (CSS style, i.e. XXpx or YYpt)
*
* @param string $value
* @return PHPExcel_Comment
* @return Comment
*/
public function setMarginLeft($value = '59.25pt')
{
@ -230,7 +230,7 @@ class Comment implements IComparable
* Set top margin (CSS style, i.e. XXpx or YYpt)
*
* @param string $value
* @return PHPExcel_Comment
* @return Comment
*/
public function setMarginTop($value = '1.5pt')
{
@ -252,7 +252,7 @@ class Comment implements IComparable
* Set comment default visibility
*
* @param boolean $value
* @return PHPExcel_Comment
* @return Comment
*/
public function setVisible($value = false)
{
@ -263,7 +263,7 @@ class Comment implements IComparable
/**
* Get fill color
*
* @return PHPExcel_Style_Color
* @return Style\Color
*/
public function getFillColor()
{
@ -274,9 +274,9 @@ class Comment implements IComparable
* Set Alignment
*
* @param string $pValue
* @return PHPExcel_Comment
* @return Comment
*/
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
public function setAlignment($pValue = Style\Alignment::HORIZONTAL_GENERAL)
{
$this->alignment = $pValue;
return $this;

View File

@ -69,7 +69,7 @@ class HashTable
if ($pSource == null) {
return;
} elseif (!is_array($pSource)) {
throw new PHPExcel_Exception('Invalid array parameter passed.');
throw new Exception('Invalid array parameter passed.');
}
foreach ($pSource as $item) {
@ -80,10 +80,10 @@ class HashTable
/**
* Add HashTable item
*
* @param PHPExcel_IComparable $pSource Item to add
* @param IComparable $pSource Item to add
* @throws Exception
*/
public function add(PHPExcel_IComparable $pSource = null)
public function add(IComparable $pSource = null)
{
$hash = $pSource->getHashCode();
if (!isset($this->items[$hash])) {
@ -98,7 +98,7 @@ class HashTable
* @param IComparable $pSource Item to remove
* @throws Exception
*/
public function remove(PHPExcel_IComparable $pSource = null)
public function remove(IComparable $pSource = null)
{
$hash = $pSource->getHashCode();
if (isset($this->items[$hash])) {

View File

@ -37,8 +37,8 @@ class IOFactory
* @static
*/
private static $searchLocations = array(
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ),
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' )
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => '\\PHPExcel\\Writer\\{0}' ),
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => '\\PHPExcel\\Reader\\{0}' )
);
/**
@ -60,7 +60,7 @@ class IOFactory
);
/**
* Private constructor for PHPExcel_IOFactory
* Private constructor for IOFactory
*/
private function __construct()
{
@ -84,14 +84,14 @@ class IOFactory
* @static
* @access public
* @param array $value
* @throws PHPExcel_Reader_Exception
* @throws Reader\Exception
*/
public static function setSearchLocations($value)
{
if (is_array($value)) {
self::$searchLocations = $value;
} else {
throw new PHPExcel_Reader_Exception('Invalid parameter passed.');
throw new Reader\Exception('Invalid parameter passed.');
}
}
@ -102,7 +102,7 @@ class IOFactory
* @access public
* @param string $type Example: IWriter
* @param string $location Example: PHPExcel/Writer/{0}.php
* @param string $classname Example: PHPExcel_Writer_{0}
* @param string $classname Example: Writer\{0}
*/
public static function addSearchLocation($type = '', $location = '', $classname = '')
{
@ -110,14 +110,14 @@ class IOFactory
}
/**
* Create PHPExcel_Writer_IWriter
* Create Writer\IWriter
*
* @static
* @access public
* @param PHPExcel $phpExcel
* @param string $writerType Example: Excel2007
* @return PHPExcel_Writer_IWriter
* @throws PHPExcel_Reader_Exception
* @return Writer\IWriter
* @throws Writer\Exception
*/
public static function createWriter(PHPExcel $phpExcel, $writerType = '')
{
@ -137,17 +137,17 @@ class IOFactory
}
// Nothing found...
throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType");
throw new Writer\Exception("No $searchType found for type $writerType");
}
/**
* Create PHPExcel_Reader_IReader
* Create Reader\IReader
*
* @static
* @access public
* @param string $readerType Example: Excel2007
* @return PHPExcel_Reader_IReader
* @throws PHPExcel_Reader_Exception
* @return Reader\IReader
* @throws Reader\Exception
*/
public static function createReader($readerType = '')
{
@ -167,17 +167,17 @@ class IOFactory
}
// Nothing found...
throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType");
throw new Reader\Exception("No $searchType found for type $readerType");
}
/**
* Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution
* Loads PHPExcel from file using automatic Reader\IReader resolution
*
* @static
* @access public
* @param string $pFilename The name of the spreadsheet file
* @return PHPExcel
* @throws PHPExcel_Reader_Exception
* @throws Reader\Exception
*/
public static function load($pFilename)
{
@ -186,13 +186,13 @@ class IOFactory
}
/**
* Identify file type using automatic PHPExcel_Reader_IReader resolution
* Identify file type using automatic Reader\IReader resolution
*
* @static
* @access public
* @param string $pFilename The name of the spreadsheet file to identify
* @return string
* @throws PHPExcel_Reader_Exception
* @throws Reader\Exception
*/
public static function identify($pFilename)
{
@ -204,13 +204,13 @@ class IOFactory
}
/**
* Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution
* Create Reader\IReader for file using automatic Reader\IReader resolution
*
* @static
* @access public
* @param string $pFilename The name of the spreadsheet file
* @return PHPExcel_Reader_IReader
* @throws PHPExcel_Reader_Exception
* @return Reader\IReader
* @throws Reader\Exception
*/
public static function createReaderForFile($pFilename)
{
@ -277,6 +277,6 @@ class IOFactory
}
}
throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file');
throw new Reader\Exception('Unable to identify a reader for this file');
}
}

View File

@ -39,7 +39,7 @@ class NamedRange
/**
* Worksheet on which the named range can be resolved
*
* @var PHPExcel_Worksheet
* @var Worksheet
*/
private $worksheet;
@ -60,7 +60,7 @@ class NamedRange
/**
* Scope
*
* @var PHPExcel_Worksheet
* @var Worksheet
*/
private $scope;
@ -68,17 +68,17 @@ class NamedRange
* Create a new NamedRange
*
* @param string $pName
* @param PHPExcel_Worksheet $pWorksheet
* @param Worksheet $pWorksheet
* @param string $pRange
* @param bool $pLocalOnly
* @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
* @throws PHPExcel_Exception
* @param Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
* @throws Exception
*/
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
public function __construct($pName = null, Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
{
// Validate data
if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
throw new PHPExcel_Exception('Parameters can not be null.');
throw new Exception('Parameters can not be null.');
}
// Set local members
@ -103,7 +103,7 @@ class NamedRange
* Set name
*
* @param string $value
* @return PHPExcel_NamedRange
* @return NamedRange
*/
public function setName($value = null)
{
@ -123,7 +123,7 @@ class NamedRange
// New title
$newTitle = $this->name;
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle);
ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle);
}
return $this;
}
@ -131,7 +131,7 @@ class NamedRange
/**
* Get worksheet
*
* @return PHPExcel_Worksheet
* @return Worksheet
*/
public function getWorksheet()
{
@ -141,10 +141,10 @@ class NamedRange
/**
* Set worksheet
*
* @param PHPExcel_Worksheet $value
* @return PHPExcel_NamedRange
* @param Worksheet $value
* @return NamedRange
*/
public function setWorksheet(PHPExcel_Worksheet $value = null)
public function setWorksheet(Worksheet $value = null)
{
if ($value !== null) {
$this->worksheet = $value;
@ -166,7 +166,7 @@ class NamedRange
* Set range
*
* @param string $value
* @return PHPExcel_NamedRange
* @return NamedRange
*/
public function setRange($value = null)
{
@ -190,7 +190,7 @@ class NamedRange
* Set localOnly
*
* @param bool $value
* @return PHPExcel_NamedRange
* @return NamedRange
*/
public function setLocalOnly($value = false)
{
@ -202,7 +202,7 @@ class NamedRange
/**
* Get scope
*
* @return PHPExcel_Worksheet|null
* @return Worksheet|null
*/
public function getScope()
{
@ -212,10 +212,10 @@ class NamedRange
/**
* Set scope
*
* @param PHPExcel_Worksheet|null $value
* @return PHPExcel_NamedRange
* @param Worksheet|null $value
* @return NamedRange
*/
public function setScope(PHPExcel_Worksheet $value = null)
public function setScope(Worksheet $value = null)
{
$this->scope = $value;
$this->localOnly = ($value == null) ? false : true;
@ -226,10 +226,10 @@ class NamedRange
* Resolve a named range to a regular cell range
*
* @param string $pNamedRange Named range
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
* @return PHPExcel_NamedRange
* @param Worksheet|null $pSheet Scope. Use null for global scope
* @return NamedRange
*/
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet)
public static function resolveRange($pNamedRange = '', Worksheet $pSheet)
{
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
}

View File

@ -44,20 +44,20 @@ class Excel2003XML extends BaseReader implements IReader
protected $charSet = 'UTF-8';
/**
* Create a new PHPExcel_Reader_Excel2003XML
* Create a new Excel2003XML
*/
public function __construct()
{
$this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
$this->readFilter = new DefaultReadFilter();
}
/**
* Can the current PHPExcel_Reader_IReader read the file?
* Can the current IReader read the file?
*
* @param string $pFilename
* @return boolean
* @throws PHPExcel_Reader_Exception
* @throws Exception
*/
public function canRead($pFilename)
{
@ -108,21 +108,25 @@ class Excel2003XML extends BaseReader implements IReader
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
*
* @param string $pFilename
* @throws PHPExcel_Reader_Exception
* @throws Exception
*/
public function listWorksheetNames($pFilename)
{
// Check if file exists
if (!file_exists($pFilename)) {
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
}
if (!$this->canRead($pFilename)) {
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
}
$worksheetNames = array();
$xml = simplexml_load_string($this->securityScan(file_get_contents($pFilename)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
$xml = simplexml_load_string(
$this->securityScan(file_get_contents($pFilename)),
'SimpleXMLElement',
\PHPExcel\Settings::getLibXmlLoaderOptions()
);
$namespaces = $xml->getNamespaces(true);
$xml_ss = $xml->children($namespaces['ss']);
@ -139,18 +143,22 @@ class Excel2003XML extends BaseReader implements IReader
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
*
* @param string $pFilename
* @throws PHPExcel_Reader_Exception
* @throws Exception
*/
public function listWorksheetInfo($pFilename)
{
// Check if file exists
if (!file_exists($pFilename)) {
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
}
$worksheetInfo = array();
$xml = simplexml_load_string($this->securityScan(file_get_contents($pFilename)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
$xml = simplexml_load_string(
$this->securityScan(file_get_contents($pFilename)),
'SimpleXMLElement',
\PHPExcel\Settings::getLibXmlLoaderOptions()
);
$namespaces = $xml->getNamespaces(true);
$worksheetID = 1;
@ -195,7 +203,7 @@ class Excel2003XML extends BaseReader implements IReader
}
}
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
$tmpInfo['lastColumnLetter'] = \PHPExcel\Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
$tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
$worksheetInfo[] = $tmpInfo;
@ -210,8 +218,8 @@ class Excel2003XML extends BaseReader implements IReader
* Loads PHPExcel from file
*
* @param string $pFilename
* @return PHPExcel
* @throws PHPExcel_Reader_Exception
* @return Spreadsheet
* @throws Exception
*/
public function load($pFilename)
{
@ -273,7 +281,7 @@ class Excel2003XML extends BaseReader implements IReader
* @param string $pFilename
* @param PHPExcel $objPHPExcel
* @return PHPExcel
* @throws PHPExcel_Reader_Exception
* @throws Exception
*/
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
{
@ -281,25 +289,25 @@ class Excel2003XML extends BaseReader implements IReader
$toFormats = array('-', ' ');
$underlineStyles = array (
PHPExcel_Style_Font::UNDERLINE_NONE,
PHPExcel_Style_Font::UNDERLINE_DOUBLE,
PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING,
PHPExcel_Style_Font::UNDERLINE_SINGLE,
PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING
\PHPExcel\Style\Font::UNDERLINE_NONE,
\PHPExcel\Style\Font::UNDERLINE_DOUBLE,
\PHPExcel\Style\Font::UNDERLINE_DOUBLEACCOUNTING,
\PHPExcel\Style\Font::UNDERLINE_SINGLE,
\PHPExcel\Style\Font::UNDERLINE_SINGLEACCOUNTING
);
$verticalAlignmentStyles = array (
PHPExcel_Style_Alignment::VERTICAL_BOTTOM,
PHPExcel_Style_Alignment::VERTICAL_TOP,
PHPExcel_Style_Alignment::VERTICAL_CENTER,
PHPExcel_Style_Alignment::VERTICAL_JUSTIFY
\PHPExcel\Style\Alignment::VERTICAL_BOTTOM,
\PHPExcel\Style\Alignment::VERTICAL_TOP,
\PHPExcel\Style\Alignment::VERTICAL_CENTER,
\PHPExcel\Style\Alignment::VERTICAL_JUSTIFY
);
$horizontalAlignmentStyles = array (
PHPExcel_Style_Alignment::HORIZONTAL_GENERAL,
PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS,
PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY
\PHPExcel\Style\Alignment::HORIZONTAL_GENERAL,
\PHPExcel\Style\Alignment::HORIZONTAL_LEFT,
\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT,
\PHPExcel\Style\Alignment::HORIZONTAL_CENTER,
\PHPExcel\Style\Alignment::HORIZONTAL_CENTER_CONTINUOUS,
\PHPExcel\Style\Alignment::HORIZONTAL_JUSTIFY
);
$timezoneObj = new DateTimeZone('Europe/London');
@ -307,14 +315,18 @@ class Excel2003XML extends BaseReader implements IReader
// Check if file exists
if (!file_exists($pFilename)) {
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
}
if (!$this->canRead($pFilename)) {
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
}
$xml = simplexml_load_string($this->securityScan(file_get_contents($pFilename)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
$xml = simplexml_load_string(
$this->securityScan(file_get_contents($pFilename)),
'SimpleXMLElement',
\PHPExcel\Settings::getLibXmlLoaderOptions()
);
$namespaces = $xml->getNamespaces(true);
$docProps = $objPHPExcel->getProperties();
@ -362,27 +374,27 @@ class Excel2003XML extends BaseReader implements IReader
if (isset($xml->CustomDocumentProperties)) {
foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
$propertyAttributes = $propertyValue->attributes($namespaces['dt']);
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::hex2str', $propertyName);
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN;
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', '\\PHPExcel\\Reader\\Excel2003XML::hex2str', $propertyName);
$propertyType = \PHPExcel\Document\Properties::PROPERTY_TYPE_UNKNOWN;
switch ((string) $propertyAttributes) {
case 'string':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
$propertyType = \PHPExcel\Document\Properties::PROPERTY_TYPE_STRING;
$propertyValue = trim($propertyValue);
break;
case 'boolean':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
$propertyType = \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN;
$propertyValue = (bool) $propertyValue;
break;
case 'integer':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER;
$propertyType = \PHPExcel\Document\Properties::PROPERTY_TYPE_INTEGER;
$propertyValue = intval($propertyValue);
break;
case 'float':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
$propertyType = \PHPExcel\Document\Properties::PROPERTY_TYPE_FLOAT;
$propertyValue = floatval($propertyValue);
break;
case 'dateTime.tz':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
$propertyType = \PHPExcel\Document\Properties::PROPERTY_TYPE_DATE;
$propertyValue = strtotime(trim($propertyValue));
break;
}
@ -432,7 +444,7 @@ class Excel2003XML extends BaseReader implements IReader
// echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
switch ($borderStyleKey) {
case 'LineStyle':
$thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
$thisBorder['style'] = \PHPExcel\Style\Border::BORDER_MEDIUM;
// $thisBorder['style'] = $borderStyleValue;
break;
case 'Weight':
@ -547,7 +559,7 @@ class Excel2003XML extends BaseReader implements IReader
foreach ($worksheet->Table->Column as $columnData) {
$columnData_ss = $columnData->attributes($namespaces['ss']);
if (isset($columnData_ss['Index'])) {
$columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1);
$columnID = \PHPExcel\Cell::stringFromColumnIndex($columnData_ss['Index']-1);
}
if (isset($columnData_ss['Width'])) {
$columnWidth = $columnData_ss['Width'];
@ -573,7 +585,7 @@ class Excel2003XML extends BaseReader implements IReader
foreach ($rowData->Cell as $cell) {
$cell_ss = $cell->attributes($namespaces['ss']);
if (isset($cell_ss['Index'])) {
$columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1);
$columnID = \PHPExcel\Cell::stringFromColumnIndex($cell_ss['Index']-1);
}
$cellRange = $columnID.$rowID;
@ -587,7 +599,7 @@ class Excel2003XML extends BaseReader implements IReader
$columnTo = $columnID;
if (isset($cell_ss['MergeAcross'])) {
$additionalMergedCells += (int)$cell_ss['MergeAcross'];
$columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1);
$columnTo = \PHPExcel\Cell::stringFromColumnIndex(\PHPExcel\Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1);
}
$rowTo = $rowID;
if (isset($cell_ss['MergeDown'])) {
@ -610,7 +622,7 @@ class Excel2003XML extends BaseReader implements IReader
}
if (isset($cell->Data)) {
$cellValue = $cellData = $cell->Data;
$type = PHPExcel_Cell_DataType::TYPE_NULL;
$type = \PHPExcel\Cell_DataType::TYPE_NULL;
$cellData_ss = $cellData->attributes($namespaces['ss']);
if (isset($cellData_ss['Type'])) {
$cellDataType = $cellData_ss['Type'];
@ -626,33 +638,33 @@ class Excel2003XML extends BaseReader implements IReader
*/
case 'String':
$cellValue = self::convertStringEncoding($cellValue, $this->charSet);
$type = PHPExcel_Cell_DataType::TYPE_STRING;
$type = \PHPExcel\Cell\DataType::TYPE_STRING;
break;
case 'Number':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$type = \PHPExcel\Cell\DataType::TYPE_NUMERIC;
$cellValue = (float) $cellValue;
if (floor($cellValue) == $cellValue) {
$cellValue = (integer) $cellValue;
}
break;
case 'Boolean':
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
$type = \PHPExcel\Cell\DataType::TYPE_BOOL;
$cellValue = ($cellValue != 0);
break;
case 'DateTime':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue));
$type = \PHPExcel\Cell\DataType::TYPE_NUMERIC;
$cellValue = \PHPExcel\Shared\Date::PHPToExcel(strtotime($cellValue));
break;
case 'Error':
$type = PHPExcel_Cell_DataType::TYPE_ERROR;
$type = \PHPExcel\Cell\DataType::TYPE_ERROR;
break;
}
}
if ($hasCalculatedValue) {
// echo 'FORMULA<br />';
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
$type = \PHPExcel\Cell\DataType::TYPE_FORMULA;
$columnNumber = \PHPExcel\Cell::columnIndexFromString($columnID);
if (substr($cellDataFormula, 0, 3) == 'of:') {
$cellDataFormula = substr($cellDataFormula, 3);
// echo 'Before: ', $cellDataFormula,'<br />';
@ -698,7 +710,7 @@ class Excel2003XML extends BaseReader implements IReader
if ($columnReference{0} == '[') {
$columnReference = $columnNumber + trim($columnReference, '[]');
}
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
$A1CellReference = \PHPExcel\Cell::stringFromColumnIndex($columnReference-1).$rowReference;
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
}
}
@ -781,7 +793,7 @@ class Excel2003XML extends BaseReader implements IReader
protected static function convertStringEncoding($string, $charset)
{
if ($charset != 'UTF-8') {
return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $charset);
return \PHPExcel\Shared\String::ConvertEncoding($string, 'UTF-8', $charset);
}
return $string;
}
@ -789,7 +801,7 @@ class Excel2003XML extends BaseReader implements IReader
protected function parseRichText($is = '')
{
$value = new PHPExcel_RichText();
$value = new \PHPExcel\RichText();
$value->createText(self::convertStringEncoding($is, $this->charSet));

View File

@ -419,8 +419,8 @@ class Excel2007 extends BaseReader implements IReader
$cellDataOfficeChildren = $xmlProperty->children('http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
$attributeType = $cellDataOfficeChildren->getName();
$attributeValue = (string) $cellDataOfficeChildren->{$attributeType};
$attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue, $attributeType);
$attributeType = PHPExcel_DocumentProperties::convertPropertyType($attributeType);
$attributeValue = \PHPExcel\Document\Properties::convertProperty($attributeValue, $attributeType);
$attributeType = \PHPExcel\Document\Properties::convertPropertyType($attributeType);
$docProps->setCustomProperty($propertyName, $attributeValue, $attributeType);
}
}

View File

@ -1,5 +1,7 @@
<?php
namespace PHPExcel\Reader\Excel5;
/**
* PHPExcel_Reader_Excel5_RC4
*
@ -25,7 +27,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Reader_Excel5_RC4
class RC4
{
// Context
protected $s = array();

View File

@ -383,26 +383,26 @@ class OOCalc extends BaseReader implements IReader
$docProps->setCreated($creationDate);
break;
case 'user-defined':
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
$propertyValueType = \PHPExcel\Document\Properties::PROPERTY_TYPE_STRING;
foreach ($propertyValueAttributes as $key => $value) {
if ($key == 'name') {
$propertyValueName = (string) $value;
} elseif ($key == 'value-type') {
switch ($value) {
case 'date':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'date');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
$propertyValue = \PHPExcel\Document\Properties::convertProperty($propertyValue, 'date');
$propertyValueType = \PHPExcel\Document\Properties::PROPERTY_TYPE_DATE;
break;
case 'boolean':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'bool');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
$propertyValue = \PHPExcel\Document\Properties::convertProperty($propertyValue, 'bool');
$propertyValueType = \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN;
break;
case 'float':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'r4');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
$propertyValue = \PHPExcel\Document\Properties::convertProperty($propertyValue, 'r4');
$propertyValueType = \PHPExcel\Document\Properties::PROPERTY_TYPE_FLOAT;
break;
default:
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
$propertyValueType = \PHPExcel\Document\Properties::PROPERTY_TYPE_STRING;
}
}
}

View File

@ -31,8 +31,8 @@ class Settings
{
/** constants */
/** Available Zip library classes */
const PCLZIP = 'PHPExcel_Shared_ZipArchive';
const ZIPARCHIVE = 'ZipArchive';
const PCLZIP = '\\PHPExcel\\Shared\\ZipArchive';
const ZIPARCHIVE = '\\ZipArchive';
/** Optional Chart Rendering libraries */
const CHART_RENDERER_JPGRAPH = 'jpgraph';
@ -108,7 +108,7 @@ class Settings
* Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive)
*
* @param string $zipClass The Zip handler class that PHPExcel should use for Zip file management
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
* e.g. \PHPExcel\Settings::PCLZip or \PHPExcel\Settings::ZipArchive
* @return boolean Success or failure
*/
public static function setZipClass($zipClass)
@ -128,7 +128,7 @@ class Settings
*
* @return string Name of the Zip handler Class that PHPExcel is configured to use
* for Zip file management
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
* e.g. \PHPExcel\Settings::PCLZip or \PHPExcel\Settings::ZipArchive
*/
public static function getZipClass()
{
@ -143,7 +143,7 @@ class Settings
*/
public static function getCacheStorageMethod()
{
return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod();
return CachedObjectStorageFactory::getCacheStorageMethod();
}
@ -154,7 +154,7 @@ class Settings
*/
public static function getCacheStorageClass()
{
return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass();
return CachedObjectStorageFactory::getCacheStorageClass();
}
@ -165,9 +165,9 @@ class Settings
* @param array $arguments Optional configuration arguments for the cacheing method
* @return boolean Success or failure
*/
public static function setCacheStorageMethod($method = PHPExcel_CachedObjectStorageFactory::cache_in_memory, $arguments = array())
public static function setCacheStorageMethod($method = CachedObjectStorageFactory::cache_in_memory, $arguments = array())
{
return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments);
return CachedObjectStorageFactory::initialize($method, $arguments);
}
@ -179,7 +179,7 @@ class Settings
*/
public static function setLocale($locale = 'en_us')
{
return PHPExcel_Calculation::getInstance()->setLocale($locale);
return Calculation::getInstance()->setLocale($locale);
}
@ -187,7 +187,7 @@ class Settings
* Set details of the external library that PHPExcel should use for rendering charts
*
* @param string $libraryName Internal reference name of the library
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
* e.g. \PHPExcel\Settings::CHART_RENDERER_JPGRAPH
* @param string $libraryBaseDir Directory path to the library's base folder
*
* @return boolean Success or failure
@ -205,7 +205,7 @@ class Settings
* Identify to PHPExcel the external library to use for rendering charts
*
* @param string $libraryName Internal reference name of the library
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
* e.g. \PHPExcel\Settings::CHART_RENDERER_JPGRAPH
*
* @return boolean Success or failure
*/
@ -242,7 +242,7 @@ class Settings
*
* @return string|NULL Internal reference name of the Chart Rendering Library that PHPExcel is
* currently configured to use
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
* e.g. \PHPExcel\Settings::CHART_RENDERER_JPGRAPH
*/
public static function getChartRendererName()
{
@ -266,9 +266,9 @@ class Settings
* Set details of the external library that PHPExcel should use for rendering PDF files
*
* @param string $libraryName Internal reference name of the library
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
* or PHPExcel_Settings::PDF_RENDERER_MPDF
* e.g. \PHPExcel\Settings::PDF_RENDERER_TCPDF,
* \PHPExcel\Settings::PDF_RENDERER_DOMPDF
* or \PHPExcel\Settings::PDF_RENDERER_MPDF
* @param string $libraryBaseDir Directory path to the library's base folder
*
* @return boolean Success or failure
@ -286,9 +286,9 @@ class Settings
* Identify to PHPExcel the external library to use for rendering PDF files
*
* @param string $libraryName Internal reference name of the library
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
* or PHPExcel_Settings::PDF_RENDERER_MPDF
* e.g. \PHPExcel\Settings::PDF_RENDERER_TCPDF,
* \PHPExcel\Settings::PDF_RENDERER_DOMPDF
* or \PHPExcel\Settings::PDF_RENDERER_MPDF
*
* @return boolean Success or failure
*/
@ -325,9 +325,9 @@ class Settings
*
* @return string|NULL Internal reference name of the PDF Rendering Library that PHPExcel is
* currently configured to use
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
* or PHPExcel_Settings::PDF_RENDERER_MPDF
* e.g. \PHPExcel\Settings::PDF_RENDERER_TCPDF,
* \PHPExcel\Settings::PDF_RENDERER_DOMPDF
* or \PHPExcel\Settings::PDF_RENDERER_MPDF
*/
public static function getPdfRendererName()
{

View File

@ -39,14 +39,14 @@ class Spreadsheet
/**
* Document properties
*
* @var DocumentProperties
* @var Document\Properties
*/
private $properties;
/**
* Document security
*
* @var DocumentSecurity
* @var Document\Security
*/
private $security;
@ -424,7 +424,7 @@ class Spreadsheet
/**
* Get properties
*
* @return DocumentProperties
* @return Document\Properties
*/
public function getProperties()
{
@ -434,9 +434,9 @@ class Spreadsheet
/**
* Set properties
*
* @param DocumentProperties $pValue
* @param Document\Properties $pValue
*/
public function setProperties(DocumentProperties $pValue)
public function setProperties(Document\Properties $pValue)
{
$this->properties = $pValue;
}
@ -444,7 +444,7 @@ class Spreadsheet
/**
* Get security
*
* @return DocumentSecurity
* @return Document\Security
*/
public function getSecurity()
{
@ -454,9 +454,9 @@ class Spreadsheet
/**
* Set security
*
* @param DocumentSecurity $pValue
* @param Document\Security $pValue
*/
public function setSecurity(DocumentSecurity $pValue)
public function setSecurity(Document\Security $pValue)
{
$this->security = $pValue;
}