#401 : PHPCS (Calculation\MathTrig & Logical)
This commit is contained in:
parent
12590bbf1e
commit
05643d16d5
|
@ -306,7 +306,7 @@ class Calculation
|
|||
),
|
||||
'AND' => array(
|
||||
'category' => Calculation\Categories::CATEGORY_LOGICAL,
|
||||
'functionCall' => '\\PHPExcel\\Calculation\\Logical::LOGICAL_AND',
|
||||
'functionCall' => '\\PHPExcel\\Calculation\\Logical::logicalAnd',
|
||||
'argumentCount' => '1+'
|
||||
),
|
||||
'AREAS' => array(
|
||||
|
@ -993,7 +993,7 @@ class Calculation
|
|||
),
|
||||
'IF' => array(
|
||||
'category' => Calculation\Categories::CATEGORY_LOGICAL,
|
||||
'functionCall' => '\\PHPExcel\\Calculation\\Logical::STATEMENT_IF',
|
||||
'functionCall' => '\\PHPExcel\\Calculation\\Logical::statementIf',
|
||||
'argumentCount' => '1-3'
|
||||
),
|
||||
'IFERROR' => array(
|
||||
|
@ -1239,7 +1239,7 @@ class Calculation
|
|||
),
|
||||
'LOG' => array(
|
||||
'category' => Calculation\Categories::CATEGORY_MATH_AND_TRIG,
|
||||
'functionCall' => '\\PHPExcel\\Calculation\\MathTrig::LOG_BASE',
|
||||
'functionCall' => '\\PHPExcel\\Calculation\\MathTrig::logBase',
|
||||
'argumentCount' => '1,2'
|
||||
),
|
||||
'LOG10' => array(
|
||||
|
@ -1496,7 +1496,7 @@ class Calculation
|
|||
),
|
||||
'OR' => array(
|
||||
'category' => Calculation\Categories::CATEGORY_LOGICAL,
|
||||
'functionCall' => '\\PHPExcel\\Calculation\\Logical::LOGICAL_OR',
|
||||
'functionCall' => '\\PHPExcel\\Calculation\\Logical::logicalOr',
|
||||
'argumentCount' => '1+'
|
||||
),
|
||||
'PEARSON' => array(
|
||||
|
|
|
@ -102,7 +102,8 @@ class Functions
|
|||
{
|
||||
if (($compatibilityMode == self::COMPATIBILITY_EXCEL) ||
|
||||
($compatibilityMode == self::COMPATIBILITY_GNUMERIC) ||
|
||||
($compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) {
|
||||
($compatibilityMode == self::COMPATIBILITY_OPENOFFICE)
|
||||
) {
|
||||
self::$compatibilityMode = $compatibilityMode;
|
||||
return true;
|
||||
}
|
||||
|
@ -143,7 +144,8 @@ class Functions
|
|||
{
|
||||
if (($returnDateType == self::RETURNDATE_PHP_NUMERIC) ||
|
||||
($returnDateType == self::RETURNDATE_PHP_OBJECT) ||
|
||||
($returnDateType == self::RETURNDATE_EXCEL)) {
|
||||
($returnDateType == self::RETURNDATE_EXCEL)
|
||||
) {
|
||||
self::$returnDateType = $returnDateType;
|
||||
return true;
|
||||
}
|
||||
|
@ -404,7 +406,7 @@ class Functions
|
|||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isNa(($value = '')
|
||||
public static function isNa($value = '')
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
|
@ -535,7 +537,7 @@ class Functions
|
|||
* An error value The error value
|
||||
* Anything else 0
|
||||
*/
|
||||
public static function N($value = null)
|
||||
public static function n($value = null)
|
||||
{
|
||||
while (is_array($value)) {
|
||||
$value = array_shift($value);
|
||||
|
@ -724,7 +726,8 @@ if (!function_exists('atanh')) {
|
|||
// As we'll only ever use this function with UTF-8 characters, we can simply "hard-code" the character set
|
||||
//
|
||||
if ((!function_exists('mb_str_replace')) &&
|
||||
(function_exists('mb_substr')) && (function_exists('mb_strlen')) && (function_exists('mb_strpos'))) {
|
||||
(function_exists('mb_substr')) && (function_exists('mb_strlen')) && (function_exists('mb_strpos'))
|
||||
) {
|
||||
function mb_str_replace($search, $replace, $subject)
|
||||
{
|
||||
if (is_array($subject)) {
|
||||
|
|
|
@ -86,7 +86,7 @@ class Logical
|
|||
* @param mixed $arg,... Data values
|
||||
* @return boolean The logical AND of the arguments.
|
||||
*/
|
||||
public static function LOGICAL_AND()
|
||||
public static function logicalAnd()
|
||||
{
|
||||
// Return value
|
||||
$returnValue = true;
|
||||
|
@ -142,7 +142,7 @@ class Logical
|
|||
* @param mixed $arg,... Data values
|
||||
* @return boolean The logical OR of the arguments.
|
||||
*/
|
||||
public static function LOGICAL_OR()
|
||||
public static function logicalOr()
|
||||
{
|
||||
// Return value
|
||||
$returnValue = false;
|
||||
|
@ -246,7 +246,7 @@ class Logical
|
|||
* @param mixed $returnIfFalse Optional value to return when condition is false
|
||||
* @return mixed The value of returnIfTrue or returnIfFalse determined by condition
|
||||
*/
|
||||
public static function STATEMENT_IF($condition = true, $returnIfTrue = 0, $returnIfFalse = false)
|
||||
public static function statementIf($condition = true, $returnIfTrue = 0, $returnIfFalse = false)
|
||||
{
|
||||
$condition = (is_null($condition)) ? true : (boolean) Functions::flattenSingleValue($condition);
|
||||
$returnIfTrue = (is_null($returnIfTrue)) ? 0 : Functions::flattenSingleValue($returnIfTrue);
|
||||
|
@ -273,6 +273,6 @@ class Logical
|
|||
$testValue = (is_null($testValue)) ? '' : Functions::flattenSingleValue($testValue);
|
||||
$errorpart = (is_null($errorpart)) ? '' : Functions::flattenSingleValue($errorpart);
|
||||
|
||||
return self::STATEMENT_IF(Functions::isError($testValue), $errorpart, $testValue);
|
||||
return self::statementIf(Functions::isError($testValue), $errorpart, $testValue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -498,7 +498,7 @@ class MathTrig
|
|||
* @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10.
|
||||
* @return float
|
||||
*/
|
||||
public static function LOG_BASE($number = null, $base = 10)
|
||||
public static function logBase($number = null, $base = 10)
|
||||
{
|
||||
$number = Functions::flattenSingleValue($number);
|
||||
$base = (is_null($base)) ? 10 : (float) Functions::flattenSingleValue($base);
|
||||
|
|
|
@ -121,7 +121,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function providerERROR_TYPE()
|
||||
{
|
||||
return new \testDataFileIterator('rawTestData/Calculation/Functions/errorType.data');
|
||||
return new \testDataFileIterator('rawTestData/Calculation/Functions/ERROR_TYPE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','LOGICAL_AND'), $args);
|
||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','logicalAnd'), $args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','LOGICAL_OR'), $args);
|
||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','logicalOr'), $args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','STATEMENT_IF'), $args);
|
||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','statementIf'), $args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','LOG_BASE'), $args);
|
||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','logBase'), $args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue