Merge pull request #1385 from ikeyan/feature/update-document

Update docs/references/function-list-by-*.md
This commit is contained in:
Adrien Crivelli 2020-03-07 09:25:16 +07:00 committed by GitHub
commit 560e672b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 343 additions and 43 deletions

24
bin/generate-document Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\DocumentGenerator;
require_once __DIR__ . '/../src/Bootstrap.php';
try {
$phpSpreadsheetFunctionsProperty = (new ReflectionClass(Calculation::class))->getProperty('phpSpreadsheetFunctions');
$phpSpreadsheetFunctionsProperty->setAccessible(true);
$phpSpreadsheetFunctions = $phpSpreadsheetFunctionsProperty->getValue();
ksort($phpSpreadsheetFunctions);
file_put_contents(__DIR__ . '/../docs/references/function-list-by-category.md',
DocumentGenerator::generateFunctionListByCategory($phpSpreadsheetFunctions)
);
file_put_contents(__DIR__ . '/../docs/references/function-list-by-name.md',
DocumentGenerator::generateFunctionListByName($phpSpreadsheetFunctions)
);
} catch (ReflectionException $e) {
fwrite(STDERR, (string)$e);
exit(1);
}

View File

@ -69,12 +69,12 @@ BESSELK | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELK
BESSELY | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELY
BIN2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTODEC
BIN2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOHEX
BIN2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineeri
BIN2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOOCT
BITAND | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITAND
BITLSHIFT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITLSHIFT
BITOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR
BITRSHIFT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITRSHIFT
BITXOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITXOR
BITXOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR
COMPLEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::COMPLEX
CONVERT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::CONVERTUOM
DEC2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOBIN
@ -184,21 +184,21 @@ YIELDMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDMAT
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
CELL | **Not yet Implemented**
ERROR.TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ERROR_TYPE
ERROR.TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::errorType
INFO | **Not yet Implemented**
ISBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_BLANK
ISERR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERR
ISERROR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERROR
ISEVEN | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_EVEN
ISFORMULA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ISFORMULA
ISLOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_LOGICAL
ISNA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NA
ISNONTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NONTEXT
ISNUMBER | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NUMBER
ISODD | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ODD
ISBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isBlank
ISERR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isErr
ISERROR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isError
ISEVEN | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isEven
ISFORMULA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isFormula
ISLOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isLogical
ISNA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNa
ISNONTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNonText
ISNUMBER | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNumber
ISODD | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isOdd
ISREF | **Not yet Implemented**
ISTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_TEXT
N | \PhpOffice\PhpSpreadsheet\Calculation\Functions::N
ISTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isText
N | \PhpOffice\PhpSpreadsheet\Calculation\Functions::n
NA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::NA
TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::TYPE
@ -208,11 +208,13 @@ Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
FALSE | \PhpOffice\PhpSpreadsheet\Calculation\Logical::FALSE
IF | \PhpOffice\PhpSpreadsheet\Calculation\Logical::STATEMENT_IF
IF | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementIf
IFERROR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFERROR
IFNA | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFNA
IFS | **Not yet Implemented**
NOT | \PhpOffice\PhpSpreadsheet\Calculation\Logical::NOT
OR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalOr
SWITCH | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementSwitch
TRUE | \PhpOffice\PhpSpreadsheet\Calculation\Logical::TRUE
XOR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor
@ -220,7 +222,7 @@ XOR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
ADDRESS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CELL_ADDRESS
ADDRESS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::cellAddress
AREAS | **Not yet Implemented**
CHOOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CHOOSE
COLUMN | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMN
@ -249,11 +251,13 @@ ACOS | acos
ACOSH | acosh
ACOT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOT
ACOTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOTH
ARABIC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ARABIC
ASIN | asin
ASINH | asinh
ATAN | atan
ATAN2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::REVERSE_ATAN2
ATAN2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ATAN2
ATANH | atanh
BASE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::BASE
CEILING | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CEILING
COMBIN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COMBIN
COS | cos
@ -272,7 +276,7 @@ GCD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::GCD
INT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::INT
LCM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LCM
LN | log
LOG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LOG_BASE
LOG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::logBase
LOG10 | log10
MDETERM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MDETERM
MINVERSE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MINVERSE
@ -389,8 +393,8 @@ SLOPE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SLOPE
SMALL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SMALL
STANDARDIZE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STANDARDIZE
STDEV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEV.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEV.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP
STDEV.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEVA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVA
STDEVP | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP
STDEVPA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVPA

