From 004936e35abe6e0cfb8e325d58174f7703c49e78 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Sun, 17 May 2015 19:26:34 +0200 Subject: [PATCH] PSR2 Fixes --- unitTests/Classes/PHPExcel/AutoloaderTest.php | 4 +- .../PHPExcel/Calculation/DateTimeTest.php | 78 +++++++++---------- .../PHPExcel/Calculation/TextDataTest.php | 16 ++-- .../Classes/PHPExcel/Chart/LegendTest.php | 1 - .../Classes/PHPExcel/Shared/DateTest.php | 8 +- .../Worksheet/ColumnCellIteratorTest.php | 3 +- .../PHPExcel/Worksheet/ColumnIteratorTest.php | 2 +- .../Worksheet/RowCellIteratorTest.php | 2 +- unitTests/testDataFileIterator.php | 2 +- 9 files changed, 57 insertions(+), 59 deletions(-) diff --git a/unitTests/Classes/PHPExcel/AutoloaderTest.php b/unitTests/Classes/PHPExcel/AutoloaderTest.php index f53015c6..842d1797 100644 --- a/unitTests/Classes/PHPExcel/AutoloaderTest.php +++ b/unitTests/Classes/PHPExcel/AutoloaderTest.php @@ -45,10 +45,10 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase public function testAutoloadInstantiateSuccess() { - $result = new PHPExcel_Calculation_Function(1,2,3); + $result = new PHPExcel_Calculation_Function(1, 2, 3); // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type - $this->assertTrue(is_a($result,'PHPExcel_Calculation_Function')); + $this->assertTrue(is_a($result, 'PHPExcel_Calculation_Function')); } } diff --git a/unitTests/Classes/PHPExcel/Calculation/DateTimeTest.php b/unitTests/Classes/PHPExcel/Calculation/DateTimeTest.php index 8b28f2fa..fde43e56 100644 --- a/unitTests/Classes/PHPExcel/Calculation/DateTimeTest.php +++ b/unitTests/Classes/PHPExcel/Calculation/DateTimeTest.php @@ -23,7 +23,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATE'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -35,7 +35,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testDATEtoPHP() { PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); - $result = PHPExcel_Calculation_DateTime::DATE(2012,1,31); + $result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); $this->assertEquals(1327968000, $result, null, 1E-8); } @@ -43,30 +43,30 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testDATEtoPHPObject() { PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); - $result = PHPExcel_Calculation_DateTime::DATE(2012,1,31); + $result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type - $this->assertTrue(is_a($result,'DateTime')); + $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value - $this->assertEquals($result->format('d-M-Y'),'31-Jan-2012'); + $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012'); } public function testDATEwith1904Calendar() { PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); - $result = PHPExcel_Calculation_DateTime::DATE(1918,11,11); + $result = PHPExcel_Calculation_DateTime::DATE(1918, 11, 11); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); - $this->assertEquals($result,5428); + $this->assertEquals($result, 5428); } public function testDATEwith1904CalendarError() { PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); - $result = PHPExcel_Calculation_DateTime::DATE(1901,1,31); + $result = PHPExcel_Calculation_DateTime::DATE(1901, 1, 31); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); - $this->assertEquals($result,'#NUM!'); + $this->assertEquals($result, '#NUM!'); } /** @@ -76,7 +76,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEVALUE'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEVALUE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -101,9 +101,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type - $this->assertTrue(is_a($result,'DateTime')); + $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value - $this->assertEquals($result->format('d-M-Y'),'31-Jan-2012'); + $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012'); } /** @@ -113,7 +113,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEAR'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEAR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -129,7 +129,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MONTHOFYEAR'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MONTHOFYEAR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -145,7 +145,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WEEKOFYEAR'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WEEKOFYEAR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -161,7 +161,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFWEEK'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFWEEK'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -177,7 +177,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFMONTH'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFMONTH'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -193,7 +193,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIME'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIME'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -205,7 +205,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testTIMEtoPHP() { PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); - $result = PHPExcel_Calculation_DateTime::TIME(7,30,20); + $result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); $this->assertEquals(27020, $result, null, 1E-8); } @@ -213,14 +213,14 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testTIMEtoPHPObject() { PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); - $result = PHPExcel_Calculation_DateTime::TIME(7,30,20); + $result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type - $this->assertTrue(is_a($result,'DateTime')); + $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value - $this->assertEquals($result->format('H:i:s'),'07:30:20'); + $this->assertEquals($result->format('H:i:s'), '07:30:20'); } /** @@ -230,7 +230,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIMEVALUE'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIMEVALUE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -255,9 +255,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type - $this->assertTrue(is_a($result,'DateTime')); + $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value - $this->assertEquals($result->format('H:i:s'),'07:30:20'); + $this->assertEquals($result->format('H:i:s'), '07:30:20'); } /** @@ -267,7 +267,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','HOUROFDAY'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'HOUROFDAY'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -283,7 +283,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MINUTEOFHOUR'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MINUTEOFHOUR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -299,7 +299,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','SECONDOFMINUTE'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'SECONDOFMINUTE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -315,7 +315,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','NETWORKDAYS'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'NETWORKDAYS'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -331,7 +331,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WORKDAY'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WORKDAY'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -347,7 +347,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EDATE'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EDATE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -372,9 +372,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type - $this->assertTrue(is_a($result,'DateTime')); + $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value - $this->assertEquals($result->format('d-M-Y'),'26-Dec-2011'); + $this->assertEquals($result->format('d-M-Y'), '26-Dec-2011'); } /** @@ -384,7 +384,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EOMONTH'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EOMONTH'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -409,9 +409,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type - $this->assertTrue(is_a($result,'DateTime')); + $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value - $this->assertEquals($result->format('d-M-Y'),'31-Dec-2011'); + $this->assertEquals($result->format('d-M-Y'), '31-Dec-2011'); } /** @@ -421,7 +421,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEDIF'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEDIF'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -437,7 +437,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYS360'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYS360'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -453,7 +453,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEARFRAC'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEARFRAC'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } diff --git a/unitTests/Classes/PHPExcel/Calculation/TextDataTest.php b/unitTests/Classes/PHPExcel/Calculation/TextDataTest.php index 604c7a11..135d4b09 100644 --- a/unitTests/Classes/PHPExcel/Calculation/TextDataTest.php +++ b/unitTests/Classes/PHPExcel/Calculation/TextDataTest.php @@ -326,13 +326,13 @@ class TextDataTest extends PHPUnit_Framework_TestCase public function testTEXT() { // Enforce decimal and thousands separator values to UK/US, and currency code to USD - call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.'); - call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),','); - call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$'); + call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.'); + call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ','); + call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$'); $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TEXTFORMAT'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'TEXTFORMAT'), $args); $this->assertEquals($expectedResult, $result); } @@ -346,13 +346,13 @@ class TextDataTest extends PHPUnit_Framework_TestCase */ public function testVALUE() { - call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.'); - call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),' '); - call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$'); + call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.'); + call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ' '); + call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$'); $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','VALUE'), $args); + $result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'VALUE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } diff --git a/unitTests/Classes/PHPExcel/Chart/LegendTest.php b/unitTests/Classes/PHPExcel/Chart/LegendTest.php index 462fbdc9..b4df4119 100644 --- a/unitTests/Classes/PHPExcel/Chart/LegendTest.php +++ b/unitTests/Classes/PHPExcel/Chart/LegendTest.php @@ -129,5 +129,4 @@ class LegendTest extends PHPUnit_Framework_TestCase $result = $testInstance->getOverlay(); $this->assertEquals($OverlayValue, $result); } - } diff --git a/unitTests/Classes/PHPExcel/Shared/DateTest.php b/unitTests/Classes/PHPExcel/Shared/DateTest.php index 50049f6e..f0bf9198 100644 --- a/unitTests/Classes/PHPExcel/Shared/DateTest.php +++ b/unitTests/Classes/PHPExcel/Shared/DateTest.php @@ -47,9 +47,9 @@ class DateTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); if ($args[0] < 1) { - $expectedResult += gmmktime(0,0,0); + $expectedResult += gmmktime(0, 0, 0); } - $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args); + $result = call_user_func_array(array('PHPExcel_Shared_Date', 'ExcelToPHP'), $args); $this->assertEquals($expectedResult, $result); } @@ -113,7 +113,7 @@ class DateTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); if ($args[0] < 1) { - $expectedResult += gmmktime(0,0,0); + $expectedResult += gmmktime(0, 0, 0); } $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args); $this->assertEquals($expectedResult, $result); @@ -174,7 +174,7 @@ class DateTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); if ($args[0] < 1) { - $expectedResult += gmmktime(0,0,0); + $expectedResult += gmmktime(0, 0, 0); } $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args); $this->assertEquals($expectedResult, $result); diff --git a/unitTests/Classes/PHPExcel/Worksheet/ColumnCellIteratorTest.php b/unitTests/Classes/PHPExcel/Worksheet/ColumnCellIteratorTest.php index 49abcb04..869d086e 100644 --- a/unitTests/Classes/PHPExcel/Worksheet/ColumnCellIteratorTest.php +++ b/unitTests/Classes/PHPExcel/Worksheet/ColumnCellIteratorTest.php @@ -60,7 +60,7 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase $iterator->seek(4); $this->assertEquals($columnIndexResult, $iterator->key()); - for($i = 1; $i < $columnIndexResult-1; $i++) { + for ($i = 1; $i < $columnIndexResult-1; $i++) { $iterator->prev(); $this->assertEquals($columnIndexResult - $i, $iterator->key()); } @@ -83,5 +83,4 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator->prev(); } - } diff --git a/unitTests/Classes/PHPExcel/Worksheet/ColumnIteratorTest.php b/unitTests/Classes/PHPExcel/Worksheet/ColumnIteratorTest.php index f87a545f..e013210e 100644 --- a/unitTests/Classes/PHPExcel/Worksheet/ColumnIteratorTest.php +++ b/unitTests/Classes/PHPExcel/Worksheet/ColumnIteratorTest.php @@ -55,7 +55,7 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase public function testIteratorSeekAndPrev() { - $ranges = range('A','E'); + $ranges = range('A', 'E'); $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D'); $columnIndexResult = 'D'; $iterator->seek('D'); diff --git a/unitTests/Classes/PHPExcel/Worksheet/RowCellIteratorTest.php b/unitTests/Classes/PHPExcel/Worksheet/RowCellIteratorTest.php index d2d36499..ec60e90b 100644 --- a/unitTests/Classes/PHPExcel/Worksheet/RowCellIteratorTest.php +++ b/unitTests/Classes/PHPExcel/Worksheet/RowCellIteratorTest.php @@ -55,7 +55,7 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase public function testIteratorSeekAndPrev() { - $ranges = range('A','E'); + $ranges = range('A', 'E'); $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $RowCellIndexResult = 'D'; $iterator->seek('D'); diff --git a/unitTests/testDataFileIterator.php b/unitTests/testDataFileIterator.php index 69ff6edc..33f64bdb 100644 --- a/unitTests/testDataFileIterator.php +++ b/unitTests/testDataFileIterator.php @@ -97,7 +97,7 @@ class testDataFileIterator implements Iterator } elseif (($dataValue[0] == '"') && ($dataValue[strlen($dataValue)-1] == '"')) { $dataValue = substr($dataValue, 1, -1); } elseif (($dataValue[0] == '{') && ($dataValue[strlen($dataValue)-1] == '}')) { - $dataValue = explode(';',substr($dataValue, 1, -1)); + $dataValue = explode(';', substr($dataValue, 1, -1)); foreach ($dataValue as &$dataRow) { if (strpos($dataRow, '|') !== false) { $dataRow = explode('|', $dataRow);