From bd3285b4fa0c4900b72a7b4b5b7c7a1a24b3e7fb Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sun, 8 Oct 2017 14:37:11 +0900 Subject: [PATCH] Avoid underscore in property names --- docs/topics/reading-files.md | 26 +++--- ...Simple_file_reader_using_a_read_filter.php | 2 +- ...eader_using_a_configurable_read_filter.php | 18 ++-- ...a_configurable_read_filter_(version_1).php | 12 +-- ...a_configurable_read_filter_(version_2).php | 12 +-- ...ks_to_split_across_multiple_worksheets.php | 12 +-- src/PhpSpreadsheet/Cell.php | 20 ++--- src/PhpSpreadsheet/Reader/Xls.php | 8 +- src/PhpSpreadsheet/Shared/OLE/PPS/Root.php | 88 +++++++++---------- src/PhpSpreadsheet/Writer/Xlsx/Chart.php | 10 +-- .../Custom/ComplexAssert.php | 14 +-- 11 files changed, 111 insertions(+), 111 deletions(-) diff --git a/docs/topics/reading-files.md b/docs/topics/reading-files.md index 35ae7ed7..5b07a81d 100644 --- a/docs/topics/reading-files.md +++ b/docs/topics/reading-files.md @@ -289,21 +289,21 @@ useful: /** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */ class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - private $_startRow = 0; - private $_endRow = 0; - private $_columns = array(); + private $startRow = 0; + private $endRow = 0; + private $columns = array(); /** Get the list of rows and columns to read */ public function __construct($startRow, $endRow, $columns) { - $this->_startRow = $startRow; - $this->_endRow = $endRow; - $this->_columns = $columns; + $this->startRow = $startRow; + $this->endRow = $endRow; + $this->columns = $columns; } public function readCell($column, $row, $worksheetName = '') { // Only read the rows and columns that were configured - if ($row >= $this->_startRow && $row <= $this->_endRow) { - if (in_array($column,$this->_columns)) { + if ($row >= $this->startRow && $row <= $this->endRow) { + if (in_array($column,$this->columns)) { return true; } } @@ -331,18 +331,18 @@ $inputFileName = './sampleData/example2.xls'; /** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */ class ChunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - private $_startRow = 0; - private $_endRow = 0; + private $startRow = 0; + private $endRow = 0; /** Set the list of rows that we want to read */ public function setRows($startRow, $chunkSize) { - $this->_startRow = $startRow; - $this->_endRow = $startRow + $chunkSize; + $this->startRow = $startRow; + $this->endRow = $startRow + $chunkSize; } public function readCell($column, $row, $worksheetName = '') { // Only read the heading row, and the configured rows - if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) { + if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { return true; } return false; diff --git a/samples/Reader/09_Simple_file_reader_using_a_read_filter.php b/samples/Reader/09_Simple_file_reader_using_a_read_filter.php index 68100989..6e0eda14 100644 --- a/samples/Reader/09_Simple_file_reader_using_a_read_filter.php +++ b/samples/Reader/09_Simple_file_reader_using_a_read_filter.php @@ -1,6 +1,6 @@ _startRow = $startRow; - $this->_endRow = $endRow; - $this->_columns = $columns; + $this->startRow = $startRow; + $this->endRow = $endRow; + $this->columns = $columns; } public function readCell($column, $row, $worksheetName = '') { - if ($row >= $this->_startRow && $row <= $this->_endRow) { - if (in_array($column, $this->_columns)) { + if ($row >= $this->startRow && $row <= $this->endRow) { + if (in_array($column, $this->columns)) { return true; } } diff --git a/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php b/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php index 19961947..a7718aaa 100644 --- a/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php +++ b/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php @@ -1,6 +1,6 @@ _startRow = $startRow; - $this->_endRow = $startRow + $chunkSize; + $this->startRow = $startRow; + $this->endRow = $startRow + $chunkSize; } public function readCell($column, $row, $worksheetName = '') { // Only read the heading row, and the rows that were configured in the constructor - if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) { + if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { return true; } diff --git a/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php b/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php index d1b85c76..c8f99af0 100644 --- a/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php +++ b/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php @@ -1,6 +1,6 @@ _startRow = $startRow; - $this->_endRow = $startRow + $chunkSize; + $this->startRow = $startRow; + $this->endRow = $startRow + $chunkSize; } public function readCell($column, $row, $worksheetName = '') { // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow - if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) { + if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { return true; } diff --git a/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php b/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php index 80ece763..9915a097 100644 --- a/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php +++ b/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php @@ -1,6 +1,6 @@ _startRow = $startRow; - $this->_endRow = $startRow + $chunkSize; + $this->startRow = $startRow; + $this->endRow = $startRow + $chunkSize; } public function readCell($column, $row, $worksheetName = '') { // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow - if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) { + if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { return true; } diff --git a/src/PhpSpreadsheet/Cell.php b/src/PhpSpreadsheet/Cell.php index f709310c..235ec73d 100644 --- a/src/PhpSpreadsheet/Cell.php +++ b/src/PhpSpreadsheet/Cell.php @@ -803,15 +803,15 @@ class Cell // Using a lookup cache adds a slight memory overhead, but boosts speed // caching using a static within the method is faster than a class static, // though it's additional memory overhead - static $_indexCache = []; + static $indexCache = []; - if (isset($_indexCache[$pString])) { - return $_indexCache[$pString]; + if (isset($indexCache[$pString])) { + return $indexCache[$pString]; } // It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord() // and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant // memory overhead either - static $_columnLookup = [ + static $columnLookup = [ 'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13, 'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26, 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13, @@ -822,17 +822,17 @@ class Cell // for improved performance if (isset($pString[0])) { if (!isset($pString[1])) { - $_indexCache[$pString] = $_columnLookup[$pString]; + $indexCache[$pString] = $columnLookup[$pString]; - return $_indexCache[$pString]; + return $indexCache[$pString]; } elseif (!isset($pString[2])) { - $_indexCache[$pString] = $_columnLookup[$pString[0]] * 26 + $_columnLookup[$pString[1]]; + $indexCache[$pString] = $columnLookup[$pString[0]] * 26 + $columnLookup[$pString[1]]; - return $_indexCache[$pString]; + return $indexCache[$pString]; } elseif (!isset($pString[3])) { - $_indexCache[$pString] = $_columnLookup[$pString[0]] * 676 + $_columnLookup[$pString[1]] * 26 + $_columnLookup[$pString[2]]; + $indexCache[$pString] = $columnLookup[$pString[0]] * 676 + $columnLookup[$pString[1]] * 26 + $columnLookup[$pString[2]]; - return $_indexCache[$pString]; + return $indexCache[$pString]; } } diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index ad302188..0ab49287 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -404,7 +404,7 @@ class Xls extends BaseReader implements IReader /** * @var string */ - private $_baseCell; + private $baseCell; /** * Create a new Xls Reader instance. @@ -3968,14 +3968,14 @@ class Xls extends BaseReader implements IReader // get the base cell, grab tExp token $baseRow = self::getUInt2d($formulaStructure, 3); $baseCol = self::getUInt2d($formulaStructure, 5); - $this->_baseCell = Cell::stringFromColumnIndex($baseCol) . ($baseRow + 1); + $this->baseCell = Cell::stringFromColumnIndex($baseCol) . ($baseRow + 1); } // Read cell? if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { if ($isPartOfSharedFormula) { // formula is added to this cell after the sheet has been read - $this->sharedFormulaParts[$columnString . ($row + 1)] = $this->_baseCell; + $this->sharedFormulaParts[$columnString . ($row + 1)] = $this->baseCell; } // offset: 16: size: 4; not used @@ -4078,7 +4078,7 @@ class Xls extends BaseReader implements IReader $formula = substr($recordData, 8); // at this point we only store the shared formula for later use - $this->sharedFormulas[$this->_baseCell] = $formula; + $this->sharedFormulas[$this->baseCell] = $formula; } /** diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php index c0102890..14f56dca 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php @@ -43,22 +43,22 @@ class Root extends PPS /** * @var resource */ - private $_FILEH_; + private $fileHandle; /** * @var string */ - private $_tmp_filename; + private $tempFilename; /** * @var int */ - private $_SMALL_BLOCK_SIZE; + private $smallBlockSize; /** * @var int */ - private $_BIG_BLOCK_SIZE; + private $bigBlockSize; /** * @param int $time_1st A timestamp @@ -88,30 +88,30 @@ class Root extends PPS public function save($filename) { // Initial Setting for saving - $this->_BIG_BLOCK_SIZE = pow( + $this->bigBlockSize = pow( 2, - (isset($this->_BIG_BLOCK_SIZE)) ? self::adjust2($this->_BIG_BLOCK_SIZE) : 9 + (isset($this->bigBlockSize)) ? self::adjust2($this->bigBlockSize) : 9 ); - $this->_SMALL_BLOCK_SIZE = pow( + $this->smallBlockSize = pow( 2, - (isset($this->_SMALL_BLOCK_SIZE)) ? self::adjust2($this->_SMALL_BLOCK_SIZE) : 6 + (isset($this->smallBlockSize)) ? self::adjust2($this->smallBlockSize) : 6 ); if (is_resource($filename)) { - $this->_FILEH_ = $filename; + $this->fileHandle = $filename; } elseif ($filename == '-' || $filename == '') { if ($this->tempDirectory === null) { $this->tempDirectory = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir(); } - $this->_tmp_filename = tempnam($this->tempDirectory, 'OLE_PPS_Root'); - $this->_FILEH_ = fopen($this->_tmp_filename, 'w+b'); - if ($this->_FILEH_ == false) { + $this->tempFilename = tempnam($this->tempDirectory, 'OLE_PPS_Root'); + $this->fileHandle = fopen($this->tempFilename, 'w+b'); + if ($this->fileHandle == false) { throw new WriterException("Can't create temporary file."); } } else { - $this->_FILEH_ = fopen($filename, 'wb'); + $this->fileHandle = fopen($filename, 'wb'); } - if ($this->_FILEH_ == false) { + if ($this->fileHandle == false) { throw new WriterException("Can't open $filename. It may be in use or protected."); } // Make an array of PPS's (for Save) @@ -133,7 +133,7 @@ class Root extends PPS $this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt); if (!is_resource($filename)) { - fclose($this->_FILEH_); + fclose($this->fileHandle); } return true; @@ -157,21 +157,21 @@ class Root extends PPS if ($raList[$i]->Type == OLE::OLE_PPS_TYPE_FILE) { $raList[$i]->Size = $raList[$i]->getDataLen(); if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) { - $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) - + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0); + $iSBcnt += floor($raList[$i]->Size / $this->smallBlockSize) + + (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0); } else { - $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + - (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); + $iBBcnt += (floor($raList[$i]->Size / $this->bigBlockSize) + + (($raList[$i]->Size % $this->bigBlockSize) ? 1 : 0)); } } } - $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE; - $iSlCnt = floor($this->_BIG_BLOCK_SIZE / OLE::OLE_LONG_INT_SIZE); + $iSmallLen = $iSBcnt * $this->smallBlockSize; + $iSlCnt = floor($this->bigBlockSize / OLE::OLE_LONG_INT_SIZE); $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0); - $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) + - (($iSmallLen % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); + $iBBcnt += (floor($iSmallLen / $this->bigBlockSize) + + (($iSmallLen % $this->bigBlockSize) ? 1 : 0)); $iCnt = count($raList); - $iBdCnt = $this->_BIG_BLOCK_SIZE / OLE::OLE_PPS_SIZE; + $iBdCnt = $this->bigBlockSize / OLE::OLE_PPS_SIZE; $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0)); return [$iSBDcnt, $iBBcnt, $iPPScnt]; @@ -202,11 +202,11 @@ class Root extends PPS */ public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt) { - $FILE = $this->_FILEH_; + $FILE = $this->fileHandle; // Calculate Basic Setting - $iBlCnt = $this->_BIG_BLOCK_SIZE / OLE::OLE_LONG_INT_SIZE; - $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / OLE::OLE_LONG_INT_SIZE; + $iBlCnt = $this->bigBlockSize / OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->bigBlockSize - 0x4C) / OLE::OLE_LONG_INT_SIZE; $iBdExL = 0; $iAll = $iBBcnt + $iPPScnt + $iSBDcnt; @@ -281,7 +281,7 @@ class Root extends PPS */ public function _saveBigData($iStBlk, &$raList) { - $FILE = $this->_FILEH_; + $FILE = $this->fileHandle; // cycle through PPS's $iCount = count($raList); @@ -291,14 +291,14 @@ class Root extends PPS if (($raList[$i]->Size >= OLE::OLE_DATA_SIZE_SMALL) || (($raList[$i]->Type == OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) { fwrite($FILE, $raList[$i]->_data); - if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) { - fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE))); + if ($raList[$i]->Size % $this->bigBlockSize) { + fwrite($FILE, str_repeat("\x00", $this->bigBlockSize - ($raList[$i]->Size % $this->bigBlockSize))); } // Set For PPS $raList[$i]->startBlock = $iStBlk; $iStBlk += - (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + - (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); + (floor($raList[$i]->Size / $this->bigBlockSize) + + (($raList[$i]->Size % $this->bigBlockSize) ? 1 : 0)); } } } @@ -312,7 +312,7 @@ class Root extends PPS public function _makeSmallData(&$raList) { $sRes = ''; - $FILE = $this->_FILEH_; + $FILE = $this->fileHandle; $iSmBlk = 0; $iCount = count($raList); @@ -323,8 +323,8 @@ class Root extends PPS continue; } if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) { - $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) - + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0); + $iSmbCnt = floor($raList[$i]->Size / $this->smallBlockSize) + + (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0); // Add to SBD $jB = $iSmbCnt - 1; for ($j = 0; $j < $jB; ++$j) { @@ -334,8 +334,8 @@ class Root extends PPS // Add to Data String(this will be written for RootEntry) $sRes .= $raList[$i]->_data; - if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) { - $sRes .= str_repeat("\x00", $this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)); + if ($raList[$i]->Size % $this->smallBlockSize) { + $sRes .= str_repeat("\x00", $this->smallBlockSize - ($raList[$i]->Size % $this->smallBlockSize)); } // Set for PPS $raList[$i]->startBlock = $iSmBlk; @@ -343,7 +343,7 @@ class Root extends PPS } } } - $iSbCnt = floor($this->_BIG_BLOCK_SIZE / OLE::OLE_LONG_INT_SIZE); + $iSbCnt = floor($this->bigBlockSize / OLE::OLE_LONG_INT_SIZE); if ($iSmBlk % $iSbCnt) { $iB = $iSbCnt - ($iSmBlk % $iSbCnt); for ($i = 0; $i < $iB; ++$i) { @@ -364,13 +364,13 @@ class Root extends PPS // Save each PPS WK $iC = count($raList); for ($i = 0; $i < $iC; ++$i) { - fwrite($this->_FILEH_, $raList[$i]->_getPpsWk()); + fwrite($this->fileHandle, $raList[$i]->_getPpsWk()); } // Adjust for Block $iCnt = count($raList); - $iBCnt = $this->_BIG_BLOCK_SIZE / OLE::OLE_PPS_SIZE; + $iBCnt = $this->bigBlockSize / OLE::OLE_PPS_SIZE; if ($iCnt % $iBCnt) { - fwrite($this->_FILEH_, str_repeat("\x00", ($iBCnt - ($iCnt % $iBCnt)) * OLE::OLE_PPS_SIZE)); + fwrite($this->fileHandle, str_repeat("\x00", ($iBCnt - ($iCnt % $iBCnt)) * OLE::OLE_PPS_SIZE)); } } @@ -383,10 +383,10 @@ class Root extends PPS */ public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt) { - $FILE = $this->_FILEH_; + $FILE = $this->fileHandle; // Calculate Basic Setting - $iBbCnt = $this->_BIG_BLOCK_SIZE / OLE::OLE_LONG_INT_SIZE; - $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / OLE::OLE_LONG_INT_SIZE; + $iBbCnt = $this->bigBlockSize / OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->bigBlockSize - 0x4C) / OLE::OLE_LONG_INT_SIZE; $iBdExL = 0; $iAll = $iBsize + $iPpsCnt + $iSbdSize; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php index 11a74e5d..175059f9 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php @@ -21,7 +21,7 @@ class Chart extends WriterPart /** * @var int */ - private $_seriesIndex; + private $seriesIndex; /** * Write charts to XML format. @@ -220,7 +220,7 @@ class Chart extends WriterPart } $id1 = $id2 = 0; - $this->_seriesIndex = 0; + $this->seriesIndex = 0; $objWriter->startElement('c:plotArea'); $layout = $plotArea->getLayout(); @@ -1096,11 +1096,11 @@ class Chart extends WriterPart } $objWriter->startElement('c:idx'); - $objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesIdx); + $objWriter->writeAttribute('val', $this->seriesIndex + $plotSeriesIdx); $objWriter->endElement(); $objWriter->startElement('c:order'); - $objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef); + $objWriter->writeAttribute('val', $this->seriesIndex + $plotSeriesRef); $objWriter->endElement(); if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART)) { @@ -1218,7 +1218,7 @@ class Chart extends WriterPart $objWriter->endElement(); } - $this->_seriesIndex += $plotSeriesIdx + 1; + $this->seriesIndex += $plotSeriesIdx + 1; } /** diff --git a/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php b/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php index 9543a543..112d4336 100644 --- a/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php +++ b/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php @@ -4,7 +4,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Custom; class ComplexAssert { - private $_errorMessage = ''; + private $errorMessage = ''; public function assertComplexEquals($expected, $actual, $delta = 0) { @@ -13,7 +13,7 @@ class ComplexAssert if ($expected === $actual) { return true; } - $this->_errorMessage = 'Expected Error: ' . $actual . ' !== ' . $expected; + $this->errorMessage = 'Expected Error: ' . $actual . ' !== ' . $expected; return false; } @@ -23,7 +23,7 @@ class ComplexAssert if (!is_numeric($actualComplex->getReal()) || !is_numeric($expectedComplex->getReal())) { if ($actualComplex->getReal() !== $expectedComplex->getReal()) { - $this->_errorMessage = 'Mismatched String: ' . $actualComplex->getReal() . ' !== ' . $expectedComplex->getReal(); + $this->errorMessage = 'Mismatched String: ' . $actualComplex->getReal() . ' !== ' . $expectedComplex->getReal(); return false; } @@ -33,20 +33,20 @@ class ComplexAssert if ($actualComplex->getReal() < ($expectedComplex->getReal() - $delta) || $actualComplex->getReal() > ($expectedComplex->getReal() + $delta)) { - $this->_errorMessage = 'Mismatched Real part: ' . $actualComplex->getReal() . ' != ' . $expectedComplex->getReal(); + $this->errorMessage = 'Mismatched Real part: ' . $actualComplex->getReal() . ' != ' . $expectedComplex->getReal(); return false; } if ($actualComplex->getImaginary() < ($expectedComplex->getImaginary() - $delta) || $actualComplex->getImaginary() > ($expectedComplex->getImaginary() + $delta)) { - $this->_errorMessage = 'Mismatched Imaginary part: ' . $actualComplex->getImaginary() . ' != ' . $expectedComplex->getImaginary(); + $this->errorMessage = 'Mismatched Imaginary part: ' . $actualComplex->getImaginary() . ' != ' . $expectedComplex->getImaginary(); return false; } if ($actualComplex->getSuffix() !== $actualComplex->getSuffix()) { - $this->_errorMessage = 'Mismatched Suffix: ' . $actualComplex->getSuffix() . ' != ' . $expectedComplex->getSuffix(); + $this->errorMessage = 'Mismatched Suffix: ' . $actualComplex->getSuffix() . ' != ' . $expectedComplex->getSuffix(); return false; } @@ -56,6 +56,6 @@ class ComplexAssert public function getErrorMessage() { - return $this->_errorMessage; + return $this->errorMessage; } }