PhpSpreadsheet/bin/generate-document

25 lines
904 B
Plaintext
Raw Normal View History

#!/usr/bin/env php
<?php
2020-02-23 03:30:18 +00:00
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\DocumentGenerator;
require_once __DIR__ . '/../src/Bootstrap.php';
try {
2020-02-23 03:30:18 +00:00
$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);
}