View File

@ -11,16 +11,17 @@ ACOS | CATEGORY_MATH_AND_TRIG | acos
ACOSH | CATEGORY_MATH_AND_TRIG | acosh
ACOT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOT
ACOTH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOTH
ADDRESS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CELL_ADDRESS
ADDRESS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::cellAddress
AMORDEGRC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORDEGRC
AMORLINC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORLINC
AND | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
ARABIC | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ARABIC
AREAS | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented**
ASC | CATEGORY_TEXT_AND_DATA | **Not yet Implemented**
ASIN | CATEGORY_MATH_AND_TRIG | asin
ASINH | CATEGORY_MATH_AND_TRIG | asinh
ATAN | CATEGORY_MATH_AND_TRIG | atan
ATAN2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::REVERSE_ATAN2
ATAN2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ATAN2
ATANH | CATEGORY_MATH_AND_TRIG | atanh
AVEDEV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVEDEV
AVERAGE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGE
@ -33,6 +34,7 @@ AVERAGEIFS | CATEGORY_STATISTICAL | **Not yet Implemented**
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
BAHTTEXT | CATEGORY_TEXT_AND_DATA | **Not yet Implemented**
BASE | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::BASE
BESSELI | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELI
BESSELJ | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELJ
BESSELK | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELK
@ -47,7 +49,7 @@ BITAND | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet
BITLSHIFT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITLSHIFT
BITOR | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR
BITRSHIFT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITRSHIFT
BITXOR | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITXOR
BITXOR | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR
## C
@ -147,7 +149,7 @@ ERF | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet
ERF.PRECISE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFPRECISE
ERFC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC
ERFC.PRECISE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC
ERROR.TYPE | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ERROR_TYPE
ERROR.TYPE | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::errorType
EVEN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::EVEN
EXACT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::EXACT
EXP | CATEGORY_MATH_AND_TRIG | exp
@ -205,7 +207,7 @@ HYPGEOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
IF | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::STATEMENT_IF
IF | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementIf
IFERROR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFERROR
IFNA | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFNA
IFS | CATEGORY_LOGICAL | **Not yet Implemented**
@ -242,20 +244,20 @@ INTERCEPT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet
INTRATE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::INTRATE
IPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IPMT
IRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IRR
ISBLANK | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_BLANK
ISERR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERR
ISERROR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERROR
ISEVEN | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_EVEN
ISFORMULA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ISFORMULA
ISLOGICAL | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_LOGICAL
ISNA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NA
ISNONTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NONTEXT
ISNUMBER | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NUMBER
ISODD | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ODD
ISBLANK | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isBlank
ISERR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isErr
ISERROR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isError
ISEVEN | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isEven
ISFORMULA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isFormula
ISLOGICAL | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isLogical
ISNA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNa
ISNONTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNonText
ISNUMBER | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNumber
ISODD | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isOdd
ISOWEEKNUM | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::ISOWEEKNUM
ISPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ISPMT
ISREF | CATEGORY_INFORMATION | **Not yet Implemented**
ISTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_TEXT
ISTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isText
## J
@ -281,7 +283,7 @@ LEN | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet
LENB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH
LINEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LINEST
LN | CATEGORY_MATH_AND_TRIG | log
LOG | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LOG_BASE
LOG | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::logBase
LOG10 | CATEGORY_MATH_AND_TRIG | log10
LOGEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGEST
LOGINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGINV
@ -321,7 +323,7 @@ MULTINOMIAL | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
N | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::N
N | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::n
NA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::NA
NEGBINOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NEGBINOMDIST
NETWORKDAYS | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::NETWORKDAYS
@ -428,8 +430,8 @@ SQRT | CATEGORY_MATH_AND_TRIG | sqrt
SQRTPI | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SQRTPI
STANDARDIZE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STANDARDIZE
STDEV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEV.S | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEV.P | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP
STDEV.S | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEVA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVA
STDEVP | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP
STDEVPA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVPA
@ -444,7 +446,7 @@ SUMSQ | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet
SUMX2MY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2MY2
SUMX2PY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2PY2
SUMXMY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMXMY2
SWITCH | CATEGORY_LOGICAL | **Not yet Implemented**
SWITCH | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementSwitch
SYD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SYD
## T
@ -514,7 +516,6 @@ XIRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet
XNPV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XNPV
XOR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor
## Y
Excel Function | Category | PhpSpreadsheet Function

View File

@ -1042,6 +1042,11 @@ class Calculation
'functionCall' => [Logical::class, 'IFNA'],
'argumentCount' => '2',
],
'IFS' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2+',
],
'IMABS' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMABS'],
@ -1498,7 +1503,12 @@ class Calculation
'NETWORKDAYS' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'NETWORKDAYS'],
'argumentCount' => '2+',
'argumentCount' => '2-3',
],
'NETWORKDAYS.INTL' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2-4',
],
'NOMINAL' => [
'category' => Category::CATEGORY_FINANCIAL,
@ -2167,7 +2177,12 @@ class Calculation
'WORKDAY' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'WORKDAY'],
'argumentCount' => '2+',
'argumentCount' => '2-3',
],
'WORKDAY.INTL' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2-4',
],
'XIRR' => [
'category' => Category::CATEGORY_FINANCIAL,

View File

@ -0,0 +1,111 @@
<?php
namespace PhpOffice\PhpSpreadsheet;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use ReflectionClass;
use ReflectionException;
use UnexpectedValueException;
class DocumentGenerator
{
/**
* @param array[] $phpSpreadsheetFunctions
*
* @throws ReflectionException
*
* @return string
*/
public static function generateFunctionListByCategory(array $phpSpreadsheetFunctions): string
{
$result = "# Function list by category\n";
foreach (self::getCategories() as $categoryConstant => $category) {
$result .= "\n";
$result .= "## {$categoryConstant}\n";
$result .= "\n";
$lengths = [20, 42];
$result .= self::tableRow($lengths, ['Excel Function', 'PhpSpreadsheet Function']) . "\n";
$result .= self::tableRow($lengths, null) . "\n";
foreach ($phpSpreadsheetFunctions as $excelFunction => $functionInfo) {
if ($category === $functionInfo['category']) {
$phpFunction = self::getPhpSpreadsheetFunctionText($functionInfo['functionCall']);
$result .= self::tableRow($lengths, [$excelFunction, $phpFunction]) . "\n";
}
}
}
return $result;
}
/**
* @throws ReflectionException
*
* @return array
*/
private static function getCategories(): array
{
return (new ReflectionClass(Category::class))->getConstants();
}
private static function tableRow(array $lengths, array $values = null): string
{
$result = '';
foreach (array_map(null, $lengths, $values ?? []) as $i => [$length, $value]) {
$pad = $value === null ? '-' : ' ';
if ($i > 0) {
$result .= '|' . $pad;
}
$result .= str_pad($value ?? '', $length, $pad);
}
return rtrim($result, ' ');
}
private static function getPhpSpreadsheetFunctionText($functionCall): string
{
if (is_string($functionCall)) {
return $functionCall;
}
if ($functionCall === [Functions::class, 'DUMMY']) {
return '**Not yet Implemented**';
}
if (is_array($functionCall)) {
return "\\{$functionCall[0]}::{$functionCall[1]}";
}
throw new UnexpectedValueException(
'$functionCall is of type ' . gettype($functionCall) . '. string or array expected'
);
}
/**
* @param array[] $phpSpreadsheetFunctions
*
* @throws ReflectionException
*
* @return string
*/
public static function generateFunctionListByName(array $phpSpreadsheetFunctions): string
{
$categoryConstants = array_flip(self::getCategories());
$result = "# Function list by name\n";
$lastAlphabet = null;
foreach ($phpSpreadsheetFunctions as $excelFunction => $functionInfo) {
$lengths = [20, 31, 42];
if ($lastAlphabet !== $excelFunction[0]) {
$lastAlphabet = $excelFunction[0];
$result .= "\n";
$result .= "## {$lastAlphabet}\n";
$result .= "\n";
$result .= self::tableRow($lengths, ['Excel Function', 'Category', 'PhpSpreadsheet Function']) . "\n";
$result .= self::tableRow($lengths, null) . "\n";
}
$category = $categoryConstants[$functionInfo['category']];
$phpFunction = self::getPhpSpreadsheetFunctionText($functionInfo['functionCall']);
$result .= self::tableRow($lengths, [$excelFunction, $category, $phpFunction]) . "\n";
}
return $result;
}
}

View File

@ -0,0 +1,145 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests;
use PhpOffice\PhpSpreadsheet\Calculation\Category as Cat;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Logical;
use PhpOffice\PhpSpreadsheet\DocumentGenerator;
use PHPUnit\Framework\TestCase;
class DocumentGeneratorTest extends TestCase
{
/**
* @dataProvider providerGenerateFunctionListByName
*
* @param array $phpSpreadsheetFunctions
* @param string $expected
*
* @throws \ReflectionException
*/
public function testGenerateFunctionListByName(array $phpSpreadsheetFunctions, string $expected): void
{
self::assertEquals($expected, DocumentGenerator::generateFunctionListByName($phpSpreadsheetFunctions));
}
/**
* @dataProvider providerGenerateFunctionListByCategory
*
* @param array $phpSpreadsheetFunctions
* @param string $expected
*
* @throws \ReflectionException
*/
public function testGenerateFunctionListByCategory(array $phpSpreadsheetFunctions, string $expected): void
{
self::assertEquals($expected, DocumentGenerator::generateFunctionListByCategory($phpSpreadsheetFunctions));
}
public function providerGenerateFunctionListByName(): array
{
return [
[
[
'ABS' => ['category' => Cat::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'abs'],
'AND' => ['category' => Cat::CATEGORY_LOGICAL, 'functionCall' => [Logical::class, 'logicalAnd']],
'IFS' => ['category' => Cat::CATEGORY_LOGICAL, 'functionCall' => [Functions::class, 'DUMMY']],
],
<<<'EXPECTED'
# Function list by name
## A
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
ABS | CATEGORY_MATH_AND_TRIG | abs
AND | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
## I
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
IFS | CATEGORY_LOGICAL | **Not yet Implemented**
EXPECTED
],
];
}
public function providerGenerateFunctionListByCategory(): array
{
return [
[
[
'ABS' => ['category' => Cat::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'abs'],
'AND' => ['category' => Cat::CATEGORY_LOGICAL, 'functionCall' => [Logical::class, 'logicalAnd']],
'IFS' => ['category' => Cat::CATEGORY_LOGICAL, 'functionCall' => [Functions::class, 'DUMMY']],
],
<<<'EXPECTED'
# Function list by category
## CATEGORY_CUBE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_DATABASE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_DATE_AND_TIME
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_ENGINEERING
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_FINANCIAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_INFORMATION
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_LOGICAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
IFS | **Not yet Implemented**
## CATEGORY_LOOKUP_AND_REFERENCE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_MATH_AND_TRIG
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
ABS | abs
## CATEGORY_STATISTICAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_TEXT_AND_DATA
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
EXPECTED
],
];
}
}