Skip to content

Commit b30f364

Browse files
committed
Renaming methods for Excel functions to provide more consistent case, and meaningful names
1 parent 1fda83d commit b30f364

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+136
-136
lines changed

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -376,22 +376,22 @@ class Calculation
376376
],
377377
'BESSELI' => [
378378
'category' => Category::CATEGORY_ENGINEERING,
379-
'functionCall' => [Engineering\BesselI::class, 'BESSELI'],
379+
'functionCall' => [Engineering\BesselI::class, 'besselI'],
380380
'argumentCount' => '2',
381381
],
382382
'BESSELJ' => [
383383
'category' => Category::CATEGORY_ENGINEERING,
384-
'functionCall' => [Engineering\BesselJ::class, 'BESSELJ'],
384+
'functionCall' => [Engineering\BesselJ::class, 'besselJ'],
385385
'argumentCount' => '2',
386386
],
387387
'BESSELK' => [
388388
'category' => Category::CATEGORY_ENGINEERING,
389-
'functionCall' => [Engineering\BesselK::class, 'BESSELK'],
389+
'functionCall' => [Engineering\BesselK::class, 'besselK'],
390390
'argumentCount' => '2',
391391
],
392392
'BESSELY' => [
393393
'category' => Category::CATEGORY_ENGINEERING,
394-
'functionCall' => [Engineering\BesselY::class, 'BESSELY'],
394+
'functionCall' => [Engineering\BesselY::class, 'besselY'],
395395
'argumentCount' => '2',
396396
],
397397
'BETADIST' => [
@@ -588,7 +588,7 @@ class Calculation
588588
],
589589
'COMPLEX' => [
590590
'category' => Category::CATEGORY_ENGINEERING,
591-
'functionCall' => [Engineering\Complex::class, 'COMPLEX'],
591+
'functionCall' => [Engineering\Complex::class, 'complex'],
592592
'argumentCount' => '2,3',
593593
],
594594
'CONCAT' => [
@@ -648,12 +648,12 @@ class Calculation
648648
],
649649
'COUNT' => [
650650
'category' => Category::CATEGORY_STATISTICAL,
651-
'functionCall' => [Statistical\Counts::class, 'COUNT'],
651+
'functionCall' => [Statistical\Counts::class, 'count'],
652652
'argumentCount' => '1+',
653653
],
654654
'COUNTA' => [
655655
'category' => Category::CATEGORY_STATISTICAL,
656-
'functionCall' => [Statistical\Counts::class, 'COUNTA'],
656+
'functionCall' => [Statistical\Counts::class, 'countA'],
657657
'argumentCount' => '1+',
658658
],
659659
'COUNTBLANK' => [
@@ -673,32 +673,32 @@ class Calculation
673673
],
674674
'COUPDAYBS' => [
675675
'category' => Category::CATEGORY_FINANCIAL,
676-
'functionCall' => [Financial\Coupons::class, 'COUPDAYBS'],
676+
'functionCall' => [Financial\Coupons::class, 'daysBeforeSettlement'],
677677
'argumentCount' => '3,4',
678678
],
679679
'COUPDAYS' => [
680680
'category' => Category::CATEGORY_FINANCIAL,
681-
'functionCall' => [Financial\Coupons::class, 'COUPDAYS'],
681+
'functionCall' => [Financial\Coupons::class, 'days'],
682682
'argumentCount' => '3,4',
683683
],
684684
'COUPDAYSNC' => [
685685
'category' => Category::CATEGORY_FINANCIAL,
686-
'functionCall' => [Financial\Coupons::class, 'COUPDAYSNC'],
686+
'functionCall' => [Financial\Coupons::class, 'daysToNextCoupon'],
687687
'argumentCount' => '3,4',
688688
],
689689
'COUPNCD' => [
690690
'category' => Category::CATEGORY_FINANCIAL,
691-
'functionCall' => [Financial\Coupons::class, 'COUPNCD'],
691+
'functionCall' => [Financial\Coupons::class, 'nextCouponDate'],
692692
'argumentCount' => '3,4',
693693
],
694694
'COUPNUM' => [
695695
'category' => Category::CATEGORY_FINANCIAL,
696-
'functionCall' => [Financial\Coupons::class, 'COUPNUM'],
696+
'functionCall' => [Financial\Coupons::class, 'numberPayable'],
697697
'argumentCount' => '3,4',
698698
],
699699
'COUPPCD' => [
700700
'category' => Category::CATEGORY_FINANCIAL,
701-
'functionCall' => [Financial\Coupons::class, 'COUPPCD'],
701+
'functionCall' => [Financial\Coupons::class, 'previousCouponDate'],
702702
'argumentCount' => '3,4',
703703
],
704704
'COVAR' => [
@@ -1327,127 +1327,127 @@ class Calculation
13271327
],
13281328
'IMABS' => [
13291329
'category' => Category::CATEGORY_ENGINEERING,
1330-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMABS'],
1330+
'functionCall' => [Engineering\ComplexFunctions::class, 'absolute'],
13311331
'argumentCount' => '1',
13321332
],
13331333
'IMAGINARY' => [
13341334
'category' => Category::CATEGORY_ENGINEERING,
1335-
'functionCall' => [Engineering\Complex::class, 'IMAGINARY'],
1335+
'functionCall' => [Engineering\Complex::class, 'imaginary'],
13361336
'argumentCount' => '1',
13371337
],
13381338
'IMARGUMENT' => [
13391339
'category' => Category::CATEGORY_ENGINEERING,
1340-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMARGUMENT'],
1340+
'functionCall' => [Engineering\ComplexFunctions::class, 'argument'],
13411341
'argumentCount' => '1',
13421342
],
13431343
'IMCONJUGATE' => [
13441344
'category' => Category::CATEGORY_ENGINEERING,
1345-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMCONJUGATE'],
1345+
'functionCall' => [Engineering\ComplexFunctions::class, 'conjugate'],
13461346
'argumentCount' => '1',
13471347
],
13481348
'IMCOS' => [
13491349
'category' => Category::CATEGORY_ENGINEERING,
1350-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMCOS'],
1350+
'functionCall' => [Engineering\ComplexFunctions::class, 'cos'],
13511351
'argumentCount' => '1',
13521352
],
13531353
'IMCOSH' => [
13541354
'category' => Category::CATEGORY_ENGINEERING,
1355-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMCOSH'],
1355+
'functionCall' => [Engineering\ComplexFunctions::class, 'cosh'],
13561356
'argumentCount' => '1',
13571357
],
13581358
'IMCOT' => [
13591359
'category' => Category::CATEGORY_ENGINEERING,
1360-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMCOT'],
1360+
'functionCall' => [Engineering\ComplexFunctions::class, 'cot'],
13611361
'argumentCount' => '1',
13621362
],
13631363
'IMCSC' => [
13641364
'category' => Category::CATEGORY_ENGINEERING,
1365-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMCSC'],
1365+
'functionCall' => [Engineering\ComplexFunctions::class, 'csc'],
13661366
'argumentCount' => '1',
13671367
],
13681368
'IMCSCH' => [
13691369
'category' => Category::CATEGORY_ENGINEERING,
1370-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMCSCH'],
1370+
'functionCall' => [Engineering\ComplexFunctions::class, 'csch'],
13711371
'argumentCount' => '1',
13721372
],
13731373
'IMDIV' => [
13741374
'category' => Category::CATEGORY_ENGINEERING,
1375-
'functionCall' => [Engineering\ComplexOperations::class, 'IMDIV'],
1375+
'functionCall' => [Engineering\ComplexOperations::class, 'div'],
13761376
'argumentCount' => '2',
13771377
],
13781378
'IMEXP' => [
13791379
'category' => Category::CATEGORY_ENGINEERING,
1380-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMEXP'],
1380+
'functionCall' => [Engineering\ComplexFunctions::class, 'exp'],
13811381
'argumentCount' => '1',
13821382
],
13831383
'IMLN' => [
13841384
'category' => Category::CATEGORY_ENGINEERING,
1385-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMLN'],
1385+
'functionCall' => [Engineering\ComplexFunctions::class, 'ln'],
13861386
'argumentCount' => '1',
13871387
],
13881388
'IMLOG10' => [
13891389
'category' => Category::CATEGORY_ENGINEERING,
1390-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMLOG10'],
1390+
'functionCall' => [Engineering\ComplexFunctions::class, 'log10'],
13911391
'argumentCount' => '1',
13921392
],
13931393
'IMLOG2' => [
13941394
'category' => Category::CATEGORY_ENGINEERING,
1395-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMLOG2'],
1395+
'functionCall' => [Engineering\ComplexFunctions::class, 'log2'],
13961396
'argumentCount' => '1',
13971397
],
13981398
'IMPOWER' => [
13991399
'category' => Category::CATEGORY_ENGINEERING,
1400-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMPOWER'],
1400+
'functionCall' => [Engineering\ComplexFunctions::class, 'power'],
14011401
'argumentCount' => '2',
14021402
],
14031403
'IMPRODUCT' => [
14041404
'category' => Category::CATEGORY_ENGINEERING,
1405-
'functionCall' => [Engineering\ComplexOperations::class, 'IMPRODUCT'],
1405+
'functionCall' => [Engineering\ComplexOperations::class, 'product'],
14061406
'argumentCount' => '1+',
14071407
],
14081408
'IMREAL' => [
14091409
'category' => Category::CATEGORY_ENGINEERING,
1410-
'functionCall' => [Engineering\Complex::class, 'IMREAL'],
1410+
'functionCall' => [Engineering\Complex::class, 'real'],
14111411
'argumentCount' => '1',
14121412
],
14131413
'IMSEC' => [
14141414
'category' => Category::CATEGORY_ENGINEERING,
1415-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMSEC'],
1415+
'functionCall' => [Engineering\ComplexFunctions::class, 'sec'],
14161416
'argumentCount' => '1',
14171417
],
14181418
'IMSECH' => [
14191419
'category' => Category::CATEGORY_ENGINEERING,
1420-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMSECH'],
1420+
'functionCall' => [Engineering\ComplexFunctions::class, 'sech'],
14211421
'argumentCount' => '1',
14221422
],
14231423
'IMSIN' => [
14241424
'category' => Category::CATEGORY_ENGINEERING,
1425-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMSIN'],
1425+
'functionCall' => [Engineering\ComplexFunctions::class, 'sin'],
14261426
'argumentCount' => '1',
14271427
],
14281428
'IMSINH' => [
14291429
'category' => Category::CATEGORY_ENGINEERING,
1430-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMSINH'],
1430+
'functionCall' => [Engineering\ComplexFunctions::class, 'sinh'],
14311431
'argumentCount' => '1',
14321432
],
14331433
'IMSQRT' => [
14341434
'category' => Category::CATEGORY_ENGINEERING,
1435-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMSQRT'],
1435+
'functionCall' => [Engineering\ComplexFunctions::class, 'sqrt'],
14361436
'argumentCount' => '1',
14371437
],
14381438
'IMSUB' => [
14391439
'category' => Category::CATEGORY_ENGINEERING,
1440-
'functionCall' => [Engineering\ComplexOperations::class, 'IMSUB'],
1440+
'functionCall' => [Engineering\ComplexOperations::class, 'sub'],
14411441
'argumentCount' => '2',
14421442
],
14431443
'IMSUM' => [
14441444
'category' => Category::CATEGORY_ENGINEERING,
1445-
'functionCall' => [Engineering\ComplexOperations::class, 'IMSUM'],
1445+
'functionCall' => [Engineering\ComplexOperations::class, 'sum'],
14461446
'argumentCount' => '1+',
14471447
],
14481448
'IMTAN' => [
14491449
'category' => Category::CATEGORY_ENGINEERING,
1450-
'functionCall' => [Engineering\ComplexFunctions::class, 'IMTAN'],
1450+
'functionCall' => [Engineering\ComplexFunctions::class, 'tan'],
14511451
'argumentCount' => '1',
14521452
],
14531453
'INDEX' => [

src/PhpSpreadsheet/Calculation/Database/DCount.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static function evaluate($database, $field, $criteria)
3636
{
3737
$field = self::fieldExtract($database, $field);
3838

39-
return Counts::COUNT(
39+
return Counts::count(
4040
self::getFilteredColumn($database, $field, $criteria)
4141
);
4242
}

src/PhpSpreadsheet/Calculation/Database/DCountA.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function evaluate($database, $field, $criteria)
3535
{
3636
$field = self::fieldExtract($database, $field);
3737

38-
return Counts::COUNTA(
38+
return Counts::countA(
3939
self::getFilteredColumn($database, $field ?? 0, $criteria)
4040
);
4141
}

src/PhpSpreadsheet/Calculation/Engineering/BesselI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class BesselI
3535
* If an array of numbers is passed as an argument, then the returned result will also be an array
3636
* with the same dimensions
3737
*/
38-
public static function BESSELI($x, $ord)
38+
public static function besselI($x, $ord)
3939
{
4040
if (is_array($x) || is_array($ord)) {
4141
return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $ord);

src/PhpSpreadsheet/Calculation/Engineering/BesselJ.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class BesselJ
3434
* If an array of numbers is passed as an argument, then the returned result will also be an array
3535
* with the same dimensions
3636
*/
37-
public static function BESSELJ($x, $ord)
37+
public static function besselJ($x, $ord)
3838
{
3939
if (is_array($x) || is_array($ord)) {
4040
return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $ord);

src/PhpSpreadsheet/Calculation/Engineering/BesselK.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BesselK
3333
* If an array of numbers is passed as an argument, then the returned result will also be an array
3434
* with the same dimensions
3535
*/
36-
public static function BESSELK($x, $ord)
36+
public static function besselK($x, $ord)
3737
{
3838
if (is_array($x) || is_array($ord)) {
3939
return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $ord);
@@ -75,7 +75,7 @@ private static function calculate(float $x, int $ord): float
7575
*/
7676
private static function callBesselI(float $x, int $ord): float
7777
{
78-
$rslt = BesselI::BESSELI($x, $ord);
78+
$rslt = BesselI::besselI($x, $ord);
7979
if (!is_float($rslt)) {
8080
throw new Exception('Unexpected array or string');
8181
}

src/PhpSpreadsheet/Calculation/Engineering/BesselY.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class BesselY
3131
* If an array of numbers is passed as an argument, then the returned result will also be an array
3232
* with the same dimensions
3333
*/
34-
public static function BESSELY($x, $ord)
34+
public static function besselY($x, $ord)
3535
{
3636
if (is_array($x) || is_array($ord)) {
3737
return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $ord);
@@ -73,7 +73,7 @@ private static function calculate(float $x, int $ord): float
7373
*/
7474
private static function callBesselJ(float $x, int $ord): float
7575
{
76-
$rslt = BesselJ::BESSELJ($x, $ord);
76+
$rslt = BesselJ::besselJ($x, $ord);
7777
if (!is_float($rslt)) {
7878
throw new Exception('Unexpected array or string');
7979
}

src/PhpSpreadsheet/Calculation/Engineering/Complex.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Complex
3232
* If an array of numbers is passed as an argument, then the returned result will also be an array
3333
* with the same dimensions
3434
*/
35-
public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i')
35+
public static function complex($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i')
3636
{
3737
if (is_array($realNumber) || is_array($imaginary) || is_array($suffix)) {
3838
return self::evaluateArrayArguments([self::class, __FUNCTION__], $realNumber, $imaginary, $suffix);
@@ -74,7 +74,7 @@ public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i
7474
* If an array of numbers is passed as an argument, then the returned result will also be an array
7575
* with the same dimensions
7676
*/
77-
public static function IMAGINARY($complexNumber)
77+
public static function imaginary($complexNumber)
7878
{
7979
if (is_array($complexNumber)) {
8080
return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber);
@@ -104,7 +104,7 @@ public static function IMAGINARY($complexNumber)
104104
* If an array of numbers is passed as an argument, then the returned result will also be an array
105105
* with the same dimensions
106106
*/
107-
public static function IMREAL($complexNumber)
107+
public static function real($complexNumber)
108108
{
109109
if (is_array($complexNumber)) {
110110
return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber);

0 commit comments

Comments
 (0)