More fixes from PhpStorm warnings
This commit is contained in:
parent
1259549466
commit
483f3c98ff
|
@ -2037,14 +2037,6 @@ class Calculation
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Unset an instance of this class.
|
|
||||||
*/
|
|
||||||
public function __destruct()
|
|
||||||
{
|
|
||||||
$this->workbook = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush the calculation cache for any existing instance of this class
|
* Flush the calculation cache for any existing instance of this class
|
||||||
* but only if a Calculation instance exists.
|
* but only if a Calculation instance exists.
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Financial
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private static function isLastDayOfMonth($testDate)
|
private static function isLastDayOfMonth(\DateTime $testDate)
|
||||||
{
|
{
|
||||||
return $testDate->format('d') == $testDate->format('t');
|
return $testDate->format('d') == $testDate->format('t');
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@ class Statistical
|
||||||
$y = $x;
|
$y = $x;
|
||||||
if ($y > 0.0 && $y <= self::LOG_GAMMA_X_MAX_VALUE) {
|
if ($y > 0.0 && $y <= self::LOG_GAMMA_X_MAX_VALUE) {
|
||||||
if ($y <= self::EPS) {
|
if ($y <= self::EPS) {
|
||||||
$res = -log(y);
|
$res = -log($y);
|
||||||
} elseif ($y <= 1.5) {
|
} elseif ($y <= 1.5) {
|
||||||
// ---------------------
|
// ---------------------
|
||||||
// EPS .LT. X .LE. 1.5
|
// EPS .LT. X .LE. 1.5
|
||||||
|
|
|
@ -581,6 +581,9 @@ class Html
|
||||||
|
|
||||||
protected $stringData = '';
|
protected $stringData = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var RichText
|
||||||
|
*/
|
||||||
protected $richTextObject;
|
protected $richTextObject;
|
||||||
|
|
||||||
protected function initialise()
|
protected function initialise()
|
||||||
|
|
|
@ -7,9 +7,9 @@ class DefaultReadFilter implements IReadFilter
|
||||||
/**
|
/**
|
||||||
* Should this cell be read?
|
* Should this cell be read?
|
||||||
*
|
*
|
||||||
* @param $column Column address (as a string value like "A", or "IV")
|
* @param string $column Column address (as a string value like "A", or "IV")
|
||||||
* @param $row Row number
|
* @param int $row Row number
|
||||||
* @param $worksheetName Optional worksheet name
|
* @param string $worksheetName Optional worksheet name
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -238,7 +238,7 @@ class Html extends BaseReader implements IReader
|
||||||
return array_pop($this->nestedColumn);
|
return array_pop($this->nestedColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function flushCell($sheet, $column, $row, &$cellContent)
|
protected function flushCell(Worksheet $sheet, $column, $row, &$cellContent)
|
||||||
{
|
{
|
||||||
if (is_string($cellContent)) {
|
if (is_string($cellContent)) {
|
||||||
// Simple String content
|
// Simple String content
|
||||||
|
|
|
@ -485,7 +485,7 @@ class Slk extends BaseReader implements IReader
|
||||||
*
|
*
|
||||||
* @param int $pValue Sheet index
|
* @param int $pValue Sheet index
|
||||||
*
|
*
|
||||||
* @return SYLK
|
* @return Slk
|
||||||
*/
|
*/
|
||||||
public function setSheetIndex($pValue)
|
public function setSheetIndex($pValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,6 @@ use PhpOffice\PhpSpreadsheet\Style\Font;
|
||||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||||
use PhpOffice\PhpSpreadsheet\Style\Protection;
|
use PhpOffice\PhpSpreadsheet\Style\Protection;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing;
|
use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
|
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\SheetView;
|
use PhpOffice\PhpSpreadsheet\Worksheet\SheetView;
|
||||||
|
|
|
@ -83,7 +83,7 @@ class EigenvalueDecomposition
|
||||||
$i_ = $i - 1;
|
$i_ = $i - 1;
|
||||||
// Scale to avoid under/overflow.
|
// Scale to avoid under/overflow.
|
||||||
$h = $scale = 0.0;
|
$h = $scale = 0.0;
|
||||||
$scale += array_sum(array_map(abs, $this->d));
|
$scale += array_sum(array_map('abs', $this->d));
|
||||||
if ($scale == 0.0) {
|
if ($scale == 0.0) {
|
||||||
$this->e[$i] = $this->d[$i_];
|
$this->e[$i] = $this->d[$i_];
|
||||||
$this->d = array_slice($this->V[$i_], 0, $i_);
|
$this->d = array_slice($this->V[$i_], 0, $i_);
|
||||||
|
|
|
@ -541,7 +541,7 @@ class OLE
|
||||||
public static function OLE2LocalDate($string)
|
public static function OLE2LocalDate($string)
|
||||||
{
|
{
|
||||||
if (strlen($string) != 8) {
|
if (strlen($string) != 8) {
|
||||||
return new PEAR_Error('Expecting 8 byte string');
|
throw new ReaderException('Expecting 8 byte string');
|
||||||
}
|
}
|
||||||
|
|
||||||
// factor used for separating numbers into 4 bytes parts
|
// factor used for separating numbers into 4 bytes parts
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Root extends PPS
|
||||||
*/
|
*/
|
||||||
public function __construct($time_1st, $time_2nd, $raChild)
|
public function __construct($time_1st, $time_2nd, $raChild)
|
||||||
{
|
{
|
||||||
$this->_tempDir = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
|
$this->tempDirectory = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
|
||||||
|
|
||||||
parent::__construct(null, OLE::ascToUcs('Root Entry'), OLE::OLE_PPS_TYPE_ROOT, null, null, null, $time_1st, $time_2nd, null, $raChild);
|
parent::__construct(null, OLE::ascToUcs('Root Entry'), OLE::OLE_PPS_TYPE_ROOT, null, null, null, $time_1st, $time_2nd, null, $raChild);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,10 @@ class ExponentialBestFit extends BestFit
|
||||||
public function getSlope($dp = 0)
|
public function getSlope($dp = 0)
|
||||||
{
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
return round(exp($this->_slope), $dp);
|
return round(exp($this->slope), $dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return exp($this->_slope);
|
return exp($this->slope);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -101,14 +101,14 @@ class PolynomialBestFit extends BestFit
|
||||||
{
|
{
|
||||||
if ($dp != 0) {
|
if ($dp != 0) {
|
||||||
$coefficients = [];
|
$coefficients = [];
|
||||||
foreach ($this->_slope as $coefficient) {
|
foreach ($this->slope as $coefficient) {
|
||||||
$coefficients[] = round($coefficient, $dp);
|
$coefficients[] = round($coefficient, $dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $coefficients;
|
return $coefficients;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_slope;
|
return $this->slope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCoefficients($dp = 0)
|
public function getCoefficients($dp = 0)
|
||||||
|
@ -164,7 +164,7 @@ class PolynomialBestFit extends BestFit
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->intersect = array_shift($coefficients);
|
$this->intersect = array_shift($coefficients);
|
||||||
$this->_slope = $coefficients;
|
$this->slope = $coefficients;
|
||||||
|
|
||||||
$this->calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum);
|
$this->calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum);
|
||||||
foreach ($this->xValues as $xKey => $xValue) {
|
foreach ($this->xValues as $xKey => $xValue) {
|
||||||
|
@ -188,10 +188,10 @@ class PolynomialBestFit extends BestFit
|
||||||
$this->order = $order;
|
$this->order = $order;
|
||||||
$this->polynomialRegression($order, $yValues, $xValues);
|
$this->polynomialRegression($order, $yValues, $xValues);
|
||||||
if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) {
|
if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) {
|
||||||
$this->_error = true;
|
$this->error = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->_error = true;
|
$this->error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Cell;
|
||||||
use PhpOffice\PhpSpreadsheet\RichText;
|
use PhpOffice\PhpSpreadsheet\RichText;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException;
|
use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException;
|
||||||
|
|
||||||
class StringTable extends WriterPart
|
class StringTable extends WriterPart
|
||||||
|
@ -20,45 +21,41 @@ class StringTable extends WriterPart
|
||||||
*
|
*
|
||||||
* @return string[] String table for worksheet
|
* @return string[] String table for worksheet
|
||||||
*/
|
*/
|
||||||
public function createStringTable($pSheet = null, $pExistingTable = null)
|
public function createStringTable(Worksheet $pSheet, $pExistingTable = null)
|
||||||
{
|
{
|
||||||
if ($pSheet !== null) {
|
// Create string lookup table
|
||||||
// Create string lookup table
|
$aStringTable = [];
|
||||||
$aStringTable = [];
|
$cellCollection = null;
|
||||||
$cellCollection = null;
|
$aFlippedStringTable = null; // For faster lookup
|
||||||
$aFlippedStringTable = null; // For faster lookup
|
|
||||||
|
|
||||||
// Is an existing table given?
|
// Is an existing table given?
|
||||||
if (($pExistingTable !== null) && is_array($pExistingTable)) {
|
if (($pExistingTable !== null) && is_array($pExistingTable)) {
|
||||||
$aStringTable = $pExistingTable;
|
$aStringTable = $pExistingTable;
|
||||||
}
|
|
||||||
|
|
||||||
// Fill index array
|
|
||||||
$aFlippedStringTable = $this->flipStringTable($aStringTable);
|
|
||||||
|
|
||||||
// Loop through cells
|
|
||||||
foreach ($pSheet->getCoordinates() as $coordinate) {
|
|
||||||
$cell = $pSheet->getCell($coordinate);
|
|
||||||
$cellValue = $cell->getValue();
|
|
||||||
if (!is_object($cellValue) &&
|
|
||||||
($cellValue !== null) &&
|
|
||||||
$cellValue !== '' &&
|
|
||||||
!isset($aFlippedStringTable[$cellValue]) &&
|
|
||||||
($cell->getDataType() == Cell\DataType::TYPE_STRING || $cell->getDataType() == Cell\DataType::TYPE_STRING2 || $cell->getDataType() == Cell\DataType::TYPE_NULL)) {
|
|
||||||
$aStringTable[] = $cellValue;
|
|
||||||
$aFlippedStringTable[$cellValue] = true;
|
|
||||||
} elseif ($cellValue instanceof RichText &&
|
|
||||||
($cellValue !== null) &&
|
|
||||||
!isset($aFlippedStringTable[$cellValue->getHashCode()])) {
|
|
||||||
$aStringTable[] = $cellValue;
|
|
||||||
$aFlippedStringTable[$cellValue->getHashCode()] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $aStringTable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new WriterException('Invalid Worksheet object passed.');
|
// Fill index array
|
||||||
|
$aFlippedStringTable = $this->flipStringTable($aStringTable);
|
||||||
|
|
||||||
|
// Loop through cells
|
||||||
|
foreach ($pSheet->getCoordinates() as $coordinate) {
|
||||||
|
$cell = $pSheet->getCell($coordinate);
|
||||||
|
$cellValue = $cell->getValue();
|
||||||
|
if (!is_object($cellValue) &&
|
||||||
|
($cellValue !== null) &&
|
||||||
|
$cellValue !== '' &&
|
||||||
|
!isset($aFlippedStringTable[$cellValue]) &&
|
||||||
|
($cell->getDataType() == Cell\DataType::TYPE_STRING || $cell->getDataType() == Cell\DataType::TYPE_STRING2 || $cell->getDataType() == Cell\DataType::TYPE_NULL)) {
|
||||||
|
$aStringTable[] = $cellValue;
|
||||||
|
$aFlippedStringTable[$cellValue] = true;
|
||||||
|
} elseif ($cellValue instanceof RichText &&
|
||||||
|
($cellValue !== null) &&
|
||||||
|
!isset($aFlippedStringTable[$cellValue->getHashCode()])) {
|
||||||
|
$aStringTable[] = $cellValue;
|
||||||
|
$aFlippedStringTable[$cellValue->getHashCode()] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $aStringTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,7 @@ use PHPUnit_Framework_TestCase;
|
||||||
class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
|
class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public $mockWorksheet;
|
public $mockWorksheet;
|
||||||
public $mockColumnCell;
|
public $mockCell;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ use PHPUnit_Framework_TestCase;
|
||||||
class RowCellIteratorTest extends PHPUnit_Framework_TestCase
|
class RowCellIteratorTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public $mockWorksheet;
|
public $mockWorksheet;
|
||||||
public $mockRowCell;
|
public $mockCell;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue