#401 : Support for namespaces

This commit is contained in:
Progi1984 2016-03-22 22:40:11 +01:00
parent 04cceaae2b
commit 727ab1ef34
20 changed files with 30 additions and 30 deletions

View File

@ -30,7 +30,7 @@ $inputFileName = './sampleData/example_1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
try {
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
} catch(PHPExcel_Reader_Exception $e) {
} catch(\PHPExcel\Reader\Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Reader;
/**
* PHPExcel_Reader_Exception
* \PHPExcel\Reader\Exception
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Shared;
/**
* PHPExcel_Shared_CodePage
* \PHPExcel\Shared\CodePage
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Shared;
/**
* PHPExcel_Shared_File
* \PHPExcel\Shared\File
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Shared;
/**
* PHPExcel_Shared_PasswordHasher
* \PHPExcel\Shared\PasswordHasher
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Style;
/**
* PHPExcel_Style_NumberFormat
* \PHPExcel\Style\NumberFormat
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -87,12 +87,12 @@ class RowIterator implements \Iterator
*
* @param integer $startRow The row number at which to start iterating
* @return RowIterator
* @throws PHPExcel_Exception
* @throws \PHPExcel\Exception
*/
public function resetStart($startRow = 1)
{
if ($startRow > $this->subject->getHighestRow()) {
throw new PHPExcel_Exception("Start row ({$startRow}) is beyond highest row ({$this->subject->getHighestRow()})");
throw new \PHPExcel\Exception("Start row ({$startRow}) is beyond highest row ({$this->subject->getHighestRow()})");
}
$this->startRow = $startRow;

View File

@ -179,7 +179,7 @@ class Excel2007 extends BaseWriter implements IWriter
// If $pFilename is php://output or php://stdout, make it a temporary file...
$originalFilename = $pFilename;
if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
$pFilename = @tempnam(PHPExcel_Shared_File::sysGetTempDir(), 'phpxltmp');
$pFilename = @tempnam(\PHPExcel\Shared\File::sysGetTempDir(), 'phpxltmp');
if ($pFilename == '') {
$pFilename = $originalFilename;
}

View File

@ -702,7 +702,7 @@ class HTML extends BaseWriter implements IWriter
if ($chart instanceof PHPExcel_Chart) {
$chartCoordinates = $chart->getTopLeftPosition();
if ($chartCoordinates['cell'] == $coordinates) {
$chartFileName = PHPExcel_Shared_File::sysGetTempDir().'/'.uniqid().'.png';
$chartFileName = \PHPExcel\Shared\File::sysGetTempDir().'/'.uniqid().'.png';
if (!$chart->render($chartFileName)) {
return;
}

View File

@ -100,7 +100,7 @@ class OpenDocument extends BaseWriter implements IWriter
// If $pFilename is php://output or php://stdout, make it a temporary file...
$originalFilename = $pFilename;
if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
$pFilename = @tempnam(PHPExcel_Shared_File::sysGetTempDir(), 'phpxltmp');
$pFilename = @tempnam(\PHPExcel\Shared\File::sysGetTempDir(), 'phpxltmp');
if ($pFilename == '') {
$pFilename = $originalFilename;
}

View File

@ -214,7 +214,7 @@ abstract class Core extends \PHPExcel\Writer\HTML
{
parent::__construct($phpExcel);
$this->setUseInlineCss(true);
$this->tempDir = PHPExcel_Shared_File::sysGetTempDir();
$this->tempDir = \PHPExcel\Shared\File::sysGetTempDir();
}
/**

View File

@ -6,11 +6,11 @@ class XEEValidatorTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider providerInvalidXML
* @expectedException PHPExcel_Reader_Exception
* @expectedException \PHPExcel\Reader\Exception
*/
public function testInvalidXML($filename)
{
$reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract');
$reader = $this->getMockForAbstractClass('\PHPExcel\Reader\BaseReader');
$expectedResult = 'FAILURE: Should throw an Exception rather than return a value';
$result = $reader->securityScanFile($filename);
$this->assertEquals($expectedResult, $result);
@ -30,7 +30,7 @@ class XEEValidatorTest extends \PHPUnit_Framework_TestCase
*/
public function testValidXML($filename, $expectedResult)
{
$reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract');
$reader = $this->getMockForAbstractClass('\PHPExcel\Reader\BaseReader');
$result = $reader->securityScanFile($filename);
$this->assertEquals($expectedResult, $result);
}

View File

@ -13,7 +13,7 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_CodePage','numberToName'), $args);
$result = call_user_func_array(array('\PHPExcel\Shared\CodePage','numberToName'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -26,7 +26,7 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
{
$invalidCodePage = 12345;
try {
$result = call_user_func(array('PHPExcel_Shared_CodePage','numberToName'), $invalidCodePage);
$result = call_user_func(array('\PHPExcel\Shared\CodePage','numberToName'), $invalidCodePage);
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
return;
@ -38,7 +38,7 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
{
$unsupportedCodePage = 720;
try {
$result = call_user_func(array('PHPExcel_Shared_CodePage','numberToName'), $unsupportedCodePage);
$result = call_user_func(array('\PHPExcel\Shared\CodePage','numberToName'), $unsupportedCodePage);
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
return;

View File

@ -10,7 +10,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
{
$expectedResult = false;
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$result = call_user_func(array('\PHPExcel\Shared\File','getUseUploadTempDirectory'));
$this->assertEquals($expectedResult, $result);
}
@ -22,9 +22,9 @@ class FileTest extends \PHPUnit_Framework_TestCase
);
foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
call_user_func(array('PHPExcel_Shared_File','setUseUploadTempDirectory'), $useUploadTempDirectoryValue);
call_user_func(array('\PHPExcel\Shared\File','setUseUploadTempDirectory'), $useUploadTempDirectoryValue);
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$result = call_user_func(array('\PHPExcel\Shared\File','getUseUploadTempDirectory'));
$this->assertEquals($useUploadTempDirectoryValue, $result);
}
}

View File

@ -13,7 +13,7 @@ class PasswordHasherTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_PasswordHasher','hashPassword'), $args);
$result = call_user_func_array(array('\PHPExcel\Shared\PasswordHasher','hashPassword'), $args);
$this->assertEquals($expectedResult, $result);
}

View File

@ -20,7 +20,7 @@ class NumberFormatDateTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Style_NumberFormat','toFormattedString'), $args);
$result = call_user_func_array(array('\PHPExcel\Style\NumberFormat','toFormattedString'), $args);
$this->assertEquals($expectedResult, $result);
}

View File

@ -20,7 +20,7 @@ class NumberFormatTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Style_NumberFormat','toFormattedString'), $args);
$result = call_user_func_array(array('\PHPExcel\Style\NumberFormat','toFormattedString'), $args);
$this->assertEquals($expectedResult, $result);
}

View File

@ -73,7 +73,7 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException PHPExcel_Exception
* @expectedException \PHPExcel\Exception
*/
public function testSetInvalidFilterTypeThrowsException()
{
@ -98,7 +98,7 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException PHPExcel_Exception
* @expectedException \PHPExcel\Exception
*/
public function testSetInvalidJoinThrowsException()
{

View File

@ -66,7 +66,7 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException PHPExcel_Exception
* @expectedException \PHPExcel\Exception
*/
public function testSeekOutOfRange()
{
@ -75,7 +75,7 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException PHPExcel_Exception
* @expectedException \PHPExcel\Exception
*/
public function testPrevOutOfRange()
{

View File

@ -64,7 +64,7 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException PHPExcel_Exception
* @expectedException \PHPExcel\Exception
*/
public function testSeekOutOfRange()
{
@ -73,7 +73,7 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException PHPExcel_Exception
* @expectedException \PHPExcel\Exception
*/
public function testPrevOutOfRange()
{