heyuntao
2023-06-09 d50b2f10e597b058e9f7f34df014f067cc8b7c6b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
}