mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 05:16:06 +03:00
PSR2 Fixes
This commit is contained in:
parent
09352e3e80
commit
576effef30
@ -5184,7 +5184,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
break;
|
||||
case 0x02: // Windows metafile or Macintosh PICT format
|
||||
case 0x0e: // native format
|
||||
default;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -7471,10 +7471,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$value = $mantissa / pow(2, (20 - $exp));
|
||||
|
||||
if ($mantissalow1 != 0) {
|
||||
$value += 1 / pow (2, (21 - $exp));
|
||||
$value += 1 / pow(2, (21 - $exp));
|
||||
}
|
||||
|
||||
$value += $mantissalow2 / pow (2, (52 - $exp));
|
||||
$value += $mantissalow2 / pow(2, (52 - $exp));
|
||||
if ($sign) {
|
||||
$value *= -1;
|
||||
}
|
||||
|
@ -198,10 +198,14 @@ class PHPExcel_Shared_JAMA_Matrix
|
||||
case 'integer,integer,integer,integer':
|
||||
list($i0, $iF, $j0, $jF) = $args;
|
||||
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
|
||||
$m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
$m = $iF - $i0;
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) {
|
||||
$n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
$n = $jF - $j0;
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
$R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1);
|
||||
for ($i = $i0; $i <= $iF; ++$i) {
|
||||
|
@ -21,7 +21,7 @@ defined('APPLICATION_PATH')
|
||||
|
||||
// Define path to application tests directory
|
||||
defined('APPLICATION_TESTS_PATH')
|
||||
|| define('APPLICATION_TESTS_PATH', realpath(dirname(__FILE__) ));
|
||||
|| define('APPLICATION_TESTS_PATH', realpath(dirname(__FILE__)));
|
||||
|
||||
// Define application environment
|
||||
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'ci');
|
||||
@ -41,7 +41,7 @@ set_include_path(implode(PATH_SEPARATOR, array(
|
||||
*/
|
||||
echo "PHPExcel tests beginning\n";
|
||||
|
||||
if(extension_loaded('xdebug')) {
|
||||
if (extension_loaded('xdebug')) {
|
||||
echo "Xdebug extension loaded and running\n";
|
||||
xdebug_enable();
|
||||
} else {
|
||||
|
@ -1,31 +1,35 @@
|
||||
<?php
|
||||
|
||||
class Complex {
|
||||
|
||||
class Complex
|
||||
{
|
||||
private $realPart = 0;
|
||||
private $imaginaryPart = 0;
|
||||
private $suffix = NULL;
|
||||
private $suffix = null;
|
||||
|
||||
public static function _parseComplex($complexNumber)
|
||||
{
|
||||
// Test for real number, with no imaginary part
|
||||
if (is_numeric($complexNumber))
|
||||
return array( $complexNumber, 0, NULL );
|
||||
if (is_numeric($complexNumber)) {
|
||||
return array($complexNumber, 0, null);
|
||||
}
|
||||
|
||||
// Fix silly human errors
|
||||
if (strpos($complexNumber,'+-') !== FALSE)
|
||||
$complexNumber = str_replace('+-','-',$complexNumber);
|
||||
if (strpos($complexNumber,'++') !== FALSE)
|
||||
$complexNumber = str_replace('++','+',$complexNumber);
|
||||
if (strpos($complexNumber,'--') !== FALSE)
|
||||
$complexNumber = str_replace('--','-',$complexNumber);
|
||||
if (strpos($complexNumber, '+-') !== false) {
|
||||
$complexNumber = str_replace('+-', '-', $complexNumber);
|
||||
}
|
||||
if (strpos($complexNumber, '++') !== false) {
|
||||
$complexNumber = str_replace('++', '+', $complexNumber);
|
||||
}
|
||||
if (strpos($complexNumber, '--') !== false) {
|
||||
$complexNumber = str_replace('--', '-', $complexNumber);
|
||||
}
|
||||
|
||||
// Basic validation of string, to parse out real and imaginary parts, and any suffix
|
||||
$validComplex = preg_match('/^([\-\+]?(\d+\.?\d*|\d*\.?\d+)([Ee][\-\+]?[0-2]?\d{1,3})?)([\-\+]?(\d+\.?\d*|\d*\.?\d+)([Ee][\-\+]?[0-2]?\d{1,3})?)?(([\-\+]?)([ij]?))$/ui',$complexNumber,$complexParts);
|
||||
$validComplex = preg_match('/^([\-\+]?(\d+\.?\d*|\d*\.?\d+)([Ee][\-\+]?[0-2]?\d{1,3})?)([\-\+]?(\d+\.?\d*|\d*\.?\d+)([Ee][\-\+]?[0-2]?\d{1,3})?)?(([\-\+]?)([ij]?))$/ui', $complexNumber, $complexParts);
|
||||
|
||||
if (!$validComplex) {
|
||||
// Neither real nor imaginary part, so test to see if we actually have a suffix
|
||||
$validComplex = preg_match('/^([\-\+]?)([ij])$/ui',$complexNumber,$complexParts);
|
||||
$validComplex = preg_match('/^([\-\+]?)([ij])$/ui', $complexNumber, $complexParts);
|
||||
if (!$validComplex) {
|
||||
throw new Exception('COMPLEX: Invalid complex number');
|
||||
}
|
||||
@ -52,10 +56,7 @@ class Complex {
|
||||
}
|
||||
|
||||
// Return real and imaginary parts and suffix as an array, and set a default suffix if user input lazily
|
||||
return array( $complexParts[1],
|
||||
$complexParts[4],
|
||||
!empty($complexParts[9]) ? $complexParts[9] : 'i'
|
||||
);
|
||||
return array($complexParts[1], $complexParts[4], !empty($complexParts[9]) ? $complexParts[9] : 'i');
|
||||
} // function _parseComplex()
|
||||
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
|
||||
include_once dirname(__FILE__).'/Complex.php';
|
||||
|
||||
|
||||
class complexAssert {
|
||||
|
||||
class complexAssert
|
||||
{
|
||||
private $_errorMessage = '';
|
||||
|
||||
public function assertComplexEquals($expected, $actual, $delta = 0)
|
||||
@ -12,11 +11,10 @@ class complexAssert {
|
||||
if ($expected{0} === '#') {
|
||||
// Expecting an error, so we do a straight string comparison
|
||||
if ($expected === $actual) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
$this->_errorMessage = 'Expected Error: ' .
|
||||
$actual . ' !== ' . $expected;
|
||||
return FALSE;
|
||||
$this->_errorMessage = 'Expected Error: ' . $actual . ' !== ' . $expected;
|
||||
return false;
|
||||
}
|
||||
|
||||
$expectedComplex = new Complex($expected);
|
||||
@ -24,39 +22,34 @@ class complexAssert {
|
||||
|
||||
if (!is_numeric($actualComplex->getReal()) || !is_numeric($expectedComplex->getReal())) {
|
||||
if ($actualComplex->getReal() !== $expectedComplex->getReal()) {
|
||||
$this->_errorMessage = 'Mismatched String: ' .
|
||||
$actualComplex->getReal() . ' !== ' . $expectedComplex->getReal();
|
||||
return FALSE;
|
||||
$this->_errorMessage = 'Mismatched String: ' . $actualComplex->getReal() . ' !== ' . $expectedComplex->getReal();
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($actualComplex->getReal() < ($expectedComplex->getReal() - $delta) ||
|
||||
$actualComplex->getReal() > ($expectedComplex->getReal() + $delta)) {
|
||||
$this->_errorMessage = 'Mismatched Real part: ' .
|
||||
$actualComplex->getReal() . ' != ' . $expectedComplex->getReal();
|
||||
return FALSE;
|
||||
$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();
|
||||
return FALSE;
|
||||
$this->_errorMessage = 'Mismatched Imaginary part: ' . $actualComplex->getImaginary() . ' != ' . $expectedComplex->getImaginary();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($actualComplex->getSuffix() !== $actualComplex->getSuffix()) {
|
||||
$this->_errorMessage = 'Mismatched Suffix: ' .
|
||||
$actualComplex->getSuffix() . ' != ' . $expectedComplex->getSuffix();
|
||||
return FALSE;
|
||||
$this->_errorMessage = 'Mismatched Suffix: ' . $actualComplex->getSuffix() . ' != ' . $expectedComplex->getSuffix();
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function getErrorMessage() {
|
||||
public function getErrorMessage()
|
||||
{
|
||||
return $this->_errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
class testDataFileIterator implements Iterator
|
||||
{
|
||||
|
||||
protected $file;
|
||||
protected $key = 0;
|
||||
protected $current;
|
||||
|
Loading…
Reference in New Issue
Block a user