Merge branch 'master' into docprops

This commit is contained in:
oleibman 2021-05-23 15:14:11 -07:00 committed by GitHub
commit c5df2fc928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
394 changed files with 16492 additions and 13791 deletions

1
.gitattributes vendored
View File

@ -8,6 +8,7 @@
/bin export-ignore
/composer.lock export-ignore
/docs export-ignore
/infra export-ignore
/mkdocs.yml export-ignore
/phpunit.xml.dist export-ignore
/samples export-ignore

View File

@ -124,6 +124,37 @@ jobs:
- name: Code style with PHP_CodeSniffer
run: ./vendor/bin/phpcs -q --report=checkstyle | cs2pr
versions:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: none
tools: cs2pr
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Code Version Compatibility check with PHP_CodeSniffer
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 7.2-
phpstan:
runs-on: ubuntu-latest
steps:

View File

@ -9,23 +9,30 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Added
- Implemented basic AutoFiltering for Ods Reader and Writer [PR #2053](https://github.com/PHPOffice/PhpSpreadsheet/pull/2053)
- Implemented basic AutoFiltering for Gnumeric Reader [PR #2055](https://github.com/PHPOffice/PhpSpreadsheet/pull/2055)
- Improved support for Row and Column ranges in formulae [Issue #1755](https://github.com/PHPOffice/PhpSpreadsheet/issues/1755) [PR #2028](https://github.com/PHPOffice/PhpSpreadsheet/pull/2028)
- Implemented URLENCODE() Web Function
- Implemented the CHITEST(), CHISQ.DIST() and CHISQ.INV() and equivalent Statistical functions, for both left- and right-tailed distributions.
- Support for ActiveSheet and SelectedCells in the ODS Reader and Writer. [PR #1908](https://github.com/PHPOffice/PhpSpreadsheet/pull/1908)
- Support for notContainsText Conditional Style in xlsx [Issue #984](https://github.com/PHPOffice/PhpSpreadsheet/issues/984)
### Changed
- Nothing.
- Use of `nb` rather than `no` as the locale code for Norsk Bokmål.
### Deprecated
- Nothing.
- All Excel Function implementations in `Calculation\Database`, `Calculation\DateTime`, `Calculation\Engineering`, `Calculation\Financial`, `Calculation\Logical`, `Calculation\LookupRef`, `Calculation\MathTrig`, `Calculation\Statistical`, `Calculation\TextData` and `Calculation\Web` have been moved to dedicated classes for individual functions or groups of related functions. See the docblocks against all the deprecated methods for details of the new methods to call instead. At some point, these old classes will be deleted.
### Removed
- Nothing.
### Fixed
- Fixed incorrect R1C1 to A1 subtraction formula conversion (`R[-2]C-R[2]C`) [Issue #2076](https://github.com/PHPOffice/PhpSpreadsheet/pull/2076) [PR #2086](https://github.com/PHPOffice/PhpSpreadsheet/pull/2086)
- Correctly handle absolute A1 references when converting to R1C1 format [PR #2060](https://github.com/PHPOffice/PhpSpreadsheet/pull/2060)
- Correct default fill style for conditional without a pattern defined [Issue #2035](https://github.com/PHPOffice/PhpSpreadsheet/issues/2035) [PR #2050](https://github.com/PHPOffice/PhpSpreadsheet/pull/2050)
- Fixed issue where array key check for existince before accessing arrays in Xlsx.php. [PR #1970](https://github.com/PHPOffice/PhpSpreadsheet/pull/1970)
- Fixed issue with quoted strings in number format mask rendered with toFormattedString() [Issue 1972#](https://github.com/PHPOffice/PhpSpreadsheet/issues/1972) [PR #1978](https://github.com/PHPOffice/PhpSpreadsheet/pull/1978)
- Fixed issue with percentage formats in number format mask rendered with toFormattedString() [Issue 1929#](https://github.com/PHPOffice/PhpSpreadsheet/issues/1929) [PR #1928](https://github.com/PHPOffice/PhpSpreadsheet/pull/1928)

23
bin/generate-locales Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheetInfra\LocaleGenerator;
require_once 'vendor/autoload.php';
try {
$phpSpreadsheetFunctionsProperty = (new ReflectionClass(Calculation::class))->getProperty('phpSpreadsheetFunctions');
$phpSpreadsheetFunctionsProperty->setAccessible(true);
$phpSpreadsheetFunctions = $phpSpreadsheetFunctionsProperty->getValue();
$localeGenerator = new LocaleGenerator(
__DIR__ . '/../src/PhpSpreadsheet/Calculation/locale/',
'Translations.xlsx',
$phpSpreadsheetFunctions
);
$localeGenerator->generateLocales();
} catch (\Exception $e) {
fwrite(STDERR, (string) $e);
exit(1);
}

View File

@ -0,0 +1,195 @@
<?php
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('UTC');
// Adjust the path as required to reference the PHPSpreadsheet Bootstrap file
require_once __DIR__ . '/../samples/Bootstrap.php';
class ExcelFunction
{
public $category;
public $functionName;
public $excelVersion;
public $implementation;
public function __construct(string $category, string $functionName, string $excelVersion, string $implementation)
{
$this->category = $category;
$this->functionName = $functionName;
$this->excelVersion = $excelVersion;
$this->implementation = $implementation;
}
}
class ColumnSettings
{
public $length;
public $title;
public $underline;
public function __construct(string $title, int $length)
{
$this->length = $length;
$this->title = str_pad($title, $length, ' ');
$this->underline = str_repeat('-', $length);
}
}
class ListBuilder
{
private $inputFileName;
public $list = [];
public function __construct(string $inputFileName)
{
$this->inputFileName = $inputFileName;
$this->buildList();
uasort(
$this->list,
function ($a, $b) {
$aSortName = str_replace('.', '', $a->functionName, $aCount) . str_repeat('.', $aCount);
$bSortName = str_replace('.', '', $b->functionName, $bCount) . str_repeat('.', $bCount);
return $aSortName <=> $bSortName;
}
);
}
private function buildList(): void
{
$inputFile = new \SplFileObject($this->inputFileName);
$category = null;
while (!$inputFile->eof()) {
$line = $inputFile->fgets();
if (strpos($line, '#') === 0) {
if (strpos($line, '##') === 0) {
$category = trim(substr($line, 3));
}
continue;
}
$lineData = explode('|', $line);
if (count($lineData) <= 1 || strpos($line, '--') === 0) {
continue;
}
$functionData = array_map('trim', $lineData);
if ($functionData[0] === 'Excel Function') {
continue;
}
$function = new ExcelFunction($category, ...$functionData);
if (array_key_exists($function->functionName, $this->list)) {
echo " ERROR: Duplicate entry for function {$function->functionName} in master file", PHP_EOL;
continue;
}
$this->list[$function->functionName] = $function;
}
}
}
class AlphabeticFileWriter
{
private $outputFileName;
private $outputFile;
public function __construct(string $outputFileName)
{
$this->outputFileName = $outputFileName;
}
public function generate(ExcelFunction ...$functionList): void
{
$this->outputFile = new \SplFileObject($this->outputFileName, 'w');
$this->excelFunctionColumnSettings = new ColumnSettings('Excel Function', max(array_map('strlen', array_column($functionList, 'functionName'))));
$this->categoryColumnSettings = new ColumnSettings('Category', max(array_map('strlen', array_column($functionList, 'category'))));
$this->excelVersionColumnSettings = new ColumnSettings('Excel Version', 13);
$this->phpSpreadsheetFunctionColumnSettings = new ColumnSettings('PhpSpreadsheet Function', 24);
$this->header();
$this->body(...$functionList);
}
private function header(): void
{
$this->outputFile->fwrite('# Function list by name' . PHP_EOL);
}
private function body(ExcelFunction ...$functionList): void
{
$initialCharacter = null;
foreach ($functionList as $excelFunction) {
if (substr($excelFunction->functionName, 0, 1) !== $initialCharacter) {
$initialCharacter = $this->subHeader($excelFunction);
}
$functionName = str_pad($excelFunction->functionName, $this->excelFunctionColumnSettings->length, ' ');
$category = str_pad($excelFunction->category, $this->categoryColumnSettings->length, ' ');
$excelVersion = str_pad($excelFunction->excelVersion, $this->excelVersionColumnSettings->length, ' ');
$this->outputFile->fwrite("{$functionName} | {$category} | {$excelVersion} | {$excelFunction->implementation}" . PHP_EOL);
}
}
private function subHeader(ExcelFunction $excelFunction)
{
$initialCharacter = substr($excelFunction->functionName, 0, 1);
$this->outputFile->fwrite(PHP_EOL . "## {$initialCharacter}" . PHP_EOL . PHP_EOL);
$this->outputFile->fwrite("{$this->excelFunctionColumnSettings->title} | {$this->categoryColumnSettings->title} | {$this->excelVersionColumnSettings->title} | {$this->phpSpreadsheetFunctionColumnSettings->title}" . PHP_EOL);
$this->outputFile->fwrite("{$this->excelFunctionColumnSettings->underline}-|-{$this->categoryColumnSettings->underline}-|-{$this->excelVersionColumnSettings->underline}-|-{$this->phpSpreadsheetFunctionColumnSettings->underline}" . PHP_EOL);
return $initialCharacter;
}
}
$folder = __DIR__ . '/../docs/references/';
$inputFileName = 'function-list-by-category.md';
$outputFileName = 'function-list-by-name.md';
echo "Building list of functions from master file {$inputFileName}", PHP_EOL;
$listBuilder = new ListBuilder($folder . $inputFileName);
echo "Building new documentation list of alphabetic functions in {$outputFileName}", PHP_EOL;
$alphabeticFileWriter = new AlphabeticFileWriter($folder . $outputFileName);
$alphabeticFileWriter->generate(...array_values($listBuilder->list));
echo 'Identifying discrepancies between the master file and the Calculation Engine codebase', PHP_EOL;
$definedFunctions = (new Calculation())->getFunctions();
foreach ($listBuilder->list as $excelFunction) {
if (!array_key_exists($excelFunction->functionName, $definedFunctions)) {
echo " ERROR: Function {$excelFunction->functionName}() of category {$excelFunction->category} is not defined in the Calculation Engine", PHP_EOL;
} elseif (array_key_exists($excelFunction->functionName, $definedFunctions) && $excelFunction->implementation === '**Not yet Implemented**') {
if ($definedFunctions[$excelFunction->functionName]['functionCall'] !== [Functions::class, 'DUMMY']) {
echo " ERROR: Function {$excelFunction->functionName}() of category {$excelFunction->category} is flagged as not yet implemented in the documentation", PHP_EOL;
echo ' but does have an implementation in the code', PHP_EOL;
}
}
}
foreach ($definedFunctions as $definedFunction => $definedFunctionDetail) {
if (!array_key_exists($definedFunction, $listBuilder->list)) {
echo " ERROR: Function {$definedFunction}() of category {$definedFunctionDetail['category']} is defined in the Calculation Engine, but not in the master file", PHP_EOL;
}
}

View File

@ -53,7 +53,6 @@
},
"require": {
"php": "^7.2 || ^8.0",
"ext-simplexml": "*",
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
@ -61,6 +60,7 @@
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
@ -75,6 +75,7 @@
"psr/simple-cache": "^1.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"dompdf/dompdf": "^1.0",
"friendsofphp/php-cs-fixer": "^2.18",
"jpgraph/jpgraph": "^4.0",
@ -99,7 +100,8 @@
},
"autoload-dev": {
"psr-4": {
"PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests"
"PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests",
"PhpOffice\\PhpSpreadsheetInfra\\": "infra"
}
}
}

79
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3be2673a6367d296c616bf9c34b77953",
"content-hash": "9158fcde13425499acaf0da201637737",
"packages": [
{
"name": "ezyang/htmlpurifier",
@ -802,6 +802,77 @@
],
"time": "2021-03-25T17:01:18+00:00"
},
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "c960cf4629fab7155caca18c038ca7257b7595e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/c960cf4629fab7155caca18c038ca7257b7595e3",
"reference": "c960cf4629fab7155caca18c038ca7257b7595e3",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0"
},
"require-dev": {
"composer/composer": "*",
"enlightn/security-checker": "^1.2",
"phpcompatibility/php-compatibility": "^9.0"
},
"default-branch": true,
"type": "composer-plugin",
"extra": {
"class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
},
"autoload": {
"psr-4": {
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Franck Nijhof",
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://www.dealerdirect.com",
"keywords": [
"PHPCodeSniffer",
"PHP_CodeSniffer",
"code quality",
"codesniffer",
"composer",
"installer",
"phpcs",
"plugin",
"qa",
"quality",
"standard",
"standards",
"style guide",
"stylecheck",
"tests"
],
"support": {
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
},
"time": "2021-03-14T13:49:41+00:00"
},
{
"name": "doctrine/annotations",
"version": "1.12.1",
@ -5065,12 +5136,13 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"dealerdirect/phpcodesniffer-composer-installer": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.2 || ^8.0",
"ext-simplexml": "*",
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
@ -5078,6 +5150,7 @@
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",

View File

@ -1220,13 +1220,13 @@
</tr>
<tr>
<td style="padding-left: 1em;">Merged Cells</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="text-align: center; color: green;"></td>
<td style="text-align: center; color: green;"></td>
<td></td>
<td></td>
<td style="text-align: center; color: green;"></td>
<td style="text-align: center; color: green;"></td>
<td>N/A</td>
<td>N/A</td>
<td></td>
<td></td>
<td></td>
@ -1313,13 +1313,13 @@
<td style="text-align: center; color: orange;"></td>
<td style="text-align: center; color: orange;"></td>
<td></td>
<td></td>
<td></td>
<td style="text-align: center; color: orange;"></td>
<td style="text-align: center; color: orange;"></td>
<td></td>
<td></td>
<td style="text-align: center; color: orange;"></td>
<td style="text-align: center; color: orange;"></td>
<td></td>
<td style="text-align: center; color: orange;"></td>
<td></td>
<td></td>
<td></td>

View File

@ -3,7 +3,7 @@
## CATEGORY_CUBE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
-------------------------|--------------------------------------
CUBEKPIMEMBER | **Not yet Implemented**
CUBEMEMBER | **Not yet Implemented**
CUBEMEMBERPROPERTY | **Not yet Implemented**
@ -15,174 +15,174 @@ CUBEVALUE | **Not yet Implemented**
## CATEGORY_DATABASE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
DAVERAGE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DAVERAGE
DCOUNT | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNT
DCOUNTA | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNTA
DGET | \PhpOffice\PhpSpreadsheet\Calculation\Database::DGET
DMAX | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMAX
DMIN | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMIN
DPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\Database::DPRODUCT
DSTDEV | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEV
DSTDEVP | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEVP
DSUM | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSUM
DVAR | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVAR
DVARP | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVARP
-------------------------|--------------------------------------
DAVERAGE | \PhpOffice\PhpSpreadsheet\Calculation\Database\DAverage::evaluate
DCOUNT | \PhpOffice\PhpSpreadsheet\Calculation\Database\DCount::evaluate
DCOUNTA | \PhpOffice\PhpSpreadsheet\Calculation\Database\DCountA::evaluate
DGET | \PhpOffice\PhpSpreadsheet\Calculation\Database\DGet::evaluate
DMAX | \PhpOffice\PhpSpreadsheet\Calculation\Database\DMax::evaluate
DMIN | \PhpOffice\PhpSpreadsheet\Calculation\Database\DMin::evaluate
DPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\Database\DProduct::evaluate
DSTDEV | \PhpOffice\PhpSpreadsheet\Calculation\Database\DStDev::evaluate
DSTDEVP | \PhpOffice\PhpSpreadsheet\Calculation\Database\DStDevP::evaluate
DSUM | \PhpOffice\PhpSpreadsheet\Calculation\Database\DSum::evaluate
DVAR | \PhpOffice\PhpSpreadsheet\Calculation\Database\DVar::evaluate
DVARP | \PhpOffice\PhpSpreadsheet\Calculation\Database\DVarP::evaluate
## CATEGORY_DATE_AND_TIME
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
DATE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATE
DATEDIF | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEDIF
DATEVALUE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEVALUE
DAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYOFMONTH
DAYS | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS
DAYS360 | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS360
EDATE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EDATE
EOMONTH | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EOMONTH
HOUR | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::HOUROFDAY
ISOWEEKNUM | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::ISOWEEKNUM
MINUTE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MINUTE
MONTH | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MONTHOFYEAR
NETWORKDAYS | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::NETWORKDAYS
-------------------------|--------------------------------------
DATE | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Date::fromYMD
DATEDIF | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Difference::interval
DATEVALUE | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\DateValue::fromString
DAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\DateParts::day
DAYS | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Days::between
DAYS360 | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Days360::between
EDATE | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Month::adjust
EOMONTH | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Month::lastDay
HOUR | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\TimeParts::hour
ISOWEEKNUM | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Week::isoWeekNumber
MINUTE | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\TimeParts::minute
MONTH | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\DateParts::month
NETWORKDAYS | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\NetworkDays::count
NETWORKDAYS.INTL | **Not yet Implemented**
NOW | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATETIMENOW
SECOND | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::SECOND
TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIME
TIMEVALUE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIMEVALUE
TODAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATENOW
WEEKDAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKDAY
WEEKNUM | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKNUM
WORKDAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WORKDAY
NOW | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Current::now
SECOND | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\TimeParts::second
TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Time::fromHMS
TIMEVALUE | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\TimeValue::fromString
TODAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Current::today
WEEKDAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Week::day
WEEKNUM | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Week::number
WORKDAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\WorkDay::date
WORKDAY.INTL | **Not yet Implemented**
YEAR | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEAR
YEARFRAC | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEARFRAC
YEAR | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\DateParts::year
YEARFRAC | \PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\YearFrac::fraction
## CATEGORY_ENGINEERING
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
BESSELI | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELI
BESSELJ | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELJ
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\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::BITOR
COMPLEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::COMPLEX
CONVERT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::CONVERTUOM
DEC2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOBIN
DEC2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOHEX
DEC2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOOCT
DELTA | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DELTA
ERF | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERF
ERF.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFPRECISE
ERFC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC
ERFC.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC
GESTEP | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::GESTEP
HEX2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOBIN
HEX2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTODEC
HEX2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOOCT
IMABS | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMABS
IMAGINARY | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMAGINARY
IMARGUMENT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMARGUMENT
IMCONJUGATE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCONJUGATE
IMCOS | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOS
IMCOSH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOSH
IMCOT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOT
IMCSC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSC
IMCSCH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSCH
IMDIV | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMDIV
IMEXP | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMEXP
IMLN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLN
IMLOG10 | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG10
IMLOG2 | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG2
IMPOWER | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPOWER
IMPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPRODUCT
IMREAL | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMREAL
IMSEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSEC
IMSECH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSECH
IMSIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSIN
IMSINH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSINH
IMSQRT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSQRT
IMSUB | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUB
IMSUM | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUM
IMTAN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMTAN
OCT2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOBIN
OCT2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTODEC
OCT2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOHEX
-------------------------|--------------------------------------
BESSELI | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\BesselI::BESSELI
BESSELJ | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\BesselJ::BESSELJ
BESSELK | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\BesselK::BESSELK
BESSELY | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\BesselY::BESSELY
BIN2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertBinary::toDecimal
BIN2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertBinary::toHex
BIN2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertBinary::toOctal
BITAND | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\BitWise::BITAND
BITLSHIFT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\BitWise::BITLSHIFT
BITOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\BitWise::BITOR
BITRSHIFT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\BitWise::BITRSHIFT
BITXOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\BitWise::BITXOR
COMPLEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\Complex::COMPLEX
CONVERT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertUOM::CONVERT
DEC2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertDecimal::toBinary
DEC2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertDecimal::toHex
DEC2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertDecimal::toOctal
DELTA | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\Compare::DELTA
ERF | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\Erf::ERF
ERF.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\Erf::ERFPRECISE
ERFC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ErfC::ERFC
ERFC.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ErfC::ERFC
GESTEP | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\Compare::GESTEP
HEX2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertHex::toBinary
HEX2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertHex::toDecimal
HEX2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertHex::toOctal
IMABS | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMABS
IMAGINARY | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\Complex::IMAGINARY
IMARGUMENT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMARGUMENT
IMCONJUGATE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMCONJUGATE
IMCOS | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMCOS
IMCOSH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMCOSH
IMCOT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMCOT
IMCSC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMCSC
IMCSCH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMCSCH
IMDIV | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexOperations::IMDIV
IMEXP | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMEXP
IMLN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMLN
IMLOG10 | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMLOG10
IMLOG2 | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMLOG2
IMPOWER | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMPOWER
IMPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexOperations::IMPRODUCT
IMREAL | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\Complex::IMREAL
IMSEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMSEC
IMSECH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMSECH
IMSIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMSIN
IMSINH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMSINH
IMSQRT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMSQRT
IMSUB | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexOperations::IMSUB
IMSUM | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexOperations::IMSUM
IMTAN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ComplexFunctions::IMTAN
OCT2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertOctal::toBinary
OCT2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertOctal::toDecimal
OCT2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertOctal::toHex
## CATEGORY_FINANCIAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
ACCRINT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINT
ACCRINTM | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINTM
AMORDEGRC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORDEGRC
AMORLINC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORLINC
COUPDAYBS | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYBS
COUPDAYS | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYS
COUPDAYSNC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYSNC
COUPNCD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNCD
COUPNUM | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNUM
COUPPCD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPPCD
CUMIPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMIPMT
CUMPRINC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMPRINC
DB | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DB
DDB | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DDB
DISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DISC
DOLLARDE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARDE
DOLLARFR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARFR
-------------------------|--------------------------------------
ACCRINT | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\AccruedInterest::periodic
ACCRINTM | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\AccruedInterest::atMaturity
AMORDEGRC | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Amortization::AMORDEGRC
AMORLINC | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Amortization::AMORLINC
COUPDAYBS | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Coupons::COUPDAYBS
COUPDAYS | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Coupons::COUPDAYS
COUPDAYSNC | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Coupons::COUPDAYSNC
COUPNCD | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Coupons::COUPNCD
COUPNUM | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Coupons::COUPNUM
COUPPCD | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Coupons::COUPPCD
CUMIPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic\Cumulative::interest
CUMPRINC | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic\Cumulative::principal
DB | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Depreciation::DB
DDB | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Depreciation::DDB
DISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\Rates::discount
DOLLARDE | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Dollar::decimal
DOLLARFR | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Dollar::fractional
DURATION | **Not yet Implemented**
EFFECT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::EFFECT
FV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FV
FVSCHEDULE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FVSCHEDULE
INTRATE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::INTRATE
IPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IPMT
IRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IRR
ISPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ISPMT
EFFECT | \PhpOffice\PhpSpreadsheet\Calculation\Financial\InterestRate::effective
FV | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic::futureValue
FVSCHEDULE | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Single::futureValue
INTRATE | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\Rates::interest
IPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic\Interest::payment
IRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Variable\Periodic::rate
ISPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic\Interest::schedulePayment
MDURATION | **Not yet Implemented**
MIRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::MIRR
NOMINAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NOMINAL
NPER | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPER
NPV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPV
MIRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Variable\Periodic::modifiedRate
NOMINAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial\InterestRate::nominal
NPER | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic::periods
NPV | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Variable\Periodic::presentValue
ODDFPRICE | **Not yet Implemented**
ODDFYIELD | **Not yet Implemented**
ODDLPRICE | **Not yet Implemented**
ODDLYIELD | **Not yet Implemented**
PDURATION | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PDURATION
PMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PMT
PPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PPMT
PRICE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICE
PRICEDISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEDISC
PRICEMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEMAT
PV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PV
RATE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RATE
RECEIVED | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RECEIVED
RRI | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RRI
SLN | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SLN
SYD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SYD
TBILLEQ | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLEQ
TBILLPRICE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLPRICE
TBILLYIELD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLYIELD
USDOLLAR | **Not yet Implemented**
PDURATION | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Single::periods
PMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic\Payments::annuity
PPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic\Payments::interestPayment
PRICE | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\Price::price
PRICEDISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\Price::priceDiscounted
PRICEMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\Price::priceAtMaturity
PV | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic::presentValue
RATE | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Constant\Periodic\Interest::rate
RECEIVED | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\Price::received
RRI | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Single::interestRate
SLN | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Depreciation::SLN
SYD | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Depreciation::SYD
TBILLEQ | \PhpOffice\PhpSpreadsheet\Calculation\Financial\TreasuryBill::bondEquivalentYield
TBILLPRICE | \PhpOffice\PhpSpreadsheet\Calculation\Financial\TreasuryBill::price
TBILLYIELD | \PhpOffice\PhpSpreadsheet\Calculation\Financial\TreasuryBill::yield
USDOLLAR | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Dollar::format
VDB | **Not yet Implemented**
XIRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XIRR
XNPV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XNPV
XIRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Variable\NonPeriodic::rate
XNPV | \PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Variable\NonPeriodic::presentValue
YIELD | **Not yet Implemented**
YIELDDISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDDISC
YIELDMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDMAT
YIELDDISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\Yields::yieldDiscounted
YIELDMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities\Yields::yieldAtMaturity
## CATEGORY_INFORMATION
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
-------------------------|--------------------------------------
CELL | **Not yet Implemented**
ERROR.TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::errorType
INFO | **Not yet Implemented**
@ -207,338 +207,340 @@ TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::TYPE
## CATEGORY_LOGICAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
FALSE | \PhpOffice\PhpSpreadsheet\Calculation\Logical::FALSE
IF | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementIf
IFERROR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFERROR
IFNA | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFNA
IFS | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFS
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
-------------------------|--------------------------------------
AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Operations::logicalAnd
FALSE | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Boolean::FALSE
IF | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Conditional::statementIf
IFERROR | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Conditional::IFERROR
IFNA | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Conditional::IFNA
IFS | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Conditional::IFS
NOT | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Operations::NOT
OR | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Operations::logicalOr
SWITCH | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Conditional::statementSwitch
TRUE | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Boolean::TRUE
XOR | \PhpOffice\PhpSpreadsheet\Calculation\Logical\Operations::logicalXor
## CATEGORY_LOOKUP_AND_REFERENCE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
ADDRESS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::cellAddress
-------------------------|--------------------------------------
ADDRESS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Address::cell
AREAS | **Not yet Implemented**
CHOOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CHOOSE
COLUMN | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMN
COLUMNS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMNS
CHOOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Selection::CHOOSE
COLUMN | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\RowColumnInformation::COLUMN
COLUMNS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\RowColumnInformation::COLUMNS
FILTER | **Not yet Implemented**
FORMULATEXT | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::FORMULATEXT
FORMULATEXT | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Formula::text
GETPIVOTDATA | **Not yet Implemented**
HLOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HLOOKUP
HYPERLINK | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HYPERLINK
INDEX | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDEX
INDIRECT | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDIRECT
LOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::LOOKUP
MATCH | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::MATCH
OFFSET | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::OFFSET
ROW | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROW
ROWS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROWS
HLOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\HLookup::lookup
HYPERLINK | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Hyperlink::set
INDEX | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Matrix::index
INDIRECT | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Indirect::INDIRECT
LOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Lookup::lookup
MATCH | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\ExcelMatch::MATCH
OFFSET | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Offset::OFFSET
ROW | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\RowColumnInformation::ROW
ROWS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\RowColumnInformation::ROWS
RTD | **Not yet Implemented**
SORT | **Not yet Implemented**
SORTBY | **Not yet Implemented**
TRANSPOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::TRANSPOSE
TRANSPOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Matrix::transpose
UNIQUE | **Not yet Implemented**
VLOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::VLOOKUP
VLOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef\VLookup::lookup
XLOOKUP | **Not yet Implemented**
XMATCH | **Not yet Implemented**
## CATEGORY_MATH_AND_TRIG
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
ABS | abs
ACOS | acos
ACOSH | acosh
ACOT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOT
ACOTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOTH
-------------------------|--------------------------------------
ABS | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Absolute::evaluate
ACOS | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cosine::acos
ACOSH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cosine::acosh
ACOT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cotangent::acot
ACOTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cotangent::acoth
AGGREGATE | **Not yet Implemented**
ARABIC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ARABIC
ASIN | asin
ASINH | asinh
ATAN | atan
ATAN2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ATAN2
ATANH | atanh
BASE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::BASE
CEILING | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CEILING
CEILING.MATH | **Not yet Implemented**
CEILING.PRECISE | **Not yet Implemented**
COMBIN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COMBIN
COMBINA | **Not yet Implemented**
COS | cos
COSH | cosh
COT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COT
COTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COTH
CSC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSC
CSCH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSCH
ARABIC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Arabic::evaluate
ASIN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Sine::asin
ASINH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Sine::asinh
ATAN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Tangent::atan
ATAN2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Tangent::atan2
ATANH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Tangent::atanh
BASE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Base::evaluate
CEILING | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Ceiling::ceiling
CEILING.MATH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Ceiling::math
CEILING.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Ceiling::precise
COMBIN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Combinations::withoutRepetition
COMBINA | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Combinations::withRepetition
COS | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cosine::cos
COSH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cosine::cosh
COT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cotangent::cot
COTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cotangent::coth
CSC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cosecant::csc
CSCH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Cosecant::csch
DECIMAL | **Not yet Implemented**
DEGREES | rad2deg
EVEN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::EVEN
EXP | exp
FACT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACT
FACTDOUBLE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACTDOUBLE
FLOOR | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FLOOR
FLOOR.MATH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FLOORMATH
FLOOR.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FLOORPRECISE
GCD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::GCD
INT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::INT
DEGREES | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Angle::toDegrees
ECMA.CEILING | **Not yet Implemented**
EVEN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Round::even
EXP | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Exp::evaluate
FACT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Factorial::fact
FACTDOUBLE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Factorial::factDouble
FLOOR | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Floor::floor
FLOOR.MATH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Floor::math
FLOOR.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Floor::precise
GCD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Gcd::evaluate
INT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\IntClass::evaluate
ISO.CEILING | **Not yet Implemented**
LCM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LCM
LN | log
LOG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::logBase
LOG10 | log10
MDETERM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MDETERM
MINVERSE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MINVERSE
MMULT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MMULT
MOD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MOD
MROUND | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MROUND
MULTINOMIAL | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MULTINOMIAL
MUNIT | **Not yet Implemented**
ODD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ODD
LCM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Lcm::evaluate
LN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Logarithms::natural
LOG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Logarithms::withBase
LOG10 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Logarithms::base10
MDETERM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\MatrixFunctions::determinant
MINVERSE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\MatrixFunctions::inverse
MMULT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\MatrixFunctions::multiply
MOD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Operations::mod
MROUND | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Round::multiple
MULTINOMIAL | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Factorial::multinomial
MUNIT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\MatrixFunctions::identity
ODD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Round::odd
PI | pi
POWER | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::POWER
PRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::PRODUCT
QUOTIENT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::QUOTIENT
RADIANS | deg2rad
RAND | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND
POWER | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Operations::power
PRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Operations::product
QUOTIENT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Operations::quotient
RADIANS | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Angle::toRadians
RAND | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Random::rand
RANDARRAY | **Not yet Implemented**
RANDBETWEEN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND
ROMAN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROMAN
ROUND | round
ROUNDDOWN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDDOWN
ROUNDUP | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDUP
SEC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SEC
SECH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SECH
SERIESSUM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SERIESSUM
RANDBETWEEN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Random::randBetween
ROMAN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Roman::evaluate
ROUND | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Round::round
ROUNDDOWN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Round::down
ROUNDUP | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Round::up
SEC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Secant::sec
SECH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Secant::sech
SEQUENCE | **Not yet Implemented**
SIGN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SIGN
SIN | sin
SINH | sinh
SQRT | sqrt
SQRTPI | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SQRTPI
SUBTOTAL | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUBTOTAL
SUM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUM
SUMIF | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIF
SUMIFS | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIFS
SUMPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMPRODUCT
SUMSQ | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMSQ
SUMX2MY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2MY2
SUMX2PY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2PY2
SUMXMY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMXMY2
TAN | tan
TANH | tanh
TRUNC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::TRUNC
SERIESSUM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\SeriesSum::evaluate
SIGN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Sign::evaluate
SIN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Sine::sin
SINH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Sine::sinh
SQRT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Sqrt::sqrt
SQRTPI | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Sqrt::pi
SUBTOTAL | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Subtotal::evaluate
SUM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Sum::sumErroringStrings
SUMIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional::SUMIF
SUMIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional::SUMIFS
SUMPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Sum::product
SUMSQ | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\SumSquares::sumSquare
SUMX2MY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\SumSquares::sumXSquaredMinusYSquared
SUMX2PY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\SumSquares::sumXSquaredPlusYSquared
SUMXMY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\SumSquares::sumXMinusYSquared
TAN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Tangent::tan
TANH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig\Tangent::tanh
TRUNC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trunc::evaluate
## CATEGORY_STATISTICAL
Excel Function | PhpSpreadsheet Function
-------------------------|-------------------------------------------
AVEDEV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVEDEV
AVERAGE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGE
AVERAGEA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEA
AVERAGEIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEIF
AVERAGEIFS | **Not yet Implemented**
BETADIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETADIST
BETA.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETADIST
BETAINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETAINV
BETA.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETAINV
BINOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BINOMDIST
BINOM.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BINOMDIST
BINOM.DIST.RANGE | **Not yet Implemented**
BINOM.INV | **Not yet Implemented**
CHIDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIDIST
CHISQ.DIST | **Not yet Implemented**
CHISQ.DIST.RT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIDIST
CHIINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIINV
CHISQ.INV | **Not yet Implemented**
CHISQ.INV.RT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIINV
CHITEST | **Not yet Implemented**
CHISQ.TEST | **Not yet Implemented**
CONFIDENCE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CONFIDENCE
CONFIDENCE.NORM | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CONFIDENCE
-------------------------|--------------------------------------
AVEDEV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages::averageDeviations
AVERAGE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages::average
AVERAGEA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages::averageA
AVERAGEIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional::AVERAGEIF
AVERAGEIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional::AVERAGEIFS
BETA.DIST | **Not yet Implemented**
BETA.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Beta::inverse
BETADIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Beta::distribution
BETAINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Beta::inverse
BINOM.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Binomial::distribution
BINOM.DIST.RANGE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Binomial::range
BINOM.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Binomial::inverse
BINOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Binomial::distribution
CHIDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\ChiSquared::distributionRightTail
CHIINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\ChiSquared::inverseRightTail
CHISQ.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\ChiSquared::distributionLeftTail
CHISQ.DIST.RT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\ChiSquared::distributionRightTail
CHISQ.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\ChiSquared::inverseLeftTail
CHISQ.INV.RT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\ChiSquared::inverseRightTail
CHISQ.TEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\ChiSquared::test
CHITEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\ChiSquared::test
CONFIDENCE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Confidence::CONFIDENCE
CONFIDENCE.NORM | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Confidence::CONFIDENCE
CONFIDENCE.T | **Not yet Implemented**
CORREL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL
COUNT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNT
COUNTA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTA
COUNTBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTBLANK
COUNTIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTIF
COUNTIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTIFS
COVAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COVAR
COVARIANCE.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COVAR
CORREL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::CORREL
COUNT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Counts::COUNT
COUNTA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Counts::COUNTA
COUNTBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Counts::COUNTBLANK
COUNTIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional::COUNTIF
COUNTIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional::COUNTIFS
COVAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::COVAR
COVARIANCE.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::COVAR
COVARIANCE.S | **Not yet Implemented**
CRITBINOM | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CRITBINOM
DEVSQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::DEVSQ
EXPONDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::EXPONDIST
EXPON.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::EXPONDIST
FDIST | **Not yet Implemented**
F.DIST | **Not yet Implemented**
CRITBINOM | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Binomial::inverse
DEVSQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Deviations::sumSquares
EXPON.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Exponential::distribution
EXPONDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Exponential::distribution
F.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\F::distribution
F.DIST.RT | **Not yet Implemented**
FINV | **Not yet Implemented**
F.INV | **Not yet Implemented**
F.INV.RT | **Not yet Implemented**
F.TEST | **Not yet Implemented**
FISHER | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHER
FISHERINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHERINV
FORECAST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FORECAST
FDIST | **Not yet Implemented**
FINV | **Not yet Implemented**
FISHER | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Fisher::distribution
FISHERINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Fisher::inverse
FORECAST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::FORECAST
FORECAST.ETS | **Not yet Implemented**
FORECAST.ETS.CONFINT | **Not yet Implemented**
FORECAST.ETS.SEASONALITY | **Not yet Implemented**
FORECAST.ETS.STAT | **Not yet Implemented**
FORECAST.LINEAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FORECAST
FORECAST.LINEAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::FORECAST
FREQUENCY | **Not yet Implemented**
FTEST | **Not yet Implemented**
GAMMA | **Not yet Implemented**
GAMMADIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMADIST
GAMMA.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMADIST
GAMMAINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMAINV
GAMMA.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMAINV
GAMMALN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMALN
GAMMALN.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMALN
GAUSS | **Not yet Implemented**
GEOMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GEOMEAN
GROWTH | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GROWTH
HARMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HARMEAN
HYPGEOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HYPGEOMDIST
INTERCEPT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::INTERCEPT
KURT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::KURT
LARGE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LARGE
LINEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LINEST
LOGEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGEST
LOGINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGINV
LOGNORMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGNORMDIST
LOGNORM.DIST | **Not yet Implemented**
LOGNORM.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGINV
MAX | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAX
MAXA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXA
MAXIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXIFS
MEDIAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MEDIAN
GAMMA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Gamma::gamma
GAMMA.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Gamma::distribution
GAMMA.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Gamma::inverse
GAMMADIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Gamma::distribution
GAMMAINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Gamma::inverse
GAMMALN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Gamma::ln
GAMMALN.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Gamma::ln
GAUSS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StandardNormal::gauss
GEOMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages\Mean::geometric
GROWTH | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::GROWTH
HARMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages\Mean::harmonic
HYPGEOM.DIST | **Not yet Implemented**
HYPGEOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\HyperGeometric::distribution
INTERCEPT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::INTERCEPT
KURT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Deviations::kurtosis
LARGE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Size::large
LINEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::LINEST
LOGEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::LOGEST
LOGINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\LogNormal::inverse
LOGNORM.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\LogNormal::distribution
LOGNORM.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\LogNormal::inverse
LOGNORMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\LogNormal::cumulative
MAX | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Maximum::max
MAXA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Maximum::maxA
MAXIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional::MAXIFS
MEDIAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages::median
MEDIANIF | **Not yet Implemented**
MIN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MIN
MINA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINA
MINIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINIFS
MODE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE
MIN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Minimum::min
MINA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Minimum::minA
MINIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional::MINIFS
MODE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages::mode
MODE.MULT | **Not yet Implemented**
MODE.SNGL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE
NEGBINOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NEGBINOMDIST
MODE.SNGL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages::mode
NEGBINOM.DIST | **Not yet Implemented**
NORMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMDIST
NORM.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMDIST
NORMINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMINV
NORM.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMINV
NORMSDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSDIST
NORM.S.DIST | **Not yet Implemented**
NORMSINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSINV
NORM.S.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSINV
PEARSON | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL
PERCENTILE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTILE
NEGBINOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Binomial::negative
NORM.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Normal::distribution
NORM.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Normal::inverse
NORM.S.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StandardNormal::distribution
NORM.S.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StandardNormal::inverse
NORMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Normal::distribution
NORMINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Normal::inverse
NORMSDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StandardNormal::cumulative
NORMSINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StandardNormal::inverse
PEARSON | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::CORREL
PERCENTILE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Percentiles::PERCENTILE
PERCENTILE.EXC | **Not yet Implemented**
PERCENTILE.INC | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTILE
PERCENTRANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTRANK
PERCENTILE.INC | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Percentiles::PERCENTILE
PERCENTRANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Percentiles::PERCENTRANK
PERCENTRANK.EXC | **Not yet Implemented**
PERCENTRANK.INC | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTRANK
PERMUT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERMUT
PERMUTATIONA | **Not yet Implemented**
PERCENTRANK.INC | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Percentiles::PERCENTRANK
PERMUT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Permutations::PERMUT
PERMUTATIONA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Permutations::PERMUTATIONA
PHI | **Not yet Implemented**
POISSON | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::POISSON
POISSON.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::POISSON
POISSON | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Poisson::distribution
POISSON.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Poisson::distribution
PROB | **Not yet Implemented**
QUARTILE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::QUARTILE
QUARTILE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Percentiles::QUARTILE
QUARTILE.EXC | **Not yet Implemented**
QUARTILE.INC | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::QUARTILE
RANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RANK
QUARTILE.INC | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Percentiles::QUARTILE
RANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Percentiles::RANK
RANK.AVG | **Not yet Implemented**
RANK.EQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RANK
RSQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RSQ
SKEW | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SKEW
RANK.EQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Percentiles::RANK
RSQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::RSQ
SKEW | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Deviations::skew
SKEW.P | **Not yet Implemented**
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.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
STEYX | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STEYX
TDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TDIST
SLOPE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::SLOPE
SMALL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Size::small
STANDARDIZE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Standardize::execute
STDEV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\StandardDeviations::STDEV
STDEV.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\StandardDeviations::STDEVP
STDEV.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\StandardDeviations::STDEV
STDEVA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\StandardDeviations::STDEVA
STDEVP | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\StandardDeviations::STDEVP
STDEVPA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\StandardDeviations::STDEVPA
STEYX | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::STEYX
T.DIST | **Not yet Implemented**
T.DIST.2T | **Not yet Implemented**
T.DIST.RT | **Not yet Implemented**
TINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TINV
T.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TINV
T.INV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StudentT::inverse
T.INV.2T | **Not yet Implemented**
TREND | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TREND
TRIMMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TRIMMEAN
TTEST | **Not yet Implemented**
T.TEST | **Not yet Implemented**
VAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc
VAR.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP
VAR.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc
VARA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARA
VARP | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP
VARPA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARPA
WEIBULL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::WEIBULL
WEIBULL.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::WEIBULL
ZTEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::ZTEST
Z.TEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::ZTEST
TDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StudentT::distribution
TINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StudentT::inverse
TREND | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Trends::TREND
TRIMMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages\Mean::trim
TTEST | **Not yet Implemented**
VAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Variances::VAR
VAR.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Variances::VARP
VAR.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Variances::VAR
VARA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Variances::VARA
VARP | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Variances::VARP
VARPA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Variances::VARPA
WEIBULL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Weibull::distribution
WEIBULL.DIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\Weibull::distribution
Z.TEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StandardNormal::zTest
ZTEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\StandardNormal::zTest
## CATEGORY_TEXT_AND_DATA
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
-------------------------|--------------------------------------
ASC | **Not yet Implemented**
BAHTTEXT | **Not yet Implemented**
CHAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER
CLEAN | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMNONPRINTABLE
CODE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE
CONCAT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE
CONCATENATE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE
CHAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData\CharacterConvert::character
CLEAN | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Trim::nonPrintable
CODE | \PhpOffice\PhpSpreadsheet\Calculation\TextData\CharacterConvert::code
CONCAT | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Concatenate::CONCATENATE
CONCATENATE | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Concatenate::CONCATENATE
DBCS | **Not yet Implemented**
DOLLAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData::DOLLAR
EXACT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::EXACT
FIND | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE
FINDB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE
FIXED | \PhpOffice\PhpSpreadsheet\Calculation\TextData::FIXEDFORMAT
DOLLAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Format::DOLLAR
EXACT | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Text::exact
FIND | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Search::sensitive
FINDB | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Search::sensitive
FIXED | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Format::FIXEDFORMAT
JIS | **Not yet Implemented**
LEFT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT
LEFTB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT
LEN | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH
LENB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH
LOWER | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LOWERCASE
MID | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID
MIDB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID
NUMBERVALUE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::NUMBERVALUE
LEFT | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Extract::left
LEFTB | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Extract::left
LEN | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Text::length
LENB | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Text::length
LOWER | \PhpOffice\PhpSpreadsheet\Calculation\TextData\CaseConvert::lower
MID | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Extract::mid
MIDB | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Extract::mid
NUMBERVALUE | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Format::NUMBERVALUE
PHONETIC | **Not yet Implemented**
PROPER | \PhpOffice\PhpSpreadsheet\Calculation\TextData::PROPERCASE
REPLACE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE
REPLACEB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE
REPT | str_repeat
RIGHT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT
RIGHTB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT
SEARCH | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE
SEARCHB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE
SUBSTITUTE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SUBSTITUTE
T | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RETURNSTRING
TEXT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTFORMAT
TEXTJOIN | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTJOIN
TRIM | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMSPACES
UNICHAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER
UNICODE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE
UPPER | \PhpOffice\PhpSpreadsheet\Calculation\TextData::UPPERCASE
VALUE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::VALUE
PROPER | \PhpOffice\PhpSpreadsheet\Calculation\TextData\CaseConvert::proper
REPLACE | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Replace::replace
REPLACEB | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Replace::replace
REPT | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Concatenate::builtinREPT
RIGHT | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Extract::right
RIGHTB | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Extract::right
SEARCH | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Search::insensitive
SEARCHB | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Search::insensitive
SUBSTITUTE | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Replace::substitute
T | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Text::test
TEXT | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Format::TEXTFORMAT
TEXTJOIN | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Concatenate::TEXTJOIN
TRIM | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Trim::spaces
UNICHAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData\CharacterConvert::character
UNICODE | \PhpOffice\PhpSpreadsheet\Calculation\TextData\CharacterConvert::code
UPPER | \PhpOffice\PhpSpreadsheet\Calculation\TextData\CaseConvert::upper
VALUE | \PhpOffice\PhpSpreadsheet\Calculation\TextData\Format::VALUE
## CATEGORY_WEB
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
ENCODEURL | **Not yet Implemented**
-------------------------|--------------------------------------
ENCODEURL | \PhpOffice\PhpSpreadsheet\Calculation\Web\Service::urlEncode
FILTERXML | **Not yet Implemented**
WEBSERVICE | \PhpOffice\PhpSpreadsheet\Calculation\Web::WEBSERVICE
WEBSERVICE | \PhpOffice\PhpSpreadsheet\Calculation\Web\Service::webService

File diff suppressed because it is too large Load Diff

View File

@ -201,7 +201,7 @@ $spreadsheet->getActiveSheet()->setCellValue('B8',$internalFormula);
```
Currently, formula translation only translates the function names, the
constants TRUE and FALSE, and the function argument separators.
constants TRUE and FALSE, and the function argument separators. Cell addressing using R1C1 formatting is not supported.
At present, the following locale settings are supported:
@ -216,7 +216,7 @@ French | Français | fr
Hungarian | Magyar | hu
Italian | Italiano | it
Dutch | Nederlands | nl
Norwegian | Norsk | no
Norwegian | Norsk Bokmål | nb
Polish | Jezyk polski | pl
Portuguese | Português | pt
Brazilian Portuguese | Português Brasileiro | pt_br

331
infra/LocaleGenerator.php Normal file
View File

@ -0,0 +1,331 @@
<?php
namespace PhpOffice\PhpSpreadsheetInfra;
use Exception;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Column;
use PhpOffice\PhpSpreadsheet\Worksheet\Row;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class LocaleGenerator
{
private const EXCEL_LOCALISATION_WORKSHEET = 'Excel Localisation';
private const EXCEL_FUNCTIONS_WORKSHEET = 'Excel Functions';
private const LOCALE_NAME_ROW = 1;
private const LOCALE_LANGUAGE_NAME_ROW = 2;
private const ENGLISH_LANGUAGE_NAME_ROW = 3;
private const ARGUMENT_SEPARATOR_ROW = 5;
private const ERROR_CODES_FIRST_ROW = 8;
private const FUNCTION_NAME_LIST_FIRST_ROW = 4;
private const ENGLISH_FUNCTION_CATEGORIES_COLUMN = 'A';
private const ENGLISH_REFERENCE_COLUMN = 'B';
/**
* @var string
*/
protected $translationSpreadsheetName;
/**
* @var string
*/
protected $translationBaseFolder;
protected $phpSpreadsheetFunctions;
/**
* @var Spreadsheet
*/
protected $translationSpreadsheet;
/**
* @var Worksheet
*/
protected $localeTranslations;
protected $localeLanguageMap = [];
protected $errorCodeMap = [];
/**
* @var Worksheet
*/
private $functionNameTranslations;
protected $functionNameLanguageMap = [];
protected $functionNameMap = [];
public function __construct(
string $translationBaseFolder,
string $translationSpreadsheetName,
array $phpSpreadsheetFunctions
) {
$this->translationBaseFolder = $translationBaseFolder;
$this->translationSpreadsheetName = $translationSpreadsheetName;
$this->phpSpreadsheetFunctions = $phpSpreadsheetFunctions;
}
public function generateLocales(): void
{
$this->openTranslationWorkbook();
$this->localeTranslations = $this->getTranslationSheet(self::EXCEL_LOCALISATION_WORKSHEET);
$this->localeLanguageMap = $this->mapLanguageColumns($this->localeTranslations);
$this->mapErrorCodeRows();
$this->functionNameTranslations = $this->getTranslationSheet(self::EXCEL_FUNCTIONS_WORKSHEET);
$this->functionNameLanguageMap = $this->mapLanguageColumns($this->functionNameTranslations);
$this->mapFunctionNameRows();
foreach ($this->localeLanguageMap as $column => $locale) {
$this->buildConfigFileForLocale($column, $locale);
}
foreach ($this->functionNameLanguageMap as $column => $locale) {
$this->buildFunctionsFileForLocale($column, $locale);
}
}
protected function buildConfigFileForLocale($column, $locale): void
{
$language = $this->localeTranslations->getCell($column . self::ENGLISH_LANGUAGE_NAME_ROW)->getValue();
$localeLanguage = $this->localeTranslations->getCell($column . self::LOCALE_LANGUAGE_NAME_ROW)->getValue();
$configFile = $this->openConfigFile($locale, $language, $localeLanguage);
$this->writeConfigArgumentSeparator($configFile, $column);
$this->writeFileSectionHeader($configFile, 'Error Codes');
foreach ($this->errorCodeMap as $errorCode => $row) {
$translationCell = $this->localeTranslations->getCell($column . $row);
$translationValue = $translationCell->getValue();
if (!empty($translationValue)) {
$errorCodeTranslation = "{$errorCode} = {$translationValue}" . PHP_EOL;
fwrite($configFile, $errorCodeTranslation);
} else {
$errorCodeTranslation = "{$errorCode}" . PHP_EOL;
fwrite($configFile, $errorCodeTranslation);
echo "No {$language} translation available for error code {$errorCode}", PHP_EOL;
}
}
fclose($configFile);
}
protected function writeConfigArgumentSeparator($configFile, $column): void
{
$translationCell = $this->localeTranslations->getCell($column . self::ARGUMENT_SEPARATOR_ROW);
$localeValue = $translationCell->getValue();
if (!empty($localeValue)) {
$functionTranslation = "ArgumentSeparator = {$localeValue}" . PHP_EOL;
fwrite($configFile, $functionTranslation);
} else {
echo 'No Argument Separator defined', PHP_EOL;
}
}
protected function buildFunctionsFileForLocale($column, $locale): void
{
$language = $this->functionNameTranslations->getCell($column . self::ENGLISH_LANGUAGE_NAME_ROW)->getValue();
$localeLanguage = $this->functionNameTranslations->getCell($column . self::LOCALE_LANGUAGE_NAME_ROW)
->getValue();
$functionFile = $this->openFunctionNameFile($locale, $language, $localeLanguage);
foreach ($this->functionNameMap as $functionName => $row) {
$translationCell = $this->functionNameTranslations->getCell($column . $row);
$translationValue = $translationCell->getValue();
if ($this->isFunctionCategoryEntry($translationCell)) {
$this->writeFileSectionHeader($functionFile, "{$translationValue} ({$functionName})");
} elseif (!array_key_exists($functionName, $this->phpSpreadsheetFunctions)) {
echo "Function {$functionName} is not defined in PhpSpreadsheet", PHP_EOL;
} elseif (!empty($translationValue)) {
$functionTranslation = "{$functionName} = {$translationValue}" . PHP_EOL;
fwrite($functionFile, $functionTranslation);
} else {
echo "No {$language} translation available for function {$functionName}", PHP_EOL;
}
}
fclose($functionFile);
}
protected function openConfigFile(string $locale, string $language, string $localeLanguage)
{
echo "Building locale {$locale} ($language) configuration", PHP_EOL;
$localeFolder = $this->getLocaleFolder($locale);
$configFileName = realpath($localeFolder . DIRECTORY_SEPARATOR . 'config');
echo "Writing locale configuration to {$configFileName}", PHP_EOL;
$configFile = fopen($configFileName, 'wb');
$this->writeFileHeader($configFile, $localeLanguage, $language, 'locale settings');
return $configFile;
}
protected function openFunctionNameFile(string $locale, string $language, string $localeLanguage)
{
echo "Building locale {$locale} ($language) function names", PHP_EOL;
$localeFolder = $this->getLocaleFolder($locale);
$functionFileName = realpath($localeFolder . DIRECTORY_SEPARATOR . 'functions');
echo "Writing local function names to {$functionFileName}", PHP_EOL;
$functionFile = fopen($functionFileName, 'wb');
$this->writeFileHeader($functionFile, $localeLanguage, $language, 'function name translations');
return $functionFile;
}
protected function getLocaleFolder(string $locale): string
{
$localeFolder = $this->translationBaseFolder .
DIRECTORY_SEPARATOR .
str_replace('_', DIRECTORY_SEPARATOR, $locale);
if (!file_exists($localeFolder) || !is_dir($localeFolder)) {
mkdir($localeFolder, 0777, true);
}
return $localeFolder;
}
protected function writeFileHeader($localeFile, string $localeLanguage, string $language, string $title): void
{
fwrite($localeFile, str_repeat('#', 60) . PHP_EOL);
fwrite($localeFile, '##' . PHP_EOL);
fwrite($localeFile, "## PhpSpreadsheet - {$title}" . PHP_EOL);
fwrite($localeFile, '##' . PHP_EOL);
fwrite($localeFile, "## {$localeLanguage} ({$language})" . PHP_EOL);
fwrite($localeFile, '##' . PHP_EOL);
fwrite($localeFile, str_repeat('#', 60) . PHP_EOL . PHP_EOL);
}
protected function writeFileSectionHeader($localeFile, string $header): void
{
fwrite($localeFile, PHP_EOL . '##' . PHP_EOL);
fwrite($localeFile, "## {$header}" . PHP_EOL);
fwrite($localeFile, '##' . PHP_EOL);
}
protected function openTranslationWorkbook(): void
{
$filepathName = $this->translationBaseFolder . '/' . $this->translationSpreadsheetName;
$this->translationSpreadsheet = IOFactory::load($filepathName);
}
protected function getTranslationSheet(string $sheetName): Worksheet
{
$worksheet = $this->translationSpreadsheet->setActiveSheetIndexByName($sheetName);
if ($worksheet === null) {
throw new Exception("{$sheetName} Worksheet not found");
}
return $worksheet;
}
protected function mapLanguageColumns(Worksheet $translationWorksheet): array
{
$sheetName = $translationWorksheet->getTitle();
echo "Mapping Languages for {$sheetName}:", PHP_EOL;
$baseColumn = self::ENGLISH_REFERENCE_COLUMN;
$languagesList = $translationWorksheet->getColumnIterator(++$baseColumn);
$languageNameMap = [];
foreach ($languagesList as $languageColumn) {
/** @var Column $languageColumn */
$cells = $languageColumn->getCellIterator(self::LOCALE_NAME_ROW, self::LOCALE_NAME_ROW);
$cells->setIterateOnlyExistingCells(true);
foreach ($cells as $cell) {
/** @var Cell $cell */
if ($this->localeCanBeSupported($translationWorksheet, $cell)) {
$languageNameMap[$cell->getColumn()] = $cell->getValue();
echo $cell->getColumn(), ' -> ', $cell->getValue(), PHP_EOL;
}
}
}
return $languageNameMap;
}
protected function localeCanBeSupported(Worksheet $worksheet, Cell $cell): bool
{
if ($worksheet->getTitle() === self::EXCEL_LOCALISATION_WORKSHEET) {
// Only provide support for languages that have a function argument separator defined
// in the localisation worksheet
return !empty(
$worksheet->getCell($cell->getColumn() . self::ARGUMENT_SEPARATOR_ROW)->getValue()
);
}
// If we're processing other worksheets, then language support is determined by whether we included the
// language in the map when we were processing the localisation worksheet (which is always processed first)
return in_array($cell->getValue(), $this->localeLanguageMap, true);
}
protected function mapErrorCodeRows(): void
{
echo 'Mapping Error Codes:', PHP_EOL;
$errorList = $this->localeTranslations->getRowIterator(self::ERROR_CODES_FIRST_ROW);
foreach ($errorList as $errorRow) {
/** @var Row $errorList */
$cells = $errorRow->getCellIterator(self::ENGLISH_REFERENCE_COLUMN, self::ENGLISH_REFERENCE_COLUMN);
$cells->setIterateOnlyExistingCells(true);
foreach ($cells as $cell) {
/** @var Cell $cell */
if ($cell->getValue() != '') {
echo $cell->getRow(), ' -> ', $cell->getValue(), PHP_EOL;
$this->errorCodeMap[$cell->getValue()] = $cell->getRow();
}
}
}
}
protected function mapFunctionNameRows(): void
{
echo 'Mapping Functions:', PHP_EOL;
$functionList = $this->functionNameTranslations->getRowIterator(self::FUNCTION_NAME_LIST_FIRST_ROW);
foreach ($functionList as $functionRow) {
/** @var Row $functionRow */
$cells = $functionRow->getCellIterator(self::ENGLISH_REFERENCE_COLUMN, self::ENGLISH_REFERENCE_COLUMN);
$cells->setIterateOnlyExistingCells(true);
foreach ($cells as $cell) {
/** @var Cell $cell */
if ($this->isFunctionCategoryEntry($cell)) {
if (!empty($cell->getValue())) {
echo 'CATEGORY: ', $cell->getValue(), PHP_EOL;
$this->functionNameMap[$cell->getValue()] = $cell->getRow();
}
continue;
}
if ($cell->getValue() != '') {
if (is_bool($cell->getValue())) {
echo $cell->getRow(), ' -> ', ($cell->getValue() ? 'TRUE' : 'FALSE'), PHP_EOL;
$this->functionNameMap[($cell->getValue() ? 'TRUE' : 'FALSE')] = $cell->getRow();
} else {
echo $cell->getRow(), ' -> ', $cell->getValue(), PHP_EOL;
$this->functionNameMap[$cell->getValue()] = $cell->getRow();
}
}
}
}
}
private function isFunctionCategoryEntry(Cell $cell): bool
{
$categoryCheckCell = self::ENGLISH_FUNCTION_CATEGORIES_COLUMN . $cell->getRow();
if ($this->functionNameTranslations->getCell($categoryCheckCell)->getValue() != '') {
return true;
}
return false;
}
}

View File

@ -340,141 +340,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTime\\:\\:NETWORKDAYS\\(\\) has parameter \\$dateArgs with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTime.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTime\\:\\:WORKDAY\\(\\) has parameter \\$dateArgs with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTime.php
-
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
-
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, float\\|int\\|string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
-
message: "#^Parameter \\#1 \\$PHPDateArray of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\DateValue\\:\\:finalResults\\(\\) expects array\\|false, array\\|bool given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
-
message: "#^Parameter \\#1 \\$testVal1 of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustYear\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
-
message: "#^Parameter \\#2 \\$testVal2 of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustYear\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
-
message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:testStringAsNumeric\\(\\) expects string, float\\|int\\|string given\\.$#"
count: 2
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Datefunc.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Day\\:\\:weirdCondition\\(\\) has parameter \\$dateValue with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Day.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustDateByMonths\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustDateByMonths\\(\\) has parameter \\$adjustmentMonths with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustDateByMonths\\(\\) has parameter \\$dateValue with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
-
message: "#^Parameter \\#1 \\$excelTimestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:excelToTimestamp\\(\\) expects float\\|int, bool\\|float given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:validateNumericNull\\(\\) should return float\\|int but returns float\\|int\\|string\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\IsoWeekNum\\:\\:apparentBug\\(\\) has parameter \\$dateValue with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/IsoWeekNum.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\NetworkDays\\:\\:funcNetworkDays\\(\\) has parameter \\$dateArgs with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/NetworkDays.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\NetworkDays\\:\\:applySign\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/NetworkDays.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Time\\:\\:toIntWithNullBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Time.php
-
message: "#^Cannot access offset 0 on array\\<int, string\\>\\|false\\.$#"
count: 3
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php
-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, array\\<int, string\\>\\|false given\\.$#"
count: 2
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\WeekDay\\:\\:validateStyle\\(\\) has parameter \\$style with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WeekDay.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\WorkDay\\:\\:funcWorkDay\\(\\) has parameter \\$dateArgs with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php
-
message: "#^Binary operation \"\\-\" between 7 and int\\|string results in an error\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php
-
message: "#^Binary operation \"\\-\" between 7 and int\\<5, max\\>\\|string results in an error\\.$#"
count: 2
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php
-
message: "#^Binary operation \"\\-\" between 4 and int\\<5, max\\>\\|string results in an error\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php
-
message: "#^Binary operation \"\\-\" between int\\|string and int\\|string results in an error\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php
-
message: "#^Binary operation \"\\*\" between 100 and int\\|string results in an error\\.$#"
count: 2
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engine\\\\Logger\\:\\:writeDebugLog\\(\\) has parameter \\$args with no typehint specified\\.$#"
count: 1
@ -960,16 +825,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Calculation/LookupRef.php
-
message: "#^Call to function is_bool\\(\\) with float\\|int\\|\\(string&numeric\\) will always evaluate to false\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/LookupRef.php
-
message: "#^Cannot call method getCell\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Calculation/LookupRef.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:sheetName\\(\\) has no return typehint specified\\.$#"
count: 1
@ -1120,11 +975,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php
-
message: "#^Parameter \\#3 \\$rowNum of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Matrix\\:\\:extractRowValue\\(\\) expects int, float\\|int\\<0, max\\>\\|string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Matrix\\:\\:extractRowValue\\(\\) has no return typehint specified\\.$#"
count: 1
@ -1230,136 +1080,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\:\\:COMBIN\\(\\) should return int\\|string but returns float\\|int\\|string\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\:\\:EVEN\\(\\) should return int\\|string but returns float\\|string\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\:\\:FACT\\(\\) should return int\\|string but returns float\\|int\\|string\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\:\\:FACTDOUBLE\\(\\) should return int\\|string but returns float\\|int\\|string\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\:\\:MOD\\(\\) should return int\\|string but returns float\\|int\\|string\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\:\\:ODD\\(\\) should return int\\|string but returns float\\|string\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\:\\:SUMIFS\\(\\) should return float\\|string but returns float\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig.php
-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Arabic.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Helpers\\:\\:validateNumericNullBool\\(\\) should return float\\|int but returns float\\|int\\|string\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Helpers\\:\\:validateNumericNullSubstitution\\(\\) should return float\\|int but returns float\\|int\\|string\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Lcm\\:\\:factors\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Lcm\\:\\:factors\\(\\) has parameter \\$value with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Roman\\:\\:romanCut\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Roman.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Roman\\:\\:romanCut\\(\\) has parameter \\$n with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Roman.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Roman\\:\\:romanCut\\(\\) has parameter \\$num with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Roman.php
-
message: "#^Parameter \\#2 \\$precision of function round expects int, float\\|int given\\.$#"
count: 2
path: src/PhpSpreadsheet/Calculation/MathTrig/RoundDown.php
-
message: "#^Parameter \\#2 \\$precision of function round expects int, float\\|int given\\.$#"
count: 2
path: src/PhpSpreadsheet/Calculation/MathTrig/RoundUp.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Subtotal\\:\\:filterHiddenArgs\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Subtotal\\:\\:filterHiddenArgs\\(\\) has parameter \\$args with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Subtotal\\:\\:filterHiddenArgs\\(\\) has parameter \\$cellReference with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Subtotal\\:\\:filterFormulaArgs\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Subtotal\\:\\:filterFormulaArgs\\(\\) has parameter \\$args with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Subtotal\\:\\:filterFormulaArgs\\(\\) has parameter \\$cellReference with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php
-
message: "#^Parameter \\#1 \\$function of function call_user_func_array expects callable\\(\\)\\: mixed, array\\('PhpOffice…'\\|'PhpOffice…'\\|'PhpOffice…'\\|'PhpOffice…'\\|'PhpOffice…'\\|'PhpOffice…'\\|'PhpOffice…'\\|'PhpOffice…', string\\) given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php
-
message: "#^Parameter \\#1 \\$str of function rtrim expects string, int given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php
-
message: "#^Binary operation \"\\-\" between float\\|int and float\\|string results in an error\\.$#"
count: 4
path: src/PhpSpreadsheet/Calculation/Statistical.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:MAXIFS\\(\\) should return float but returns float\\|string\\|null\\.$#"
count: 1
@ -2790,91 +2510,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Csv/Delimiter.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:\\$referenceHelper has no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Parameter \\#1 \\$fp of function fread expects resource, resource\\|false given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:\\$mappings has no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Offset 'No' does not exist on SimpleXMLElement\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Offset 'Unit' does not exist on SimpleXMLElement\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Cannot call method setWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 3
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Offset 'DefaultSizePts' does not exist on SimpleXMLElement\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Cannot call method setRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseBorderAttributes\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseBorderAttributes\\(\\) has parameter \\$borderAttributes with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseRichText\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseRichText\\(\\) has parameter \\$is with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseGnumericColour\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseGnumericColour\\(\\) has parameter \\$gnmColour with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Html\\:\\:\\$rowspan has no typehint specified\\.$#"
count: 1
@ -2990,16 +2625,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Html.php
-
message: "#^Cannot call method setRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 4
path: src/PhpSpreadsheet/Reader/Html.php
-
message: "#^Cannot call method setWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 3
path: src/PhpSpreadsheet/Reader/Html.php
-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Html\\:\\:setBorderStyle\\(\\) expects string, string\\|null given\\.$#"
count: 5
@ -3085,21 +2710,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Ods.php
-
message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#"
count: 7
path: src/PhpSpreadsheet/Reader/Ods.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:convertToExcelAddressValue\\(\\) should return string but returns string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Ods.php
-
message: "#^Parameter \\#3 \\$formula of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:translateSeparator\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Ods.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$officeNs has no typehint specified\\.$#"
count: 1
@ -3240,11 +2850,6 @@ parameters:
count: 3
path: src/PhpSpreadsheet/Reader/Slk.php
-
message: "#^Cannot call method setWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 3
path: src/PhpSpreadsheet/Reader/Slk.php
-
message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\\\SpContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\:\\:getDgContainer\\(\\)\\.$#"
count: 1
@ -3360,6 +2965,36 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Parameter \\#1 \\$description of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:setDescription\\(\\) expects string, int\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Parameter \\#1 \\$modifier of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:setLastModifiedBy\\(\\) expects string, int\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Parameter \\#1 \\$codePage of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\CodePage\\:\\:numberToName\\(\\) expects int, bool\\|int\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Parameter \\#1 \\$category of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:setCategory\\(\\) expects string, bool\\|int\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Parameter \\#1 \\$manager of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:setManager\\(\\) expects string, bool\\|int\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Parameter \\#1 \\$company of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:setCompany\\(\\) expects string, bool\\|int\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, int\\|string\\|null given\\.$#"
count: 1
@ -3390,56 +3025,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setOutlineLevel\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setCollapsed\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setOutlineLevel\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setCollapsed\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Cannot call method setXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:includeCellRangeFiltered\\(\\) has no return typehint specified\\.$#"
count: 1
@ -3625,16 +3210,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Xls/RC4.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\Style\\\\Border\\:\\:\\$map has no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls/Style/Border.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\Style\\\\FillPattern\\:\\:\\$map has no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php
-
message: "#^Cannot access property \\$Relationship on SimpleXMLElement\\|false\\.$#"
count: 12
@ -3840,31 +3415,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readColor\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readColor\\(\\) has parameter \\$background with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readColor\\(\\) has parameter \\$color with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Parameter \\#1 \\$hex of static method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\:\\:changeBrightness\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Parameter \\#1 \\$pValue of method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\:\\:setSize\\(\\) expects float, string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot access property \\$r on SimpleXMLElement\\|null\\.$#"
count: 2
@ -4640,16 +4190,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Xml.php
-
message: "#^Cannot call method setWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xml.php
-
message: "#^Cannot call method setRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xml.php
-
message: "#^Parameter \\#2 \\$cmp_function of function uksort expects callable\\(mixed, mixed\\)\\: int, array\\('self', 'cellReverseSort'\\) given\\.$#"
count: 4
@ -4660,61 +4200,11 @@ parameters:
count: 4
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Parameter \\#2 \\$pPassword of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:protectCells\\(\\) expects string, array given\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Parameter \\#1 \\$index of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\:\\:setRowIndex\\(\\) expects int, string given\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Cannot call method getRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Cannot call method setRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Cannot call method getVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Cannot call method getOutlineLevel\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Cannot call method setOutlineLevel\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Cannot call method getCollapsed\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Cannot call method setCollapsed\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Cannot call method setXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/ReferenceHelper.php
-
message: "#^Parameter \\#1 \\$columnIndex of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:stringFromColumnIndex\\(\\) expects int, float\\|int given\\.$#"
count: 1
@ -6105,36 +5595,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Style/Style.php
-
message: "#^Cannot call method getXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Style/Style.php
-
message: "#^Cannot call method setXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Style/Style.php
-
message: "#^Cannot call method getXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 3
path: src/PhpSpreadsheet/Style/Style.php
-
message: "#^Cannot call method setXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Style/Style.php
-
message: "#^Cannot call method getXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Style/Style.php
-
message: "#^Cannot call method setXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Style/Style.php
-
message: "#^Result of && is always true\\.$#"
count: 1
@ -6225,11 +5685,6 @@ parameters:
count: 2
path: src/PhpSpreadsheet/Worksheet/AutoFilter.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Worksheet/AutoFilter.php
-
message: "#^Cannot assign offset 'year' to array\\<string\\>\\|string\\.$#"
count: 1
@ -6375,16 +5830,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Worksheet/Iterator.php
-
message: "#^Parameter \\#1 \\$im of function imagesx expects resource, GdImage\\|resource given\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/MemoryDrawing.php
-
message: "#^Parameter \\#1 \\$im of function imagesy expects resource, GdImage\\|resource given\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/MemoryDrawing.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\PageSetup\\:\\:\\$pageOrder has no typehint specified\\.$#"
count: 1
@ -6505,11 +5950,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Cannot call method setWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^If condition is always true\\.$#"
count: 2
@ -6525,26 +5965,11 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Cannot call method setValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Cannot call method setValueExplicit\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Parameter \\#2 \\$start of function substr expects int, int\\<0, max\\>\\|false given\\.$#"
count: 2
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Parameter \\#1 \\$pRow of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:getRowDimension\\(\\) expects int, string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Result of && is always true\\.$#"
count: 1
@ -7305,16 +6730,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
-
message: "#^Parameter \\#2 \\$height of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:writeRow\\(\\) expects int, float given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
-
message: "#^Parameter \\#4 \\$hidden of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:writeRow\\(\\) expects bool, string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
-
message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
@ -7345,11 +6760,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
-
message: "#^Parameter \\#1 \\$hexadecimal_number of function hexdec expects string, array given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
-
message: "#^Parameter \\#1 \\$coordinates of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:indexesFromString\\(\\) expects string, string\\|null given\\.$#"
count: 1
@ -7450,26 +6860,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
-
message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:UTF8toBIFF8UnicodeLong\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
-
message: "#^Parameter \\#1 \\$fillType of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:mapFillType\\(\\) expects string, string\\|null given\\.$#"
count: 2
path: src/PhpSpreadsheet/Writer/Xls/Xf.php
-
message: "#^Parameter \\#1 \\$hAlign of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:mapHAlign\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xls/Xf.php
-
message: "#^Parameter \\#1 \\$vAlign of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:mapVAlign\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xls/Xf.php
-
message: "#^Parameter \\#1 \\$textRotation of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:mapTextRotation\\(\\) expects int, int\\|null given\\.$#"
count: 1
@ -7980,11 +7370,6 @@ parameters:
count: 2
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, array given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, array\\<string\\>\\|string given\\.$#"
count: 2
@ -7995,31 +7380,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
-
message: "#^Cannot call method getCollapsed\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
-
message: "#^Cannot call method getOutlineLevel\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 3
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
-
message: "#^Cannot call method getRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 3
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
-
message: "#^Cannot call method getVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
-
message: "#^Cannot call method getXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 3
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
-
message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int\\|string given\\.$#"
count: 1
@ -8040,21 +7400,6 @@ parameters:
count: 1
path: tests/PhpSpreadsheetTests/Calculation/Engine/RangeTest.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php
-
message: "#^Cannot call method setAutoSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Calculation/XlfnFunctionsTest.php
-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with arguments PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell, null and 'should get exact…' will always evaluate to false\\.$#"
count: 1
@ -8080,16 +7425,6 @@ parameters:
count: 1
path: tests/PhpSpreadsheetTests/Functional/ColumnWidthTest.php
-
message: "#^Cannot call method setWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Functional/ColumnWidthTest.php
-
message: "#^Cannot call method getWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Functional/ColumnWidthTest.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Functional\\\\CommentsTest\\:\\:testComments\\(\\) has parameter \\$format with no typehint specified\\.$#"
count: 1
@ -8100,11 +7435,6 @@ parameters:
count: 2
path: tests/PhpSpreadsheetTests/Functional/ConditionalStopIfTrueTest.php
-
message: "#^Cannot call method setAutoSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Functional/ConditionalTextTest.php
-
message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#"
count: 1
@ -8200,26 +7530,6 @@ parameters:
count: 1
path: tests/PhpSpreadsheetTests/Reader/CsvTest.php
-
message: "#^Cannot call method getVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Reader/Gnumeric/GnumericLoadTest.php
-
message: "#^Cannot call method getRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 2
path: tests/PhpSpreadsheetTests/Reader/Html/HtmlTagsTest.php
-
message: "#^Cannot call method getWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 2
path: tests/PhpSpreadsheetTests/Reader/Html/HtmlTest.php
-
message: "#^Cannot call method getRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 2
path: tests/PhpSpreadsheetTests/Reader/Html/HtmlTest.php
-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
@ -8310,26 +7620,6 @@ parameters:
count: 1
path: tests/PhpSpreadsheetTests/Reader/Xlsx/ConditionalFormattingDataBarXlsxTest.php
-
message: "#^Cannot call method getRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Reader/XlsxTest.php
-
message: "#^Cannot call method getVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Reader/XlsxTest.php
-
message: "#^Cannot call method getWidth\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Reader/XlsxTest.php
-
message: "#^Cannot call method getVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Reader/XlsxTest.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\XlsxTest\\:\\:testStripsWhiteSpaceFromStyleString\\(\\) has parameter \\$string with no typehint specified\\.$#"
count: 1
@ -8465,21 +7755,6 @@ parameters:
count: 1
path: tests/PhpSpreadsheetTests/Writer/Html/ImagesRootTest.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension\\|null\\.$#"
count: 2
path: tests/PhpSpreadsheetTests/Writer/Html/VisibilityTest.php
-
message: "#^Cannot call method setVisible\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 3
path: tests/PhpSpreadsheetTests/Writer/Html/VisibilityTest.php
-
message: "#^Cannot call method setRowHeight\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\|null\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Writer/Html/VisibilityTest.php
-
message: "#^Parameter \\#1 \\$options of static method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:setLibXmlLoaderOptions\\(\\) expects int, null given\\.$#"
count: 1

View File

@ -16,6 +16,8 @@ parameters:
- '~^Return typehint of method .* has invalid type GdImage\.$~'
- '~^Property .* has unknown class GdImage as its type\.$~'
- '~^Parameter .* of method .* has invalid typehint type GdImage\.$~'
- '~^Parameter \#1 \$im of function (imagedestroy|imageistruecolor|imagealphablending|imagesavealpha|imagecolortransparent|imagecolorsforindex|imagesavealpha|imagesx|imagesy) expects resource, GdImage\|resource given\.$~'
- '~^Parameter \#2 \$src_im of function imagecopy expects resource, GdImage\|resource given\.$~'
# Accept a bit anything for assert methods
- '~^Parameter \#2 .* of static method PHPUnit\\Framework\\Assert\:\:assert\w+\(\) expects .*, .* given\.$~'
- '~^Method PhpOffice\\PhpSpreadsheetTests\\.*\:\:test.*\(\) has parameter \$args with no typehint specified\.$~'

View File

@ -38,7 +38,8 @@ $helper->write($spreadsheetFromCSV, __FILE__, ['Xlsx']);
$filenameCSV = $helper->getFilename(__FILE__, 'csv');
/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writerCSV */
$writerCSV = new CsvWriter($spreadsheetFromCSV);
$writerCSV->setExcelCompatibility(true);
//$writerCSV->setExcelCompatibility(true);
$writerCSV->setUseBom(true); // because of non-ASCII chars
$callStartTime = microtime(true);
$writerCSV->save($filenameCSV);

View File

@ -31,8 +31,8 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:')
// Define named ranges
$helper->log('Define named ranges');
$spreadsheet->addNamedRange(new NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1'));
$spreadsheet->addNamedRange(new NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2'));
$spreadsheet->addNamedRange(new NamedRange('PersonName', $spreadsheet->getActiveSheet(), '$B$1'));
$spreadsheet->addNamedRange(new NamedRange('PersonLN', $spreadsheet->getActiveSheet(), '$B$2'));
// Rename named ranges
$helper->log('Rename named ranges');

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DAverage class instead
* @see Database\DAverage::evaluate()
* Use the evaluate() method in the Database\DAverage class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -52,7 +53,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DCount class instead
* @see Database\DCount::evaluate()
* Use the evaluate() method in the Database\DCount class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -89,7 +91,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DCountA class instead
* @see Database\DCountA::evaluate()
* Use the evaluate() method in the Database\DCountA class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -124,7 +127,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DGet class instead
* @see Database\DGet::evaluate()
* Use the evaluate() method in the Database\DGet class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -159,7 +163,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DMax class instead
* @see Database\DMax::evaluate()
* Use the evaluate() method in the Database\DMax class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -194,7 +199,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DMin class instead
* @see Database\DMin::evaluate()
* Use the evaluate() method in the Database\DMin class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -228,7 +234,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DProduct class instead
* @see Database\DProduct::evaluate()
* Use the evaluate() method in the Database\DProduct class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -263,7 +270,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DStDev class instead
* @see Database\DStDev::evaluate()
* Use the evaluate() method in the Database\DStDev class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -298,7 +306,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DStDevP class instead
* @see Database\DStDevP::evaluate()
* Use the evaluate() method in the Database\DStDevP class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -332,7 +341,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DSum class instead
* @see Database\DSum::evaluate()
* Use the evaluate() method in the Database\DSum class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -367,7 +377,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DVar class instead
* @see Database\DVar::evaluate()
* Use the evaluate() method in the Database\DVar class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related
@ -402,7 +413,8 @@ class Database
*
* @Deprecated 1.17.0
*
* @see Use the evaluate() method in the Database\DVarP class instead
* @see Database\DVarP::evaluate()
* Use the evaluate() method in the Database\DVarP class instead
*
* @param mixed[] $database The range of cells that makes up the list or database.
* A database is a list of related data in which rows of related

View File

@ -39,7 +39,7 @@ class DMax extends DatabaseAbstract
return null;
}
return Maximum::MAX(
return Maximum::max(
self::getFilteredColumn($database, $field, $criteria)
);
}

View File

@ -39,7 +39,7 @@ class DMin extends DatabaseAbstract
return null;
}
return Minimum::MIN(
return Minimum::min(
self::getFilteredColumn($database, $field, $criteria)
);
}

View File

@ -38,7 +38,7 @@ class DProduct extends DatabaseAbstract
return null;
}
return MathTrig\Product::evaluate(
return MathTrig\Operations::product(
self::getFilteredColumn($database, $field, $criteria)
);
}

View File

@ -38,7 +38,7 @@ class DSum extends DatabaseAbstract
return null;
}
return MathTrig\Sum::funcSum(
return MathTrig\Sum::sumIgnoringStrings(
self::getFilteredColumn($database, $field, $criteria)
);
}

View File

@ -4,12 +4,18 @@ namespace PhpOffice\PhpSpreadsheet\Calculation;
use DateTimeInterface;
/**
* @deprecated 1.18.0
*/
class DateTime
{
/**
* Identify if a year is a leap year or not.
*
* @Deprecated 2.0.0 Use the method isLeapYear in the DateTimeExcel\Helpers class instead
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Helpers::isLeapYear()
* Use the isLeapYear method in the DateTimeExcel\Helpers class instead
*
* @param int|string $year The year to test
*
@ -23,7 +29,10 @@ class DateTime
/**
* getDateValue.
*
* @Deprecated 2.0.0 Use the method getDateValue in the DateTimeExcel\Helpers class instead
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Helpers::getDateValue()
* Use the getDateValue method in the DateTimeExcel\Helpers class instead
*
* @param mixed $dateValue
*
@ -49,17 +58,20 @@ class DateTime
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
* and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
*
* @Deprecated 2.0.0 Use the funcNow method in the DateTimeExcel\Now class instead
*
* Excel Function:
* NOW()
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Current::now()
* Use the now method in the DateTimeExcel\Current class instead
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function DATETIMENOW()
{
return DateTimeExcel\Now::funcNow();
return DateTimeExcel\Current::now();
}
/**
@ -73,17 +85,20 @@ class DateTime
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
* and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
*
* @Deprecated 2.0.0 Use the funcToday method in the DateTimeExcel\Today class instead
*
* Excel Function:
* TODAY()
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Current::today()
* Use the today method in the DateTimeExcel\Current class instead
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function DATENOW()
{
return DateTimeExcel\Today::funcToday();
return DateTimeExcel\Current::today();
}
/**
@ -94,11 +109,15 @@ class DateTime
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
*
* @Deprecated 2.0.0 Use the funcDate method in the DateTimeExcel\Date class instead
*
* Excel Function:
* DATE(year,month,day)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Date::fromYMD()
* Use the fromYMD method in the DateTimeExcel\Date class instead
*
* PhpSpreadsheet is a lot more forgiving than MS Excel when passing non numeric values to this function.
* A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted,
* as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language.
@ -139,7 +158,7 @@ class DateTime
*/
public static function DATE($year = 0, $month = 1, $day = 1)
{
return DateTimeExcel\Datefunc::funcDate($year, $month, $day);
return DateTimeExcel\Date::fromYMD($year, $month, $day);
}
/**
@ -150,11 +169,14 @@ class DateTime
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
*
* @Deprecated 2.0.0 Use the funcTime method in the DateTimeExcel\Time class instead
*
* Excel Function:
* TIME(hour,minute,second)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Time::fromHMS()
* Use the fromHMS method in the DateTimeExcel\Time class instead
*
* @param int $hour A number from 0 (zero) to 32767 representing the hour.
* Any value greater than 23 will be divided by 24 and the remainder
* will be treated as the hour value. For example, TIME(27,0,0) =
@ -172,7 +194,7 @@ class DateTime
*/
public static function TIME($hour = 0, $minute = 0, $second = 0)
{
return DateTimeExcel\Time::funcTime($hour, $minute, $second);
return DateTimeExcel\Time::fromHMS($hour, $minute, $second);
}
/**
@ -185,11 +207,14 @@ class DateTime
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
*
* @Deprecated 2.0.0 Use the funcDateValue method in the DateTimeExcel\DateValue class instead
*
* Excel Function:
* DATEVALUE(dateValue)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\DateValue::fromString()
* Use the fromString method in the DateTimeExcel\DateValue class instead
*
* @param string $dateValue Text that represents a date in a Microsoft Excel date format.
* For example, "1/30/2008" or "30-Jan-2008" are text strings within
* quotation marks that represent dates. Using the default date
@ -204,7 +229,7 @@ class DateTime
*/
public static function DATEVALUE($dateValue)
{
return DateTimeExcel\DateValue::funcDateValue($dateValue);
return DateTimeExcel\DateValue::fromString($dateValue);
}
/**
@ -217,11 +242,14 @@ class DateTime
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
*
* @Deprecated 2.0.0 Use the funcTimeValue method in the DateTimeExcel\TimeValue class instead
*
* Excel Function:
* TIMEVALUE(timeValue)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\TimeValue::fromString()
* Use the fromString method in the DateTimeExcel\TimeValue class instead
*
* @param string $timeValue A text string that represents a time in any one of the Microsoft
* Excel time formats; for example, "6:45 PM" and "18:45" text strings
* within quotation marks that represent time.
@ -232,13 +260,19 @@ class DateTime
*/
public static function TIMEVALUE($timeValue)
{
return DateTimeExcel\TimeValue::funcTimeValue($timeValue);
return DateTimeExcel\TimeValue::fromString($timeValue);
}
/**
* DATEDIF.
*
* @Deprecated 2.0.0 Use the funcDateDif method in the DateTimeExcel\DateDif class instead
* Excel Function:
* DATEDIF(startdate, enddate, unit)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Difference::interval()
* Use the interval method in the DateTimeExcel\Difference class instead
*
* @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object
* or a standard date string
@ -250,7 +284,7 @@ class DateTime
*/
public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D')
{
return DateTimeExcel\DateDif::funcDateDif($startDate, $endDate, $unit);
return DateTimeExcel\Difference::interval($startDate, $endDate, $unit);
}
/**
@ -258,11 +292,14 @@ class DateTime
*
* Returns the number of days between two dates
*
* @Deprecated 2.0.0 Use the funcDays method in the DateTimeExcel\Days class instead
*
* Excel Function:
* DAYS(endDate, startDate)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Days::between()
* Use the between method in the DateTimeExcel\Days class instead
*
* @param DateTimeInterface|float|int|string $endDate Excel date serial value (float),
* PHP date timestamp (integer), PHP DateTime object, or a standard date string
* @param DateTimeInterface|float|int|string $startDate Excel date serial value (float),
@ -272,7 +309,7 @@ class DateTime
*/
public static function DAYS($endDate = 0, $startDate = 0)
{
return DateTimeExcel\Days::funcDays($endDate, $startDate);
return DateTimeExcel\Days::between($endDate, $startDate);
}
/**
@ -282,11 +319,14 @@ class DateTime
* which is used in some accounting calculations. Use this function to help compute payments if
* your accounting system is based on twelve 30-day months.
*
* @Deprecated 2.0.0 Use the funcDays360 method in the DateTimeExcel\Days360 class instead
*
* Excel Function:
* DAYS360(startDate,endDate[,method])
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Days360::between()
* Use the between method in the DateTimeExcel\Days360 class instead
*
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
@ -307,7 +347,7 @@ class DateTime
*/
public static function DAYS360($startDate = 0, $endDate = 0, $method = false)
{
return DateTimeExcel\Days360::funcDays360($startDate, $endDate, $method);
return DateTimeExcel\Days360::between($startDate, $endDate, $method);
}
/**
@ -318,10 +358,14 @@ class DateTime
* Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or
* obligations to assign to a specific term.
*
* @Deprecated 2.0.0 Use the funcYearFrac method in the DateTimeExcel\YearFrac class instead
*
* Excel Function:
* YEARFRAC(startDate,endDate[,method])
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\YearFrac::fraction()
* Use the fraction method in the DateTimeExcel\YearFrac class instead
*
* See https://lists.oasis-open.org/archives/office-formula/200806/msg00039.html
* for description of algorithm used in Excel
*
@ -340,7 +384,7 @@ class DateTime
*/
public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0)
{
return DateTimeExcel\YearFrac::funcYearFrac($startDate, $endDate, $method);
return DateTimeExcel\YearFrac::fraction($startDate, $endDate, $method);
}
/**
@ -351,21 +395,25 @@ class DateTime
* Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days
* worked during a specific term.
*
* @Deprecated 2.0.0 Use the funcNetworkDays method in the DateTimeExcel\NetworkDays class instead
*
* Excel Function:
* NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]])
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\NetworkDays::count()
* Use the count method in the DateTimeExcel\NetworkDays class instead
*
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param mixed $dateArgs
*
* @return int|string Interval between the dates
*/
public static function NETWORKDAYS($startDate, $endDate, ...$dateArgs)
{
return DateTimeExcel\NetworkDays::funcNetworkDays($startDate, $endDate, ...$dateArgs);
return DateTimeExcel\NetworkDays::count($startDate, $endDate, ...$dateArgs);
}
/**
@ -376,23 +424,27 @@ class DateTime
* Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected
* delivery times, or the number of days of work performed.
*
* @Deprecated 2.0.0 Use the funcWorkDay method in the DateTimeExcel\WorkDay class instead
*
* Excel Function:
* WORKDAY(startDate,endDays[,holidays[,holiday[,...]]])
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\WorkDay::date()
* Use the date method in the DateTimeExcel\WorkDay class instead
*
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $endDays The number of nonweekend and nonholiday days before or after
* startDate. A positive value for days yields a future date; a
* negative value yields a past date.
* @param mixed $dateArgs
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function WORKDAY($startDate, $endDays, ...$dateArgs)
{
return DateTimeExcel\WorkDay::funcWorkDay($startDate, $endDays, ...$dateArgs);
return DateTimeExcel\WorkDay::date($startDate, $endDays, ...$dateArgs);
}
/**
@ -401,11 +453,14 @@ class DateTime
* Returns the day of the month, for a specified date. The day is given as an integer
* ranging from 1 to 31.
*
* @Deprecated 2.0.0 Use the funcDay method in the DateTimeExcel\Day class instead
*
* Excel Function:
* DAY(dateValue)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\DateParts::day()
* Use the day method in the DateTimeExcel\DateParts class instead
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
@ -413,7 +468,7 @@ class DateTime
*/
public static function DAYOFMONTH($dateValue = 1)
{
return DateTimeExcel\Day::funcDay($dateValue);
return DateTimeExcel\DateParts::day($dateValue);
}
/**
@ -422,11 +477,14 @@ class DateTime
* Returns the day of the week for a specified date. The day is given as an integer
* ranging from 0 to 7 (dependent on the requested style).
*
* @Deprecated 2.0.0 Use the funcWeekDay method in the DateTimeExcel\WeekDay class instead
*
* Excel Function:
* WEEKDAY(dateValue[,style])
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Week::day()
* Use the day method in the DateTimeExcel\Week class instead
*
* @param float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $style A number that determines the type of return value
@ -438,13 +496,13 @@ class DateTime
*/
public static function WEEKDAY($dateValue = 1, $style = 1)
{
return DateTimeExcel\WeekDay::funcWeekDay($dateValue, $style);
return DateTimeExcel\Week::day($dateValue, $style);
}
/**
* STARTWEEK_SUNDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_SUNDAY instead
*/
@ -453,7 +511,7 @@ class DateTime
/**
* STARTWEEK_MONDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY instead
*/
@ -462,7 +520,7 @@ class DateTime
/**
* STARTWEEK_MONDAY_ALT.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY_ALT instead
*/
@ -471,7 +529,7 @@ class DateTime
/**
* STARTWEEK_TUESDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_TUESDAY instead
*/
@ -480,7 +538,7 @@ class DateTime
/**
* STARTWEEK_WEDNESDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_WEDNESDAY instead
*/
@ -489,7 +547,7 @@ class DateTime
/**
* STARTWEEK_THURSDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_THURSDAY instead
*/
@ -498,7 +556,7 @@ class DateTime
/**
* STARTWEEK_FRIDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_FRIDAY instead
*/
@ -507,7 +565,7 @@ class DateTime
/**
* STARTWEEK_SATURDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_SATURDAY instead
*/
@ -516,7 +574,7 @@ class DateTime
/**
* STARTWEEK_SUNDAY_ALT.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_SUNDAY_ALT instead
*/
@ -525,7 +583,7 @@ class DateTime
/**
* DOW_SUNDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\DOW_SUNDAY instead
*/
@ -534,7 +592,7 @@ class DateTime
/**
* DOW_MONDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\DOW_MONDAY instead
*/
@ -543,7 +601,7 @@ class DateTime
/**
* DOW_TUESDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\DOW_TUESDAY instead
*/
@ -552,7 +610,7 @@ class DateTime
/**
* DOW_WEDNESDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\DOW_WEDNESDAY instead
*/
@ -561,7 +619,7 @@ class DateTime
/**
* DOW_THURSDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\DOW_THURSDAY instead
*/
@ -570,7 +628,7 @@ class DateTime
/**
* DOW_FRIDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\DOW_FRIDAY instead
*/
@ -579,7 +637,7 @@ class DateTime
/**
* DOW_SATURDAY.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\DOW_SATURDAY instead
*/
@ -588,7 +646,7 @@ class DateTime
/**
* STARTWEEK_MONDAY_ISO.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY_ISO instead
*/
@ -597,7 +655,7 @@ class DateTime
/**
* METHODARR.
*
* @Deprecated 2.0.0
* @Deprecated 1.18.0
*
* @see Use DateTimeExcel\Constants\METHODARR instead
*/
@ -624,11 +682,14 @@ class DateTime
* three days or less in the first week of January, the WEEKNUM function returns week numbers
* that are incorrect according to the European standard.
*
* @Deprecated 2.0.0 Use the funcWeekNum method in the DateTimeExcel\WeekNum class instead
*
* Excel Function:
* WEEKNUM(dateValue[,style])
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Week::number(()
* Use the number method in the DateTimeExcel\Week class instead
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $method Week begins on Sunday or Monday
@ -647,7 +708,7 @@ class DateTime
*/
public static function WEEKNUM($dateValue = 1, $method = self::STARTWEEK_SUNDAY)
{
return DateTimeExcel\WeekNum::funcWeekNum($dateValue, $method);
return DateTimeExcel\Week::number($dateValue, $method);
}
/**
@ -655,11 +716,14 @@ class DateTime
*
* Returns the ISO 8601 week number of the year for a specified date.
*
* @Deprecated 2.0.0 Use the funcIsoWeeknum method in the DateTimeExcel\IsoWeekNum class instead
*
* Excel Function:
* ISOWEEKNUM(dateValue)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Week::isoWeekNumber()
* Use the isoWeekNumber method in the DateTimeExcel\Week class instead
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
@ -667,7 +731,7 @@ class DateTime
*/
public static function ISOWEEKNUM($dateValue = 1)
{
return DateTimeExcel\IsoWeekNum::funcIsoWeekNum($dateValue);
return DateTimeExcel\Week::isoWeekNumber($dateValue);
}
/**
@ -676,11 +740,14 @@ class DateTime
* Returns the month of a date represented by a serial number.
* The month is given as an integer, ranging from 1 (January) to 12 (December).
*
* @Deprecated 2.0.0 Use the funcMonth method in the DateTimeExcel\Month class instead
*
* Excel Function:
* MONTH(dateValue)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\DateParts::month()
* Use the month method in the DateTimeExcel\DateParts class instead
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
@ -688,7 +755,7 @@ class DateTime
*/
public static function MONTHOFYEAR($dateValue = 1)
{
return DateTimeExcel\Month::funcMonth($dateValue);
return DateTimeExcel\DateParts::month($dateValue);
}
/**
@ -697,11 +764,14 @@ class DateTime
* Returns the year corresponding to a date.
* The year is returned as an integer in the range 1900-9999.
*
* @Deprecated 2.0.0 Use the funcYear method in the DateTimeExcel\Year class instead
*
* Excel Function:
* YEAR(dateValue)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\DateParts::year()
* Use the ear method in the DateTimeExcel\DateParts class instead
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
@ -709,7 +779,7 @@ class DateTime
*/
public static function YEAR($dateValue = 1)
{
return DateTimeExcel\Year::funcYear($dateValue);
return DateTimeExcel\DateParts::year($dateValue);
}
/**
@ -718,11 +788,14 @@ class DateTime
* Returns the hour of a time value.
* The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
*
* @Deprecated 2.0.0 Use the funcHour method in the DateTimeExcel\Hour class instead
*
* Excel Function:
* HOUR(timeValue)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\TimeParts::hour()
* Use the hour method in the DateTimeExcel\TimeParts class instead
*
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard time string
*
@ -730,7 +803,7 @@ class DateTime
*/
public static function HOUROFDAY($timeValue = 0)
{
return DateTimeExcel\Hour::funcHour($timeValue);
return DateTimeExcel\TimeParts::hour($timeValue);
}
/**
@ -739,11 +812,14 @@ class DateTime
* Returns the minutes of a time value.
* The minute is given as an integer, ranging from 0 to 59.
*
* @Deprecated 2.0.0 Use the funcMinute method in the DateTimeExcel\Minute class instead
*
* Excel Function:
* MINUTE(timeValue)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\TimeParts::minute()
* Use the minute method in the DateTimeExcel\TimeParts class instead
*
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard time string
*
@ -751,7 +827,7 @@ class DateTime
*/
public static function MINUTE($timeValue = 0)
{
return DateTimeExcel\Minute::funcMinute($timeValue);
return DateTimeExcel\TimeParts::minute($timeValue);
}
/**
@ -760,11 +836,14 @@ class DateTime
* Returns the seconds of a time value.
* The second is given as an integer in the range 0 (zero) to 59.
*
* @Deprecated 2.0.0 Use the funcSecond method in the DateTimeExcel\Second class instead
*
* Excel Function:
* SECOND(timeValue)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\TimeParts::second()
* Use the second method in the DateTimeExcel\TimeParts class instead
*
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard time string
*
@ -772,7 +851,7 @@ class DateTime
*/
public static function SECOND($timeValue = 0)
{
return DateTimeExcel\Second::funcSecond($timeValue);
return DateTimeExcel\TimeParts::second($timeValue);
}
/**
@ -783,11 +862,14 @@ class DateTime
* Use EDATE to calculate maturity dates or due dates that fall on the same day of the month
* as the date of issue.
*
* @Deprecated 2.0.0 Use the funcEDate method in the DateTimeExcel\EDate class instead
*
* Excel Function:
* EDATE(dateValue,adjustmentMonths)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Month::adjust()
* Use the adjust method in the DateTimeExcel\Edate class instead
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $adjustmentMonths The number of months before or after start_date.
@ -799,7 +881,7 @@ class DateTime
*/
public static function EDATE($dateValue = 1, $adjustmentMonths = 0)
{
return DateTimeExcel\EDate::funcEDate($dateValue, $adjustmentMonths);
return DateTimeExcel\Month::adjust($dateValue, $adjustmentMonths);
}
/**
@ -809,11 +891,14 @@ class DateTime
* before or after start_date.
* Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
*
* @Deprecated 2.0.0 Use the funcEoMonth method in the DateTimeExcel\EoMonth class instead
*
* Excel Function:
* EOMONTH(dateValue,adjustmentMonths)
*
* @Deprecated 1.18.0
*
* @See DateTimeExcel\Month::lastDay()
* Use the lastDay method in the DateTimeExcel\EoMonth class instead
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $adjustmentMonths The number of months before or after start_date.
@ -825,6 +910,6 @@ class DateTime
*/
public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0)
{
return DateTimeExcel\EoMonth::funcEoMonth($dateValue, $adjustmentMonths);
return DateTimeExcel\Month::lastDay($dateValue, $adjustmentMonths);
}
}

View File

@ -22,6 +22,7 @@ class Constants
const DOW_FRIDAY = 6;
const DOW_SATURDAY = 7;
const STARTWEEK_MONDAY_ISO = 21;
const METHODARR = [
self::STARTWEEK_SUNDAY => self::DOW_SUNDAY,
self::DOW_MONDAY,

View File

@ -5,8 +5,33 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateTimeImmutable;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Now
class Current
{
/**
* DATENOW.
*
* Returns the current date.
* The NOW function is useful when you need to display the current date and time on a worksheet or
* calculate a value based on the current date and time, and have that value updated each time you
* open the worksheet.
*
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
* and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
*
* Excel Function:
* TODAY()
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function today()
{
$dti = new DateTimeImmutable();
$dateArray = date_parse($dti->format('c'));
return is_array($dateArray) ? Helpers::returnIn3FormatsArray($dateArray, true) : Functions::VALUE();
}
/**
* DATETIMENOW.
*
@ -24,7 +49,7 @@ class Now
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcNow()
public static function now()
{
$dti = new DateTimeImmutable();
$dateArray = date_parse($dti->format('c'));

View File

@ -2,12 +2,12 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
class Datefunc
class Date
{
/**
* DATE.
@ -58,9 +58,9 @@ class Datefunc
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcDate($year, $month, $day)
public static function fromYMD($year, $month, $day)
{
$baseYear = Date::getExcelCalendar();
$baseYear = SharedDateHelper::getExcelCalendar();
try {
$year = self::getYear($year, $baseYear);
@ -72,7 +72,7 @@ class Datefunc
}
// Execute function
$excelDateValue = Date::formattedPHPToExcel($year, $month, $day);
$excelDateValue = SharedDateHelper::formattedPHPToExcel($year, $month, $day);
return Helpers::returnIn3FormatsFloat($excelDateValue);
}
@ -85,7 +85,7 @@ class Datefunc
private static function getYear($year, int $baseYear): int
{
$year = Functions::flattenSingleValue($year);
$year = ($year !== null) ? StringHelper::testStringAsNumeric($year) : 0;
$year = ($year !== null) ? StringHelper::testStringAsNumeric((string) $year) : 0;
if (!is_numeric($year)) {
throw new Exception(Functions::VALUE());
}
@ -102,7 +102,7 @@ class Datefunc
$year += 1900;
}
return $year;
return (int) $year;
}
/**
@ -115,10 +115,10 @@ class Datefunc
$month = Functions::flattenSingleValue($month);
if (($month !== null) && (!is_numeric($month))) {
$month = Date::monthStringToNumber($month);
$month = SharedDateHelper::monthStringToNumber($month);
}
$month = ($month !== null) ? StringHelper::testStringAsNumeric($month) : 0;
$month = ($month !== null) ? StringHelper::testStringAsNumeric((string) $month) : 0;
if (!is_numeric($month)) {
throw new Exception(Functions::VALUE());
}
@ -136,10 +136,10 @@ class Datefunc
$day = Functions::flattenSingleValue($day);
if (($day !== null) && (!is_numeric($day))) {
$day = Date::dayStringToNumber($day);
$day = SharedDateHelper::dayStringToNumber($day);
}
$day = ($day !== null) ? StringHelper::testStringAsNumeric($day) : 0;
$day = ($day !== null) ? StringHelper::testStringAsNumeric((string) $day) : 0;
if (!is_numeric($day)) {
throw new Exception(Functions::VALUE());
}

View File

@ -0,0 +1,127 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class DateParts
{
/**
* DAYOFMONTH.
*
* Returns the day of the month, for a specified date. The day is given as an integer
* ranging from 1 to 31.
*
* Excel Function:
* DAY(dateValue)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
* @return int|string Day of the month
*/
public static function day($dateValue)
{
$weirdResult = self::weirdCondition($dateValue);
if ($weirdResult >= 0) {
return $weirdResult;
}
try {
$dateValue = Helpers::getDateValue($dateValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$PHPDateObject = SharedDateHelper::excelToDateTimeObject($dateValue);
return (int) $PHPDateObject->format('j');
}
/**
* MONTHOFYEAR.
*
* Returns the month of a date represented by a serial number.
* The month is given as an integer, ranging from 1 (January) to 12 (December).
*
* Excel Function:
* MONTH(dateValue)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
* @return int|string Month of the year
*/
public static function month($dateValue)
{
try {
$dateValue = Helpers::getDateValue($dateValue);
} catch (Exception $e) {
return $e->getMessage();
}
if ($dateValue < 1 && SharedDateHelper::getExcelCalendar() === SharedDateHelper::CALENDAR_WINDOWS_1900) {
return 1;
}
// Execute function
$PHPDateObject = SharedDateHelper::excelToDateTimeObject($dateValue);
return (int) $PHPDateObject->format('n');
}
/**
* YEAR.
*
* Returns the year corresponding to a date.
* The year is returned as an integer in the range 1900-9999.
*
* Excel Function:
* YEAR(dateValue)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
* @return int|string Year
*/
public static function year($dateValue)
{
try {
$dateValue = Helpers::getDateValue($dateValue);
} catch (Exception $e) {
return $e->getMessage();
}
if ($dateValue < 1 && SharedDateHelper::getExcelCalendar() === SharedDateHelper::CALENDAR_WINDOWS_1900) {
return 1900;
}
// Execute function
$PHPDateObject = SharedDateHelper::excelToDateTimeObject($dateValue);
return (int) $PHPDateObject->format('Y');
}
/**
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*/
private static function weirdCondition($dateValue): int
{
// Excel does not treat 0 consistently for DAY vs. (MONTH or YEAR)
if (SharedDateHelper::getExcelCalendar() === SharedDateHelper::CALENDAR_WINDOWS_1900 && Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) {
if (is_bool($dateValue)) {
return (int) $dateValue;
}
if ($dateValue === null) {
return 0;
}
if (is_numeric($dateValue) && $dateValue < 1 && $dateValue >= 0) {
return 0;
}
}
return -1;
}
}

View File

@ -4,7 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateTimeImmutable;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class DateValue
{
@ -33,13 +33,13 @@ class DateValue
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcDateValue($dateValue)
public static function fromString($dateValue)
{
$dti = new DateTimeImmutable();
$baseYear = Date::getExcelCalendar();
$baseYear = SharedDateHelper::getExcelCalendar();
$dateValue = trim(Functions::flattenSingleValue($dateValue), '"');
// Strip any ordinals because they're allowed in Excel (English only)
$dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue);
$dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue) ?? '';
// Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany)
$dateValue = str_replace(['/', '.', '-', ' '], ' ', $dateValue);
@ -59,7 +59,7 @@ class DateValue
}
if (count($t1) === 1) {
// We've been fed a time value without any date
return ((strpos($t, ':') === false)) ? Functions::Value() : 0.0;
return ((strpos((string) $t, ':') === false)) ? Functions::Value() : 0.0;
}
unset($t);
@ -105,7 +105,7 @@ class DateValue
$testVal1 = strtok($dateValue, '- ');
$testVal2 = strtok('- ');
$testVal3 = strtok('- ') ?: $dti->format('Y');
Helpers::adjustYear($testVal1, $testVal2, $testVal3);
Helpers::adjustYear((string) $testVal1, (string) $testVal2, $testVal3);
$PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3);
if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
$PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3);
@ -118,7 +118,7 @@ class DateValue
/**
* Final results.
*
* @param array|false $PHPDateArray
* @param array|bool $PHPDateArray
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
@ -126,7 +126,7 @@ class DateValue
private static function finalResults($PHPDateArray, DateTimeImmutable $dti, int $baseYear)
{
$retValue = Functions::Value();
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
if (is_array($PHPDateArray) && $PHPDateArray['error_count'] == 0) {
// Execute function
Helpers::replaceIfEmpty($PHPDateArray['year'], $dti->format('Y'));
if ($PHPDateArray['year'] < $baseYear) {

View File

@ -1,61 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class Day
{
/**
* DAYOFMONTH.
*
* Returns the day of the month, for a specified date. The day is given as an integer
* ranging from 1 to 31.
*
* Excel Function:
* DAY(dateValue)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
* @return int|string Day of the month
*/
public static function funcDay($dateValue)
{
$weirdResult = self::weirdCondition($dateValue);
if ($weirdResult >= 0) {
return $weirdResult;
}
try {
$dateValue = Helpers::getDateValue($dateValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
return (int) $PHPDateObject->format('j');
}
private static function weirdCondition($dateValue): int
{
// Excel does not treat 0 consistently for DAY vs. (MONTH or YEAR)
if (Date::getExcelCalendar() === DATE::CALENDAR_WINDOWS_1900 && Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) {
if (is_bool($dateValue)) {
return (int) $dateValue;
}
if ($dateValue === null) {
return 0;
}
if (is_numeric($dateValue) && $dateValue < 1 && $dateValue >= 0) {
return 0;
}
}
return -1;
}
}

View File

@ -3,9 +3,9 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateTimeInterface;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class Days
{
@ -24,7 +24,7 @@ class Days
*
* @return int|string Number of days between start date and end date or an error
*/
public static function funcDays($endDate, $startDate)
public static function between($endDate, $startDate)
{
try {
$startDate = Helpers::getDateValue($startDate);
@ -34,8 +34,8 @@ class Days
}
// Execute function
$PHPStartDateObject = Date::excelToDateTimeObject($startDate);
$PHPEndDateObject = Date::excelToDateTimeObject($endDate);
$PHPStartDateObject = SharedDateHelper::excelToDateTimeObject($startDate);
$PHPEndDateObject = SharedDateHelper::excelToDateTimeObject($endDate);
$days = Functions::VALUE();
$diff = $PHPStartDateObject->diff($PHPEndDateObject);

View File

@ -4,7 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class Days360
{
@ -36,7 +36,7 @@ class Days360
*
* @return int|string Number of days between start date and end date
*/
public static function funcDays360($startDate = 0, $endDate = 0, $method = false)
public static function between($startDate = 0, $endDate = 0, $method = false)
{
try {
$startDate = Helpers::getDateValue($startDate);
@ -50,12 +50,12 @@ class Days360
}
// Execute function
$PHPStartDateObject = Date::excelToDateTimeObject($startDate);
$PHPStartDateObject = SharedDateHelper::excelToDateTimeObject($startDate);
$startDay = $PHPStartDateObject->format('j');
$startMonth = $PHPStartDateObject->format('n');
$startYear = $PHPStartDateObject->format('Y');
$PHPEndDateObject = Date::excelToDateTimeObject($endDate);
$PHPEndDateObject = SharedDateHelper::excelToDateTimeObject($endDate);
$endDay = $PHPEndDateObject->format('j');
$endMonth = $PHPEndDateObject->format('n');
$endYear = $PHPEndDateObject->format('Y');

View File

@ -4,11 +4,11 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateInterval;
use DateTime;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class DateDif
class Difference
{
/**
* DATEDIF.
@ -21,7 +21,7 @@ class DateDif
*
* @return int|string Interval between the dates
*/
public static function funcDateDif($startDate, $endDate, $unit = 'D')
public static function interval($startDate, $endDate, $unit = 'D')
{
try {
$startDate = Helpers::getDateValue($startDate);
@ -33,12 +33,12 @@ class DateDif
}
// Execute function
$PHPStartDateObject = Date::excelToDateTimeObject($startDate);
$PHPStartDateObject = SharedDateHelper::excelToDateTimeObject($startDate);
$startDays = (int) $PHPStartDateObject->format('j');
$startMonths = (int) $PHPStartDateObject->format('n');
$startYears = (int) $PHPStartDateObject->format('Y');
$PHPEndDateObject = Date::excelToDateTimeObject($endDate);
$PHPEndDateObject = SharedDateHelper::excelToDateTimeObject($endDate);
$endDays = (int) $PHPEndDateObject->format('j');
$endMonths = (int) $PHPEndDateObject->format('n');
$endYears = (int) $PHPEndDateObject->format('Y');

View File

@ -1,45 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class EDate
{
/**
* EDATE.
*
* Returns the serial number that represents the date that is the indicated number of months
* before or after a specified date (the start_date).
* Use EDATE to calculate maturity dates or due dates that fall on the same day of the month
* as the date of issue.
*
* Excel Function:
* EDATE(dateValue,adjustmentMonths)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $adjustmentMonths The number of months before or after start_date.
* A positive value for months yields a future date;
* a negative value yields a past date.
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcEDate($dateValue, $adjustmentMonths)
{
try {
$dateValue = Helpers::getDateValue($dateValue, false);
$adjustmentMonths = Helpers::validateNumericNull($adjustmentMonths);
} catch (Exception $e) {
return $e->getMessage();
}
$adjustmentMonths = floor($adjustmentMonths);
// Execute function
$PHPDateObject = Helpers::adjustDateByMonths($dateValue, $adjustmentMonths);
return Helpers::returnIn3FormatsObject($PHPDateObject);
}
}

View File

@ -1,47 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class EoMonth
{
/**
* EOMONTH.
*
* Returns the date value for the last day of the month that is the indicated number of months
* before or after start_date.
* Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
*
* Excel Function:
* EOMONTH(dateValue,adjustmentMonths)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $adjustmentMonths The number of months before or after start_date.
* A positive value for months yields a future date;
* a negative value yields a past date.
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcEoMonth($dateValue, $adjustmentMonths)
{
try {
$dateValue = Helpers::getDateValue($dateValue, false);
$adjustmentMonths = Helpers::validateNumericNull($adjustmentMonths);
} catch (Exception $e) {
return $e->getMessage();
}
$adjustmentMonths = floor($adjustmentMonths);
// Execute function
$PHPDateObject = Helpers::adjustDateByMonths($dateValue, $adjustmentMonths + 1);
$adjustDays = (int) $PHPDateObject->format('d');
$adjustDaysString = '-' . $adjustDays . ' days';
$PHPDateObject->modify($adjustDaysString);
return Helpers::returnIn3FormatsObject($PHPDateObject);
}
}

View File

@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateTime;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class Helpers
{
@ -31,7 +31,7 @@ class Helpers
public static function getDateValue($dateValue, bool $allowBool = true): float
{
if (is_object($dateValue)) {
$retval = Date::PHPToExcel($dateValue);
$retval = SharedDateHelper::PHPToExcel($dateValue);
if (is_bool($retval)) {
throw new Exception(Functions::VALUE());
}
@ -43,7 +43,7 @@ class Helpers
if (!is_numeric($dateValue)) {
$saveReturnDateType = Functions::getReturnDateType();
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
$dateValue = DateValue::funcDateValue($dateValue);
$dateValue = DateValue::fromString($dateValue);
Functions::setReturnDateType($saveReturnDateType);
if (!is_numeric($dateValue)) {
throw new Exception(Functions::VALUE());
@ -67,16 +67,21 @@ class Helpers
{
$saveReturnDateType = Functions::getReturnDateType();
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
$timeValue = TimeValue::funcTimeValue($timeValue);
$timeValue = TimeValue::fromString($timeValue);
Functions::setReturnDateType($saveReturnDateType);
return $timeValue;
}
public static function adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0)
/**
* Adjust date by given months.
*
* @param mixed $dateValue
*/
public static function adjustDateByMonths($dateValue = 0, float $adjustmentMonths = 0): DateTime
{
// Execute function
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
$PHPDateObject = SharedDateHelper::excelToDateTimeObject($dateValue);
$oMonth = (int) $PHPDateObject->format('m');
$oYear = (int) $PHPDateObject->format('Y');
@ -144,7 +149,7 @@ class Helpers
);
}
$excelDateValue =
Date::formattedPHPToExcel(
SharedDateHelper::formattedPHPToExcel(
$dateArray['year'],
$dateArray['month'],
$dateArray['day'],
@ -157,7 +162,7 @@ class Helpers
}
// RETURNDATE_UNIX_TIMESTAMP)
return (int) Date::excelToTimestamp($excelDateValue);
return (int) SharedDateHelper::excelToTimestamp($excelDateValue);
}
/**
@ -172,11 +177,11 @@ class Helpers
return $excelDateValue;
}
if ($retType === Functions::RETURNDATE_UNIX_TIMESTAMP) {
return (int) Date::excelToTimestamp($excelDateValue);
return (int) SharedDateHelper::excelToTimestamp($excelDateValue);
}
// RETURNDATE_PHP_DATETIME_OBJECT
return Date::excelToDateTimeObject($excelDateValue);
return SharedDateHelper::excelToDateTimeObject($excelDateValue);
}
/**
@ -191,11 +196,13 @@ class Helpers
return $PHPDateObject;
}
if ($retType === Functions::RETURNDATE_EXCEL) {
return (float) Date::PHPToExcel($PHPDateObject);
return (float) SharedDateHelper::PHPToExcel($PHPDateObject);
}
// RETURNDATE_UNIX_TIMESTAMP
$stamp = SharedDateHelper::PHPToExcel($PHPDateObject);
$stamp = is_bool($stamp) ? ((int) $stamp) : $stamp;
return (int) Date::excelToTimestamp(Date::PHPToExcel($PHPDateObject));
return (int) SharedDateHelper::excelToTimestamp($stamp);
}
private static function baseDate(): int
@ -203,7 +210,7 @@ class Helpers
if (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_OPENOFFICE) {
return 0;
}
if (Date::getExcelCalendar() === Date::CALENDAR_MAC_1904) {
if (SharedDateHelper::getExcelCalendar() === SharedDateHelper::CALENDAR_MAC_1904) {
return 0;
}
@ -239,9 +246,12 @@ class Helpers
if ($number === null) {
return 0;
}
if (is_numeric($number)) {
if (is_int($number)) {
return $number;
}
if (is_numeric($number)) {
return (float) $number;
}
throw new Exception(Functions::VALUE());
}

View File

@ -1,44 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class Hour
{
/**
* HOUROFDAY.
*
* Returns the hour of a time value.
* The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
*
* Excel Function:
* HOUR(timeValue)
*
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard time string
*
* @return int|string Hour
*/
public static function funcHour($timeValue)
{
try {
$timeValue = Functions::flattenSingleValue($timeValue);
Helpers::nullFalseTrueToNumber($timeValue);
if (!is_numeric($timeValue)) {
$timeValue = Helpers::getTimeValue($timeValue);
}
Helpers::validateNotNegative($timeValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$timeValue = fmod($timeValue, 1);
$timeValue = Date::excelToDateTimeObject($timeValue);
return (int) $timeValue->format('H');
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class IsoWeekNum
{
/**
* ISOWEEKNUM.
*
* Returns the ISO 8601 week number of the year for a specified date.
*
* Excel Function:
* ISOWEEKNUM(dateValue)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
* @return int|string Week Number
*/
public static function funcIsoWeekNum($dateValue)
{
if (self::apparentBug($dateValue)) {
return 52;
}
try {
$dateValue = Helpers::getDateValue($dateValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
Helpers::silly1900($PHPDateObject);
return (int) $PHPDateObject->format('W');
}
private static function apparentBug($dateValue): bool
{
if (Date::getExcelCalendar() !== DATE::CALENDAR_MAC_1904) {
if (is_bool($dateValue)) {
return true;
}
if (is_numeric($dateValue) && !((int) $dateValue)) {
return true;
}
}
return false;
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class Minute
{
/**
* MINUTE.
*
* Returns the minutes of a time value.
* The minute is given as an integer, ranging from 0 to 59.
*
* Excel Function:
* MINUTE(timeValue)
*
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard time string
*
* @return int|string Minute
*/
public static function funcMinute($timeValue)
{
try {
$timeValue = Functions::flattenSingleValue($timeValue);
Helpers::nullFalseTrueToNumber($timeValue);
if (!is_numeric($timeValue)) {
$timeValue = Helpers::getTimeValue($timeValue);
}
Helpers::validateNotNegative($timeValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$timeValue = fmod($timeValue, 1);
$timeValue = Date::excelToDateTimeObject($timeValue);
return (int) $timeValue->format('i');
}
}

View File

@ -2,39 +2,81 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
class Month
{
/**
* MONTHOFYEAR.
* EDATE.
*
* Returns the month of a date represented by a serial number.
* The month is given as an integer, ranging from 1 (January) to 12 (December).
* Returns the serial number that represents the date that is the indicated number of months
* before or after a specified date (the start_date).
* Use EDATE to calculate maturity dates or due dates that fall on the same day of the month
* as the date of issue.
*
* Excel Function:
* MONTH(dateValue)
* EDATE(dateValue,adjustmentMonths)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $adjustmentMonths The number of months before or after start_date.
* A positive value for months yields a future date;
* a negative value yields a past date.
*
* @return int|string Month of the year
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcMonth($dateValue)
public static function adjust($dateValue, $adjustmentMonths)
{
try {
$dateValue = Helpers::getDateValue($dateValue);
$dateValue = Helpers::getDateValue($dateValue, false);
$adjustmentMonths = Helpers::validateNumericNull($adjustmentMonths);
} catch (Exception $e) {
return $e->getMessage();
}
if ($dateValue < 1 && Date::getExcelCalendar() === DATE::CALENDAR_WINDOWS_1900) {
return 1;
}
$adjustmentMonths = floor($adjustmentMonths);
// Execute function
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
$PHPDateObject = Helpers::adjustDateByMonths($dateValue, $adjustmentMonths);
return (int) $PHPDateObject->format('n');
return Helpers::returnIn3FormatsObject($PHPDateObject);
}
/**
* EOMONTH.
*
* Returns the date value for the last day of the month that is the indicated number of months
* before or after start_date.
* Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
*
* Excel Function:
* EOMONTH(dateValue,adjustmentMonths)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $adjustmentMonths The number of months before or after start_date.
* A positive value for months yields a future date;
* a negative value yields a past date.
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function lastDay($dateValue, $adjustmentMonths)
{
try {
$dateValue = Helpers::getDateValue($dateValue, false);
$adjustmentMonths = Helpers::validateNumericNull($adjustmentMonths);
} catch (Exception $e) {
return $e->getMessage();
}
$adjustmentMonths = floor($adjustmentMonths);
// Execute function
$PHPDateObject = Helpers::adjustDateByMonths($dateValue, $adjustmentMonths + 1);
$adjustDays = (int) $PHPDateObject->format('d');
$adjustDaysString = '-' . $adjustDays . ' days';
$PHPDateObject->modify($adjustDaysString);
return Helpers::returnIn3FormatsObject($PHPDateObject);
}
}

View File

@ -2,9 +2,8 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class NetworkDays
{
@ -23,10 +22,11 @@ class NetworkDays
* PHP DateTime object, or a standard date string
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param mixed $dateArgs
*
* @return int|string Interval between the dates
*/
public static function funcNetworkDays($startDate, $endDate, ...$dateArgs)
public static function count($startDate, $endDate, ...$dateArgs)
{
try {
// Retrieve the mandatory start and end date that are referenced in the function definition
@ -55,7 +55,7 @@ class NetworkDays
$holidayCountedArray = [];
foreach ($holidayArray as $holidayDate) {
if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
if ((WeekDay::funcWeekDay($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
if ((Week::day($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
--$partWeekDays;
$holidayCountedArray[] = $holidayDate;
}
@ -67,7 +67,7 @@ class NetworkDays
private static function calcStartDow(float $startDate): int
{
$startDow = 6 - (int) WeekDay::funcWeekDay($startDate, 2);
$startDow = 6 - (int) Week::day($startDate, 2);
if ($startDow < 0) {
$startDow = 5;
}
@ -77,7 +77,7 @@ class NetworkDays
private static function calcEndDow(float $endDate): int
{
$endDow = (int) WeekDay::funcWeekDay($endDate, 2);
$endDow = (int) Week::day($endDate, 2);
if ($endDow >= 6) {
$endDow = 0;
}
@ -95,7 +95,7 @@ class NetworkDays
return $partWeekDays;
}
private static function applySign(int $result, float $sDate, float $eDate)
private static function applySign(int $result, float $sDate, float $eDate): int
{
return ($sDate > $eDate) ? -$result : $result;
}

View File

@ -1,44 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class Second
{
/**
* MINUTE.
*
* Returns the minutes of a time value.
* The minute is given as an integer, ranging from 0 to 59.
*
* Excel Function:
* MINUTE(timeValue)
*
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard time string
*
* @return int|string Minute
*/
public static function funcSecond($timeValue)
{
try {
$timeValue = Functions::flattenSingleValue($timeValue);
Helpers::nullFalseTrueToNumber($timeValue);
if (!is_numeric($timeValue)) {
$timeValue = Helpers::getTimeValue($timeValue);
}
Helpers::validateNotNegative($timeValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$timeValue = fmod($timeValue, 1);
$timeValue = Date::excelToDateTimeObject($timeValue);
return (int) $timeValue->format('s');
}
}

View File

@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateTime;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class Time
{
@ -20,14 +20,14 @@ class Time
* Excel Function:
* TIME(hour,minute,second)
*
* @param int $hour A number from 0 (zero) to 32767 representing the hour.
* @param mixed $hour A number from 0 (zero) to 32767 representing the hour.
* Any value greater than 23 will be divided by 24 and the remainder
* will be treated as the hour value. For example, TIME(27,0,0) =
* TIME(3,0,0) = .125 or 3:00 AM.
* @param int $minute A number from 0 to 32767 representing the minute.
* @param mixed $minute A number from 0 to 32767 representing the minute.
* Any value greater than 59 will be converted to hours and minutes.
* For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM.
* @param int $second A number from 0 to 32767 representing the second.
* @param mixed $second A number from 0 to 32767 representing the second.
* Any value greater than 59 will be converted to hours, minutes,
* and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148
* or 12:33:20 AM
@ -35,7 +35,7 @@ class Time
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcTime($hour, $minute, $second)
public static function fromHMS($hour, $minute, $second)
{
try {
$hour = self::toIntWithNullBool($hour);
@ -57,13 +57,13 @@ class Time
// Execute function
$retType = Functions::getReturnDateType();
if ($retType === Functions::RETURNDATE_EXCEL) {
$calendar = Date::getExcelCalendar();
$date = (int) ($calendar !== Date::CALENDAR_WINDOWS_1900);
$calendar = SharedDateHelper::getExcelCalendar();
$date = (int) ($calendar !== SharedDateHelper::CALENDAR_WINDOWS_1900);
return (float) Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
return (float) SharedDateHelper::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
}
if ($retType === Functions::RETURNDATE_UNIX_TIMESTAMP) {
return (int) Date::excelToTimestamp(Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600
return (int) SharedDateHelper::excelToTimestamp(SharedDateHelper::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600
}
// RETURNDATE_PHP_DATETIME_OBJECT
// Hour has already been normalized (0-23) above
@ -100,6 +100,9 @@ class Time
}
}
/**
* @param mixed $value expect int
*/
private static function toIntWithNullBool($value): int
{
$value = Functions::flattenSingleValue($value);

View File

@ -0,0 +1,112 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class TimeParts
{
/**
* HOUROFDAY.
*
* Returns the hour of a time value.
* The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
*
* Excel Function:
* HOUR(timeValue)
*
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard time string
*
* @return int|string Hour
*/
public static function hour($timeValue)
{
try {
$timeValue = Functions::flattenSingleValue($timeValue);
Helpers::nullFalseTrueToNumber($timeValue);
if (!is_numeric($timeValue)) {
$timeValue = Helpers::getTimeValue($timeValue);
}
Helpers::validateNotNegative($timeValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$timeValue = fmod($timeValue, 1);
$timeValue = SharedDateHelper::excelToDateTimeObject($timeValue);
return (int) $timeValue->format('H');
}
/**
* MINUTE.
*
* Returns the minutes of a time value.
* The minute is given as an integer, ranging from 0 to 59.
*
* Excel Function:
* MINUTE(timeValue)
*
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard time string
*
* @return int|string Minute
*/
public static function minute($timeValue)
{
try {
$timeValue = Functions::flattenSingleValue($timeValue);
Helpers::nullFalseTrueToNumber($timeValue);
if (!is_numeric($timeValue)) {
$timeValue = Helpers::getTimeValue($timeValue);
}
Helpers::validateNotNegative($timeValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$timeValue = fmod($timeValue, 1);
$timeValue = SharedDateHelper::excelToDateTimeObject($timeValue);
return (int) $timeValue->format('i');
}
/**
* SECOND.
*
* Returns the seconds of a time value.
* The minute is given as an integer, ranging from 0 to 59.
*
* Excel Function:
* SECOND(timeValue)
*
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard time string
*
* @return int|string Second
*/
public static function second($timeValue)
{
try {
$timeValue = Functions::flattenSingleValue($timeValue);
Helpers::nullFalseTrueToNumber($timeValue);
if (!is_numeric($timeValue)) {
$timeValue = Helpers::getTimeValue($timeValue);
}
Helpers::validateNotNegative($timeValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$timeValue = fmod($timeValue, 1);
$timeValue = SharedDateHelper::excelToDateTimeObject($timeValue);
return (int) $timeValue->format('s');
}
}

View File

@ -4,7 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Datetime;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class TimeValue
{
@ -29,12 +29,12 @@ class TimeValue
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcTimeValue($timeValue)
public static function fromString($timeValue)
{
$timeValue = trim(Functions::flattenSingleValue($timeValue), '"');
$timeValue = str_replace(['/', '.'], '-', $timeValue);
$arraySplit = preg_split('/[\/:\-\s]/', $timeValue);
$arraySplit = preg_split('/[\/:\-\s]/', $timeValue) ?: [];
if ((count($arraySplit) == 2 || count($arraySplit) == 3) && $arraySplit[0] > 24) {
$arraySplit[0] = ($arraySplit[0] % 24);
$timeValue = implode(':', $arraySplit);
@ -44,13 +44,13 @@ class TimeValue
$retValue = Functions::VALUE();
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
// OpenOffice-specific code removed - it works just like Excel
$excelDateValue = Date::formattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1;
$excelDateValue = SharedDateHelper::formattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1;
$retType = Functions::getReturnDateType();
if ($retType === Functions::RETURNDATE_EXCEL) {
$retValue = (float) $excelDateValue;
} elseif ($retType === Functions::RETURNDATE_UNIX_TIMESTAMP) {
$retValue = (int) $phpDateValue = Date::excelToTimestamp($excelDateValue + 25569) - 3600;
$retValue = (int) $phpDateValue = SharedDateHelper::excelToTimestamp($excelDateValue + 25569) - 3600;
} else {
$retValue = new DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']);
}

View File

@ -1,34 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateTimeImmutable;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Today
{
/**
* DATENOW.
*
* Returns the current date.
* The NOW function is useful when you need to display the current date and time on a worksheet or
* calculate a value based on the current date and time, and have that value updated each time you
* open the worksheet.
*
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
* and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
*
* Excel Function:
* TODAY()
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcToday()
{
$dti = new DateTimeImmutable();
$dateArray = date_parse($dti->format('c'));
return is_array($dateArray) ? Helpers::returnIn3FormatsArray($dateArray, true) : Functions::VALUE();
}
}

View File

@ -0,0 +1,254 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateTime;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class Week
{
/**
* WEEKNUM.
*
* Returns the week of the year for a specified date.
* The WEEKNUM function considers the week containing January 1 to be the first week of the year.
* However, there is a European standard that defines the first week as the one with the majority
* of days (four or more) falling in the new year. This means that for years in which there are
* three days or less in the first week of January, the WEEKNUM function returns week numbers
* that are incorrect according to the European standard.
*
* Excel Function:
* WEEKNUM(dateValue[,style])
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $method Week begins on Sunday or Monday
* 1 or omitted Week begins on Sunday.
* 2 Week begins on Monday.
* 11 Week begins on Monday.
* 12 Week begins on Tuesday.
* 13 Week begins on Wednesday.
* 14 Week begins on Thursday.
* 15 Week begins on Friday.
* 16 Week begins on Saturday.
* 17 Week begins on Sunday.
* 21 ISO (Jan. 4 is week 1, begins on Monday).
*
* @return int|string Week Number
*/
public static function number($dateValue, $method = Constants::STARTWEEK_SUNDAY)
{
$origDateValueNull = empty($dateValue);
try {
$method = self::validateMethod($method);
if ($dateValue === null) { // boolean not allowed
$dateValue = (SharedDateHelper::getExcelCalendar() === SharedDateHelper::CALENDAR_MAC_1904 || $method === Constants::DOW_SUNDAY) ? 0 : 1;
}
$dateValue = self::validateDateValue($dateValue);
if (!$dateValue && self::buggyWeekNum1900($method)) {
// This seems to be an additional Excel bug.
return 0;
}
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$PHPDateObject = SharedDateHelper::excelToDateTimeObject($dateValue);
if ($method == Constants::STARTWEEK_MONDAY_ISO) {
Helpers::silly1900($PHPDateObject);
return (int) $PHPDateObject->format('W');
}
if (self::buggyWeekNum1904($method, $origDateValueNull, $PHPDateObject)) {
return 0;
}
Helpers::silly1900($PHPDateObject, '+ 5 years'); // 1905 calendar matches
$dayOfYear = (int) $PHPDateObject->format('z');
$PHPDateObject->modify('-' . $dayOfYear . ' days');
$firstDayOfFirstWeek = (int) $PHPDateObject->format('w');
$daysInFirstWeek = (6 - $firstDayOfFirstWeek + $method) % 7;
$daysInFirstWeek += 7 * !$daysInFirstWeek;
$endFirstWeek = $daysInFirstWeek - 1;
$weekOfYear = floor(($dayOfYear - $endFirstWeek + 13) / 7);
return (int) $weekOfYear;
}
/**
* ISOWEEKNUM.
*
* Returns the ISO 8601 week number of the year for a specified date.
*
* Excel Function:
* ISOWEEKNUM(dateValue)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
* @return int|string Week Number
*/
public static function isoWeekNumber($dateValue)
{
if (self::apparentBug($dateValue)) {
return 52;
}
try {
$dateValue = Helpers::getDateValue($dateValue);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$PHPDateObject = SharedDateHelper::excelToDateTimeObject($dateValue);
Helpers::silly1900($PHPDateObject);
return (int) $PHPDateObject->format('W');
}
/**
* WEEKDAY.
*
* Returns the day of the week for a specified date. The day is given as an integer
* ranging from 0 to 7 (dependent on the requested style).
*
* Excel Function:
* WEEKDAY(dateValue[,style])
*
* @param null|float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param mixed $style A number that determines the type of return value
* 1 or omitted Numbers 1 (Sunday) through 7 (Saturday).
* 2 Numbers 1 (Monday) through 7 (Sunday).
* 3 Numbers 0 (Monday) through 6 (Sunday).
*
* @return int|string Day of the week value
*/
public static function day($dateValue, $style = 1)
{
try {
$dateValue = Helpers::getDateValue($dateValue);
$style = self::validateStyle($style);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$PHPDateObject = SharedDateHelper::excelToDateTimeObject($dateValue);
Helpers::silly1900($PHPDateObject);
$DoW = (int) $PHPDateObject->format('w');
switch ($style) {
case 1:
++$DoW;
break;
case 2:
$DoW = self::dow0Becomes7($DoW);
break;
case 3:
$DoW = self::dow0Becomes7($DoW) - 1;
break;
}
return $DoW;
}
/**
* @param mixed $style expect int
*/
private static function validateStyle($style): int
{
$style = Functions::flattenSingleValue($style);
if (!is_numeric($style)) {
throw new Exception(Functions::VALUE());
}
$style = (int) $style;
if (($style < 1) || ($style > 3)) {
throw new Exception(Functions::NAN());
}
return $style;
}
private static function dow0Becomes7(int $DoW): int
{
return ($DoW === 0) ? 7 : $DoW;
}
/**
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*/
private static function apparentBug($dateValue): bool
{
if (SharedDateHelper::getExcelCalendar() !== SharedDateHelper::CALENDAR_MAC_1904) {
if (is_bool($dateValue)) {
return true;
}
if (is_numeric($dateValue) && !((int) $dateValue)) {
return true;
}
}
return false;
}
/**
* Validate dateValue parameter.
*
* @param mixed $dateValue
*/
private static function validateDateValue($dateValue): float
{
if (is_bool($dateValue)) {
throw new Exception(Functions::VALUE());
}
return Helpers::getDateValue($dateValue);
}
/**
* Validate method parameter.
*
* @param mixed $method
*/
private static function validateMethod($method): int
{
if ($method === null) {
$method = Constants::STARTWEEK_SUNDAY;
}
$method = Functions::flattenSingleValue($method);
if (!is_numeric($method)) {
throw new Exception(Functions::VALUE());
}
$method = (int) $method;
if (!array_key_exists($method, Constants::METHODARR)) {
throw new Exception(Functions::NAN());
}
$method = Constants::METHODARR[$method];
return $method;
}
private static function buggyWeekNum1900(int $method): bool
{
return $method === Constants::DOW_SUNDAY && SharedDateHelper::getExcelCalendar() === SharedDateHelper::CALENDAR_WINDOWS_1900;
}
private static function buggyWeekNum1904(int $method, bool $origNull, DateTime $dateObject): bool
{
// This appears to be another Excel bug.
return $method === Constants::DOW_SUNDAY && SharedDateHelper::getExcelCalendar() === SharedDateHelper::CALENDAR_MAC_1904 &&
!$origNull && $dateObject->format('Y-m-d') === '1904-01-01';
}
}

View File

@ -1,80 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class WeekDay
{
/**
* WEEKDAY.
*
* Returns the day of the week for a specified date. The day is given as an integer
* ranging from 0 to 7 (dependent on the requested style).
*
* Excel Function:
* WEEKDAY(dateValue[,style])
*
* @param null|float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $style A number that determines the type of return value
* 1 or omitted Numbers 1 (Sunday) through 7 (Saturday).
* 2 Numbers 1 (Monday) through 7 (Sunday).
* 3 Numbers 0 (Monday) through 6 (Sunday).
*
* @return int|string Day of the week value
*/
public static function funcWeekDay($dateValue, $style = 1)
{
try {
$dateValue = Helpers::getDateValue($dateValue);
$style = self::validateStyle($style);
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
Helpers::silly1900($PHPDateObject);
$DoW = (int) $PHPDateObject->format('w');
switch ($style) {
case 1:
++$DoW;
break;
case 2:
$DoW = self::dow0Becomes7($DoW);
break;
case 3:
$DoW = self::dow0Becomes7($DoW) - 1;
break;
}
return $DoW;
}
private static function validateStyle($style): int
{
$style = Functions::flattenSingleValue($style);
if (!is_numeric($style)) {
throw new Exception(Functions::VALUE());
}
$style = (int) $style;
if (($style < 1) || ($style > 3)) {
throw new Exception(Functions::NAN());
}
return $style;
}
private static function dow0Becomes7(int $DoW): int
{
return ($DoW === 0) ? 7 : $DoW;
}
}

View File

@ -1,130 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateTime;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class WeekNum
{
/**
* WEEKNUM.
*
* Returns the week of the year for a specified date.
* The WEEKNUM function considers the week containing January 1 to be the first week of the year.
* However, there is a European standard that defines the first week as the one with the majority
* of days (four or more) falling in the new year. This means that for years in which there are
* three days or less in the first week of January, the WEEKNUM function returns week numbers
* that are incorrect according to the European standard.
*
* Excel Function:
* WEEKNUM(dateValue[,style])
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
* @param int $method Week begins on Sunday or Monday
* 1 or omitted Week begins on Sunday.
* 2 Week begins on Monday.
* 11 Week begins on Monday.
* 12 Week begins on Tuesday.
* 13 Week begins on Wednesday.
* 14 Week begins on Thursday.
* 15 Week begins on Friday.
* 16 Week begins on Saturday.
* 17 Week begins on Sunday.
* 21 ISO (Jan. 4 is week 1, begins on Monday).
*
* @return int|string Week Number
*/
public static function funcWeekNum($dateValue, $method = Constants::STARTWEEK_SUNDAY)
{
$origDateValueNull = empty($dateValue);
try {
$method = self::validateMethod($method);
if ($dateValue === null) { // boolean not allowed
$dateValue = (Date::getExcelCalendar() === DATE::CALENDAR_MAC_1904 || $method === Constants::DOW_SUNDAY) ? 0 : 1;
}
$dateValue = self::validateDateValue($dateValue);
if (!$dateValue && self::buggyWeekNum1900($method)) {
// This seems to be an additional Excel bug.
return 0;
}
} catch (Exception $e) {
return $e->getMessage();
}
// Execute function
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
if ($method == Constants::STARTWEEK_MONDAY_ISO) {
Helpers::silly1900($PHPDateObject);
return (int) $PHPDateObject->format('W');
}
if (self::buggyWeekNum1904($method, $origDateValueNull, $PHPDateObject)) {
return 0;
}
Helpers::silly1900($PHPDateObject, '+ 5 years'); // 1905 calendar matches
$dayOfYear = (int) $PHPDateObject->format('z');
$PHPDateObject->modify('-' . $dayOfYear . ' days');
$firstDayOfFirstWeek = (int) $PHPDateObject->format('w');
$daysInFirstWeek = (6 - $firstDayOfFirstWeek + $method) % 7;
$daysInFirstWeek += 7 * !$daysInFirstWeek;
$endFirstWeek = $daysInFirstWeek - 1;
$weekOfYear = floor(($dayOfYear - $endFirstWeek + 13) / 7);
return (int) $weekOfYear;
}
/**
* Validate dateValue parameter.
*
* @param mixed $dateValue
*/
private static function validateDateValue($dateValue): float
{
if (is_bool($dateValue)) {
throw new Exception(Functions::VALUE());
}
return Helpers::getDateValue($dateValue);
}
/**
* Validate method parameter.
*
* @param mixed $method
*/
private static function validateMethod($method): int
{
if ($method === null) {
$method = Constants::STARTWEEK_SUNDAY;
}
$method = Functions::flattenSingleValue($method);
if (!is_numeric($method)) {
throw new Exception(Functions::VALUE());
}
$method = (int) $method;
if (!array_key_exists($method, Constants::METHODARR)) {
throw new Exception(Functions::NAN());
}
$method = Constants::METHODARR[$method];
return $method;
}
private static function buggyWeekNum1900(int $method): bool
{
return $method === Constants::DOW_SUNDAY && Date::getExcelCalendar() === Date::CALENDAR_WINDOWS_1900;
}
private static function buggyWeekNum1904(int $method, bool $origNull, DateTime $dateObject): bool
{
// This appears to be another Excel bug.
return $method === Constants::DOW_SUNDAY && Date::getExcelCalendar() === Date::CALENDAR_MAC_1904 && !$origNull && $dateObject->format('Y-m-d') === '1904-01-01';
}
}

View File

@ -2,9 +2,8 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class WorkDay
{
@ -24,11 +23,12 @@ class WorkDay
* @param int $endDays The number of nonweekend and nonholiday days before or after
* startDate. A positive value for days yields a future date; a
* negative value yields a past date.
* @param mixed $dateArgs
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function funcWorkDay($startDate, $endDays, ...$dateArgs)
public static function date($startDate, $endDays, ...$dateArgs)
{
// Retrieve the mandatory start date and days that are referenced in the function definition
try {
@ -65,8 +65,8 @@ class WorkDay
{
// Adjust the start date if it falls over a weekend
$startDoW = WeekDay::funcWeekDay($startDate, 3);
if (WeekDay::funcWeekDay($startDate, 3) >= 5) {
$startDoW = self::getWeekDay($startDate, 3);
if (self::getWeekDay($startDate, 3) >= 5) {
$startDate += 7 - $startDoW;
--$endDays;
}
@ -77,7 +77,7 @@ class WorkDay
while ($endDays > 0) {
++$endDate;
// Adjust the calculated end date if it falls over a weekend
$endDow = WeekDay::funcWeekDay($endDate, 3);
$endDow = self::getWeekDay($endDate, 3);
if ($endDow >= 5) {
$endDate += 7 - $endDow;
}
@ -96,7 +96,7 @@ class WorkDay
{
$holidayCountedArray = $holidayDates = [];
foreach ($holidayArray as $holidayDate) {
if (WeekDay::funcWeekDay($holidayDate, 3) < 5) {
if (self::getWeekDay($holidayDate, 3) < 5) {
$holidayDates[] = $holidayDate;
}
}
@ -109,7 +109,7 @@ class WorkDay
}
}
// Adjust the calculated end date if it falls over a weekend
$endDoW = WeekDay::funcWeekDay($endDate, 3);
$endDoW = self::getWeekDay($endDate, 3);
if ($endDoW >= 5) {
$endDate += 7 - $endDoW;
}
@ -127,9 +127,8 @@ class WorkDay
{
// Adjust the start date if it falls over a weekend
$startDoW = WeekDay::funcWeekDay($startDate, 3);
if (WeekDay::funcWeekDay($startDate, 3) >= 5) {
// @phpstan-ignore-next-line
$startDoW = self::getWeekDay($startDate, 3);
if (self::getWeekDay($startDate, 3) >= 5) {
$startDate += -$startDoW + 4;
++$endDays;
}
@ -140,7 +139,7 @@ class WorkDay
while ($endDays < 0) {
--$endDate;
// Adjust the calculated end date if it falls over a weekend
$endDow = WeekDay::funcWeekDay($endDate, 3);
$endDow = self::getWeekDay($endDate, 3);
if ($endDow >= 5) {
$endDate += 4 - $endDow;
}
@ -159,7 +158,7 @@ class WorkDay
{
$holidayCountedArray = $holidayDates = [];
foreach ($holidayArray as $holidayDate) {
if (WeekDay::funcWeekDay($holidayDate, 3) < 5) {
if (self::getWeekDay($holidayDate, 3) < 5) {
$holidayDates[] = $holidayDate;
}
}
@ -172,13 +171,19 @@ class WorkDay
}
}
// Adjust the calculated end date if it falls over a weekend
$endDoW = WeekDay::funcWeekDay($endDate, 3);
$endDoW = self::getWeekDay($endDate, 3);
if ($endDoW >= 5) {
// @phpstan-ignore-next-line
$endDate += -$endDoW + 4;
}
}
return $endDate;
}
private static function getWeekDay(float $date, int $wd): int
{
$result = Week::day($date, $wd);
return is_string($result) ? -1 : $result;
}
}

View File

@ -1,40 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class Year
{
/**
* YEAR.
*
* Returns the year corresponding to a date.
* The year is returned as an integer in the range 1900-9999.
*
* Excel Function:
* YEAR(dateValue)
*
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
* PHP DateTime object, or a standard date string
*
* @return int|string Year
*/
public static function funcYear($dateValue)
{
try {
$dateValue = Helpers::getDateValue($dateValue);
} catch (Exception $e) {
return $e->getMessage();
}
if ($dateValue < 1 && Date::getExcelCalendar() === DATE::CALENDAR_WINDOWS_1900) {
return 1900;
}
// Execute function
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
return (int) $PHPDateObject->format('Y');
}
}

View File

@ -2,9 +2,9 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper;
class YearFrac
{
@ -34,7 +34,7 @@ class YearFrac
*
* @return float|string fraction of the year, or a string containing an error
*/
public static function funcYearFrac($startDate, $endDate, $method = 0)
public static function fraction($startDate, $endDate, $method = 0)
{
try {
$method = (int) Helpers::validateNumericNull($method);
@ -50,15 +50,15 @@ class YearFrac
switch ($method) {
case 0:
return Days360::funcDays360($startDate, $endDate) / 360;
return Days360::between($startDate, $endDate) / 360;
case 1:
return self::method1($startDate, $endDate);
case 2:
return DateDif::funcDateDif($startDate, $endDate) / 360;
return Difference::interval($startDate, $endDate) / 360;
case 3:
return DateDif::funcDateDif($startDate, $endDate) / 365;
return Difference::interval($startDate, $endDate) / 365;
case 4:
return Days360::funcDays360($startDate, $endDate, true) / 360;
return Days360::between($startDate, $endDate, true) / 360;
}
return Functions::NAN();
@ -72,9 +72,9 @@ class YearFrac
*/
private static function excelBug(float $sDate, $startDate, $endDate, int $method): float
{
if (Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_OPENOFFICE && Date::getExcelCalendar() !== Date::CALENDAR_MAC_1904) {
if (Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_OPENOFFICE && SharedDateHelper::getExcelCalendar() !== SharedDateHelper::CALENDAR_MAC_1904) {
if ($endDate === null && $startDate !== null) {
if (Month::funcMonth($sDate) == 12 && Day::funcDay($sDate) === 31 && $method === 0) {
if (DateParts::month($sDate) == 12 && DateParts::day($sDate) === 31 && $method === 0) {
$sDate += 2;
} else {
++$sDate;
@ -87,14 +87,14 @@ class YearFrac
private static function method1(float $startDate, float $endDate): float
{
$days = DateDif::funcDateDif($startDate, $endDate);
$startYear = Year::funcYear($startDate);
$endYear = Year::funcYear($endDate);
$days = Difference::interval($startDate, $endDate);
$startYear = (int) DateParts::year($startDate);
$endYear = (int) DateParts::year($endDate);
$years = $endYear - $startYear + 1;
$startMonth = Month::funcMonth($startDate);
$startDay = Day::funcDay($startDate);
$endMonth = Month::funcMonth($endDate);
$endDay = Day::funcDay($endDate);
$startMonth = (int) DateParts::month($startDate);
$startDay = (int) DateParts::day($startDate);
$endMonth = (int) DateParts::month($endDate);
$endDay = (int) DateParts::day($endDate);
$startMonthDay = 100 * $startMonth + $startDay;
$endMonthDay = 100 * $endMonth + $endDay;
if ($years == 1) {

View File

@ -70,7 +70,7 @@ class Amortization
return $e->getMessage();
}
$yearFrac = DateTimeExcel\YearFrac::funcYearFrac($purchased, $firstPeriod, $basis);
$yearFrac = DateTimeExcel\YearFrac::fraction($purchased, $firstPeriod, $basis);
if (is_string($yearFrac)) {
return $yearFrac;
}
@ -160,8 +160,8 @@ class Amortization
$fOneRate = $cost * $rate;
$fCostDelta = $cost - $salvage;
// Note, quirky variation for leap years on the YEARFRAC for this function
$purchasedYear = DateTimeExcel\Year::funcYear($purchased);
$yearFrac = DateTimeExcel\YearFrac::funcYearFrac($purchased, $firstPeriod, $basis);
$purchasedYear = DateTimeExcel\DateParts::year($purchased);
$yearFrac = DateTimeExcel\YearFrac::fraction($purchased, $firstPeriod, $basis);
if (is_string($yearFrac)) {
return $yearFrac;
}

View File

@ -196,10 +196,9 @@ class NonPeriodic
return $e->getMessage();
}
if ($date0 > $datei) {
/** @phpstan-ignore-next-line */
$dif = $ordered ? Functions::NAN() : -DateTimeExcel\DateDif::funcDateDif($datei, $date0, 'd');
$dif = $ordered ? Functions::NAN() : -((int) DateTimeExcel\Difference::interval($datei, $date0, 'd'));
} else {
$dif = DateTimeExcel\DateDif::funcDateDif($date0, $datei, 'd');
$dif = DateTimeExcel\Difference::interval($date0, $datei, 'd');
}
if (!is_numeric($dif)) {
return $dif;

View File

@ -63,17 +63,17 @@ class Coupons
return $e->getMessage();
}
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis);
if (is_string($daysPerYear)) {
return Functions::VALUE();
}
$prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, self::PERIOD_DATE_PREVIOUS);
if ($basis === FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL) {
return abs(DateTimeExcel\Days::funcDays($prev, $settlement));
return abs((float) DateTimeExcel\Days::between($prev, $settlement));
}
return DateTimeExcel\YearFrac::funcYearFrac($prev, $settlement, $basis) * $daysPerYear;
return DateTimeExcel\YearFrac::fraction($prev, $settlement, $basis) * $daysPerYear;
}
/**
@ -133,7 +133,7 @@ class Coupons
case FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL:
// Actual/actual
if ($frequency == FinancialConstants::FREQUENCY_ANNUAL) {
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis);
return $daysPerYear / $frequency;
}
@ -197,7 +197,7 @@ class Coupons
return $e->getMessage();
}
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis);
$next = self::couponFirstPeriodDate($settlement, $maturity, $frequency, self::PERIOD_DATE_NEXT);
if ($basis === FinancialConstants::BASIS_DAYS_PER_YEAR_NASD) {
@ -208,7 +208,7 @@ class Coupons
}
}
return DateTimeExcel\YearFrac::funcYearFrac($settlement, $next, $basis) * $daysPerYear;
return DateTimeExcel\YearFrac::fraction($settlement, $next, $basis) * $daysPerYear;
}
/**
@ -316,7 +316,7 @@ class Coupons
return $e->getMessage();
}
$yearsBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac(
$yearsBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction(
$settlement,
$maturity,
FinancialConstants::BASIS_DAYS_PER_YEAR_NASD

View File

@ -3,9 +3,26 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\Financial;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\TextData\Format;
class Dollar
{
/**
* DOLLAR.
*
* This function converts a number to text using currency format, with the decimals rounded to the specified place.
* The format used is $#,##0.00_);($#,##0.00)..
*
* @param mixed $number The value to format
* @param mixed $precision The number of digits to display to the right of the decimal point (as an integer).
* If precision is negative, number is rounded to the left of the decimal point.
* If you omit precision, it is assumed to be 2
*/
public static function format($number, $precision = 2): string
{
return Format::DOLLAR($number, $precision);
}
/**
* DOLLARDE.
*

View File

@ -78,12 +78,12 @@ class AccruedInterest
return $e->getMessage();
}
$daysBetweenIssueAndSettlement = YearFrac::funcYearFrac($issue, $settlement, $basis);
$daysBetweenIssueAndSettlement = YearFrac::fraction($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
$daysBetweenFirstInterestAndSettlement = YearFrac::funcYearFrac($firstInterest, $settlement, $basis);
$daysBetweenFirstInterestAndSettlement = YearFrac::fraction($firstInterest, $settlement, $basis);
if (!is_numeric($daysBetweenFirstInterestAndSettlement)) {
// return date error
return $daysBetweenFirstInterestAndSettlement;
@ -140,7 +140,7 @@ class AccruedInterest
return $e->getMessage();
}
$daysBetweenIssueAndSettlement = YearFrac::funcYearFrac($issue, $settlement, $basis);
$daysBetweenIssueAndSettlement = YearFrac::fraction($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;

View File

@ -134,7 +134,7 @@ class Price
return $e->getMessage();
}
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@ -194,23 +194,23 @@ class Price
return $e->getMessage();
}
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis);
if (!is_numeric($daysPerYear)) {
return $daysPerYear;
}
$daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::funcYearFrac($issue, $settlement, $basis);
$daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::fraction($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
$daysBetweenIssueAndSettlement *= $daysPerYear;
$daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($issue, $maturity, $basis);
$daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::fraction($issue, $maturity, $basis);
if (!is_numeric($daysBetweenIssueAndMaturity)) {
// return date error
return $daysBetweenIssueAndMaturity;
}
$daysBetweenIssueAndMaturity *= $daysPerYear;
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@ -272,7 +272,7 @@ class Price
if ($investment <= 0) {
return Functions::NAN();
}
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;

View File

@ -63,7 +63,7 @@ class Rates
return Functions::NAN();
}
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@ -126,7 +126,7 @@ class Rates
return Functions::NAN();
}
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;

View File

@ -57,11 +57,11 @@ class Yields
return $e->getMessage();
}
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis);
if (!is_numeric($daysPerYear)) {
return $daysPerYear;
}
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@ -122,23 +122,23 @@ class Yields
return $e->getMessage();
}
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis);
if (!is_numeric($daysPerYear)) {
return $daysPerYear;
}
$daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::funcYearFrac($issue, $settlement, $basis);
$daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::fraction($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
$daysBetweenIssueAndSettlement *= $daysPerYear;
$daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($issue, $maturity, $basis);
$daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::fraction($issue, $maturity, $basis);
if (!is_numeric($daysBetweenIssueAndMaturity)) {
// return date error
return $daysBetweenIssueAndMaturity;
}
$daysBetweenIssueAndMaturity *= $daysPerYear;
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;

View File

@ -43,7 +43,7 @@ class TreasuryBill
$daysBetweenSettlementAndMaturity = $maturity - $settlement;
$daysPerYear = Helpers::daysPerYear(
DateTimeExcel\Year::funcYear($maturity),
DateTimeExcel\DateParts::year($maturity),
FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL
);
@ -88,7 +88,7 @@ class TreasuryBill
$daysBetweenSettlementAndMaturity = $maturity - $settlement;
$daysPerYear = Helpers::daysPerYear(
DateTimeExcel\Year::funcYear($maturity),
DateTimeExcel\DateParts::year($maturity),
FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL
);
@ -134,7 +134,7 @@ class TreasuryBill
$daysBetweenSettlementAndMaturity = $maturity - $settlement;
$daysPerYear = Helpers::daysPerYear(
DateTimeExcel\Year::funcYear($maturity),
DateTimeExcel\DateParts::year($maturity),
FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL
);

View File

@ -13,6 +13,9 @@ use PhpOffice\PhpSpreadsheet\Calculation\LookupRef\VLookup;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
/**
* @deprecated 1.18.0
*/
class LookupRef
{
/**
@ -25,7 +28,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the cell() method in the LookupRef\Address class instead
* @see LookupRef\Address::cell()
* Use the cell() method in the LookupRef\Address class instead
*
* @param mixed $row Row number to use in the cell reference
* @param mixed $column Column number to use in the cell reference
@ -61,11 +65,12 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the COLUMN() method in the LookupRef\RowColumnInformation class instead
* @see LookupRef\RowColumnInformation::COLUMN()
* Use the COLUMN() method in the LookupRef\RowColumnInformation class instead
*
* @param null|array|string $cellAddress A reference to a range of cells for which you want the column numbers
*
* @return int|int[]
* @return int|int[]|string
*/
public static function COLUMN($cellAddress = null, ?Cell $cell = null)
{
@ -82,7 +87,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the COLUMNS() method in the LookupRef\RowColumnInformation class instead
* @see LookupRef\RowColumnInformation::COLUMNS()
* Use the COLUMNS() method in the LookupRef\RowColumnInformation class instead
*
* @param null|array|string $cellAddress An array or array formula, or a reference to a range of cells
* for which you want the number of columns
@ -109,7 +115,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the ROW() method in the LookupRef\RowColumnInformation class instead
* @see LookupRef\RowColumnInformation::ROW()
* Use the ROW() method in the LookupRef\RowColumnInformation class instead
*
* @param null|array|string $cellAddress A reference to a range of cells for which you want the row numbers
*
@ -130,7 +137,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the ROWS() method in the LookupRef\RowColumnInformation class instead
* @see LookupRef\RowColumnInformation::ROWS()
* Use the ROWS() method in the LookupRef\RowColumnInformation class instead
*
* @param null|array|string $cellAddress An array or array formula, or a reference to a range of cells
* for which you want the number of rows
@ -148,29 +156,20 @@ class LookupRef
* Excel Function:
* =HYPERLINK(linkURL,displayName)
*
* @Deprecated 1.18.0
*
* @see LookupRef\Hyperlink::set()
* Use the set() method in the LookupRef\Hyperlink class instead
*
* @param mixed $linkURL Expect string. Value to check, is also the value returned when no error
* @param mixed $displayName Expect string. Value to return when testValue is an error condition
* @param Cell $pCell The cell to set the hyperlink in
*
* @return mixed The value of $displayName (or $linkURL if $displayName was blank)
* @return string The value of $displayName (or $linkURL if $displayName was blank)
*/
public static function HYPERLINK($linkURL = '', $displayName = null, ?Cell $pCell = null)
{
$linkURL = ($linkURL === null) ? '' : Functions::flattenSingleValue($linkURL);
$displayName = ($displayName === null) ? '' : Functions::flattenSingleValue($displayName);
if ((!is_object($pCell)) || (trim($linkURL) == '')) {
return Functions::REF();
}
if ((is_object($displayName)) || trim($displayName) == '') {
$displayName = $linkURL;
}
$pCell->getHyperlink()->setUrl($linkURL);
$pCell->getHyperlink()->setTooltip($displayName);
return $displayName;
return LookupRef\Hyperlink::set($linkURL, $displayName, $pCell);
}
/**
@ -184,7 +183,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the INDIRECT() method in the LookupRef\Indirect class instead
* @see LookupRef\Indirect::INDIRECT()
* Use the INDIRECT() method in the LookupRef\Indirect class instead
*
* NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010
*
@ -192,8 +192,6 @@ class LookupRef
* @param Cell $pCell The current cell (containing this formula)
*
* @return array|string An array containing a cell or range of cells, or a string on error
*
* @TODO Support for the optional a1 parameter introduced in Excel 2010
*/
public static function INDIRECT($cellAddress, Cell $pCell)
{
@ -212,7 +210,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the OFFSET() method in the LookupRef\Offset class instead
* @see LookupRef\Offset::OFFSET()
* Use the OFFSET() method in the LookupRef\Offset class instead
*
* @param null|string $cellAddress The reference from which you want to base the offset.
* Reference must refer to a cell or range of adjacent cells;
@ -248,31 +247,16 @@ class LookupRef
* Excel Function:
* =CHOOSE(index_num, value1, [value2], ...)
*
* @Deprecated 1.18.0
*
* @see LookupRef\Selection::choose()
* Use the choose() method in the LookupRef\Selection class instead
*
* @return mixed The selected value
*/
public static function CHOOSE(...$chooseArgs)
{
$chosenEntry = Functions::flattenArray(array_shift($chooseArgs));
$entryCount = count($chooseArgs) - 1;
if (is_array($chosenEntry)) {
$chosenEntry = array_shift($chosenEntry);
}
if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) {
--$chosenEntry;
} else {
return Functions::VALUE();
}
$chosenEntry = floor($chosenEntry);
if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) {
return Functions::VALUE();
}
if (is_array($chooseArgs[$chosenEntry])) {
return Functions::flattenArray($chooseArgs[$chosenEntry]);
}
return $chooseArgs[$chosenEntry];
return LookupRef\Selection::choose(...$chooseArgs);
}
/**
@ -285,7 +269,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the MATCH() method in the LookupRef\ExcelMatch class instead
* @see LookupRef\ExcelMatch::MATCH()
* Use the MATCH() method in the LookupRef\ExcelMatch class instead
*
* @param mixed $lookupValue The value that you want to match in lookup_array
* @param mixed $lookupArray The range of cells being searched
@ -309,7 +294,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the index() method in the LookupRef\Matrix class instead
* @see LookupRef\Matrix::index()
* Use the index() method in the LookupRef\Matrix class instead
*
* @param mixed $rowNum The row in the array or range from which to return a value.
* If row_num is omitted, column_num is required.
@ -329,7 +315,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the transpose() method in the LookupRef\Matrix class instead
* @see LookupRef\Matrix::transpose()
* Use the transpose() method in the LookupRef\Matrix class instead
*
* @param array $matrixData A matrix of values
*
@ -350,7 +337,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the lookup() method in the LookupRef\VLookup class instead
* @see LookupRef\VLookup::lookup()
* Use the lookup() method in the LookupRef\VLookup class instead
*
* @param mixed $lookup_value The value that you want to match in lookup_array
* @param mixed $lookup_array The range of cells being searched
@ -372,7 +360,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the lookup() method in the LookupRef\HLookup class instead
* @see LookupRef\HLookup::lookup()
* Use the lookup() method in the LookupRef\HLookup class instead
*
* @param mixed $lookup_value The value that you want to match in lookup_array
* @param mixed $lookup_array The range of cells being searched
@ -393,7 +382,8 @@ class LookupRef
*
* @Deprecated 1.18.0
*
* @see Use the lookup() method in the LookupRef\Lookup class instead
* @see LookupRef\Lookup::lookup()
* Use the lookup() method in the LookupRef\Lookup class instead
*
* @param mixed $lookup_value The value that you want to match in lookup_array
* @param mixed $lookup_vector The range of cells being searched
@ -409,6 +399,11 @@ class LookupRef
/**
* FORMULATEXT.
*
* @Deprecated 1.18.0
*
* @see LookupRef\Formula::text()
* Use the text() method in the LookupRef\Formula class instead
*
* @param mixed $cellReference The cell to check
* @param Cell $pCell The current cell (containing this formula)
*
@ -416,22 +411,6 @@ class LookupRef
*/
public static function FORMULATEXT($cellReference = '', ?Cell $pCell = null)
{
if ($pCell === null) {
return Functions::REF();
}
preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellReference, $matches);
$cellReference = $matches[6] . $matches[7];
$worksheetName = trim($matches[3], "'");
$worksheet = (!empty($worksheetName))
? $pCell->getWorksheet()->getParent()->getSheetByName($worksheetName)
: $pCell->getWorksheet();
if (!$worksheet->getCell($cellReference)->isFormula()) {
return Functions::NA();
}
return $worksheet->getCell($cellReference)->getValue();
return LookupRef\Formula::text($cellReference, $pCell);
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
class Formula
{
/**
* FORMULATEXT.
*
* @param mixed $cellReference The cell to check
* @param Cell $pCell The current cell (containing this formula)
*
* @return string
*/
public static function text($cellReference = '', ?Cell $pCell = null)
{
if ($pCell === null) {
return Functions::REF();
}
preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellReference, $matches);
$cellReference = $matches[6] . $matches[7];
$worksheetName = trim($matches[3], "'");
$worksheet = (!empty($worksheetName))
? $pCell->getWorksheet()->getParent()->getSheetByName($worksheetName)
: $pCell->getWorksheet();
if (
$worksheet === null ||
!$worksheet->cellExists($cellReference) ||
!$worksheet->getCell($cellReference)->isFormula()
) {
return Functions::NA();
}
return $worksheet->getCell($cellReference)->getValue();
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
class Hyperlink
{
/**
* HYPERLINK.
*
* Excel Function:
* =HYPERLINK(linkURL, [displayName])
*
* @param mixed $linkURL Expect string. Value to check, is also the value returned when no error
* @param mixed $displayName Expect string. Value to return when testValue is an error condition
* @param Cell $pCell The cell to set the hyperlink in
*
* @return mixed The value of $displayName (or $linkURL if $displayName was blank)
*/
public static function set($linkURL = '', $displayName = null, ?Cell $pCell = null)
{
$linkURL = ($linkURL === null) ? '' : Functions::flattenSingleValue($linkURL);
$displayName = ($displayName === null) ? '' : Functions::flattenSingleValue($displayName);
if ((!is_object($pCell)) || (trim($linkURL) == '')) {
return Functions::REF();
}
if ((is_object($displayName)) || trim($displayName) == '') {
$displayName = $linkURL;
}
$pCell->getHyperlink()->setUrl($linkURL);
$pCell->getHyperlink()->setTooltip($displayName);
return $displayName;
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class LookupRefValidations
{
/**
* @param mixed $value
*/
public static function validateInt($value): int
{
if (!is_numeric($value)) {
if (Functions::isError($value)) {
throw new Exception($value);
}
throw new Exception(Functions::VALUE());
}
return (int) floor((float) $value);
}
/**
* @param mixed $value
*/
public static function validatePositiveInt($value, bool $allowZero = true): int
{
$value = self::validateInt($value);
if (($allowZero === false && $value <= 0) || $value < 0) {
throw new Exception(Functions::VALUE());
}
return $value;
}
}

View File

@ -2,6 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Matrix
@ -39,7 +40,7 @@ class Matrix
* Uses an index to choose a value from a reference or array
*
* Excel Function:
* =INDEX(range_array, row_num, [column_num])
* =INDEX(range_array, row_num, [column_num], [area_num])
*
* @param mixed $matrix A range of cells or an array constant
* @param mixed $rowNum The row in the array or range from which to return a value.
@ -47,15 +48,20 @@ class Matrix
* @param mixed $columnNum The column in the array or range from which to return a value.
* If column_num is omitted, row_num is required.
*
* TODO Provide support for area_num, currently not supported
*
* @return mixed the value of a specified cell or array of cells
*/
public static function index($matrix, $rowNum = 0, $columnNum = 0)
{
$rowNum = Functions::flattenSingleValue($rowNum);
$columnNum = Functions::flattenSingleValue($columnNum);
$rowNum = ($rowNum === null) ? 0 : Functions::flattenSingleValue($rowNum);
$columnNum = ($columnNum === null) ? 0 : Functions::flattenSingleValue($columnNum);
if (!is_numeric($rowNum) || !is_numeric($columnNum) || ($rowNum < 0) || ($columnNum < 0)) {
return Functions::VALUE();
try {
$rowNum = LookupRefValidations::validatePositiveInt($rowNum);
$columnNum = LookupRefValidations::validatePositiveInt($columnNum);
} catch (Exception $e) {
return $e->getMessage();
}
if (!is_array($matrix) || ($rowNum > count($matrix))) {
@ -69,12 +75,12 @@ class Matrix
return Functions::REF();
}
if ($columnNum == 0) {
if ($columnNum === 0) {
return self::extractRowValue($matrix, $rowKeys, $rowNum);
}
$columnNum = $columnKeys[--$columnNum];
if ($rowNum == 0) {
if ($rowNum === 0) {
return array_map(
function ($value) {
return [$value];
@ -89,7 +95,7 @@ class Matrix
private static function extractRowValue(array $matrix, array $rowKeys, int $rowNum)
{
if ($rowNum == 0) {
if ($rowNum === 0) {
return $matrix;
}

View File

@ -0,0 +1,46 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Selection
{
/**
* CHOOSE.
*
* Uses lookup_value to return a value from the list of value arguments.
* Use CHOOSE to select one of up to 254 values based on the lookup_value.
*
* Excel Function:
* =CHOOSE(index_num, value1, [value2], ...)
*
* @param mixed ...$chooseArgs Data values
*
* @return mixed The selected value
*/
public static function choose(...$chooseArgs)
{
$chosenEntry = Functions::flattenArray(array_shift($chooseArgs));
$entryCount = count($chooseArgs) - 1;
if (is_array($chosenEntry)) {
$chosenEntry = array_shift($chosenEntry);
}
if (is_numeric($chosenEntry)) {
--$chosenEntry;
} else {
return Functions::VALUE();
}
$chosenEntry = floor($chosenEntry);
if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) {
return Functions::VALUE();
}
if (is_array($chooseArgs[$chosenEntry])) {
return Functions::flattenArray($chooseArgs[$chosenEntry]);
}
return $chooseArgs[$chosenEntry];
}
}

View File

@ -2,6 +2,9 @@
namespace PhpOffice\PhpSpreadsheet\Calculation;
/**
* @deprecated 1.18.0
*/
class MathTrig
{
/**
@ -44,8 +47,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Atan2::evaluate()
* Use the evaluate method in the MathTrig\Atan2 class instead
* @See MathTrig\Trig\Tangent::atan2()
* Use the atan2 method in the MathTrig\Trig\Tangent class instead
*
* @param float $xCoordinate the x-coordinate of the point
* @param float $yCoordinate the y-coordinate of the point
@ -54,7 +57,7 @@ class MathTrig
*/
public static function ATAN2($xCoordinate = null, $yCoordinate = null)
{
return MathTrig\Atan2::evaluate($xCoordinate, $yCoordinate);
return MathTrig\Trig\Tangent::atan2($xCoordinate, $yCoordinate);
}
/**
@ -94,17 +97,17 @@ class MathTrig
*
* @Deprecated 1.17.0
*
* @see MathTrig\Ceiling::evaluate()
* Use the evaluate() method in the MathTrig\Ceiling class instead
*
* @param float $number the number you want to round
* @param float $significance the multiple to which you want to round
*
* @return float|string Rounded Number, or a string containing an error
*
* @see MathTrig\Ceiling::ceiling()
* Use the ceiling() method in the MathTrig\Ceiling class instead
*/
public static function CEILING($number, $significance = null)
{
return MathTrig\Ceiling::evaluate($number, $significance);
return MathTrig\Ceiling::ceiling($number, $significance);
}
/**
@ -124,7 +127,7 @@ class MathTrig
* @param int $numObjs Number of different objects
* @param int $numInSet Number of objects in each combination
*
* @return int|string Number of combinations, or a string containing an error
* @return float|int|string Number of combinations, or a string containing an error
*/
public static function COMBIN($numObjs, $numInSet)
{
@ -145,16 +148,16 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @see MathTrig\Even::evaluate()
* Use the evaluate() method in the MathTrig\Even class instead
* @see MathTrig\Round::even()
* Use the even() method in the MathTrig\Round class instead
*
* @param float $number Number to round
*
* @return int|string Rounded Number, or a string containing an error
* @return float|int|string Rounded Number, or a string containing an error
*/
public static function EVEN($number)
{
return MathTrig\Even::evaluate($number);
return MathTrig\Round::even($number);
}
/**
@ -181,16 +184,16 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @see MathTrig\Fact::evaluate()
* Use the evaluate() method in the MathTrig\Fact class instead
*
* @param float $factVal Factorial Value
*
* @return int|string Factorial, or a string containing an error
* @return float|int|string Factorial, or a string containing an error
*
*@see MathTrig\Factorial::fact()
* Use the fact() method in the MathTrig\Factorial class instead
*/
public static function FACT($factVal)
{
return MathTrig\Fact::evaluate($factVal);
return MathTrig\Factorial::fact($factVal);
}
/**
@ -203,16 +206,16 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @see MathTrig\FactDouble::evaluate()
* Use the evaluate() method in the MathTrig\FactDouble class instead
*
* @param float $factVal Factorial Value
*
* @return int|string Double Factorial, or a string containing an error
* @return float|int|string Double Factorial, or a string containing an error
*
*@see MathTrig\Factorial::factDouble()
* Use the factDouble() method in the MathTrig\Factorial class instead
*/
public static function FACTDOUBLE($factVal)
{
return MathTrig\FactDouble::evaluate($factVal);
return MathTrig\Factorial::factDouble($factVal);
}
/**
@ -225,17 +228,17 @@ class MathTrig
*
* @Deprecated 1.17.0
*
* @see MathTrig\Floor::evaluate()
* Use the evaluate() method in the MathTrig\Floor class instead
*
* @param float $number Number to round
* @param float $significance Significance
*
* @return float|string Rounded Number, or a string containing an error
*
*@see MathTrig\Floor::floor()
* Use the floor() method in the MathTrig\Floor class instead
*/
public static function FLOOR($number, $significance = null)
{
return MathTrig\Floor::evaluate($number, $significance);
return MathTrig\Floor::floor($number, $significance);
}
/**
@ -248,18 +251,18 @@ class MathTrig
*
* @Deprecated 1.17.0
*
* @see MathTrig\FloorMath::evaluate()
* Use the evaluate() method in the MathTrig\FloorMath class instead
*
* @param float $number Number to round
* @param float $significance Significance
* @param int $mode direction to round negative numbers
*
* @return float|string Rounded Number, or a string containing an error
*
*@see MathTrig\Floor::math()
* Use the math() method in the MathTrig\Floor class instead
*/
public static function FLOORMATH($number, $significance = null, $mode = 0)
{
return MathTrig\FloorMath::evaluate($number, $significance, $mode);
return MathTrig\Floor::math($number, $significance, $mode);
}
/**
@ -272,17 +275,17 @@ class MathTrig
*
* @Deprecated 1.17.0
*
* @see MathTrig\FloorPrecise::evaluate()
* Use the evaluate() method in the MathTrig\FloorPrecise class instead
*
* @param float $number Number to round
* @param float $significance Significance
*
* @return float|string Rounded Number, or a string containing an error
*
*@see MathTrig\Floor::precise()
* Use the precise() method in the MathTrig\Floor class instead
*/
public static function FLOORPRECISE($number, $significance = 1)
{
return MathTrig\FloorPrecise::evaluate($number, $significance);
return MathTrig\Floor::precise($number, $significance);
}
/**
@ -446,17 +449,17 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @see MathTrig\Mod::evaluate()
* Use the evaluate() method in the MathTrig\Mod class instead
* @see MathTrig\Operations::mod()
* Use the mod() method in the MathTrig\Operations class instead
*
* @param int $a Dividend
* @param int $b Divisor
*
* @return int|string Remainder, or a string containing an error
* @return float|int|string Remainder, or a string containing an error
*/
public static function MOD($a = 1, $b = 1)
{
return MathTrig\Mod::evaluate($a, $b);
return MathTrig\Operations::mod($a, $b);
}
/**
@ -466,17 +469,17 @@ class MathTrig
*
* @Deprecated 1.17.0
*
* @see MathTrig\Mround::evaluate()
* Use the evaluate() method in the MathTrig\Mround class instead
*
* @param float $number Number to round
* @param int $multiple Multiple to which you want to round $number
*
* @return float|string Rounded Number, or a string containing an error
*
*@see MathTrig\Round::multiple()
* Use the multiple() method in the MathTrig\Mround class instead
*/
public static function MROUND($number, $multiple)
{
return MathTrig\Mround::evaluate($number, $multiple);
return MathTrig\Round::multiple($number, $multiple);
}
/**
@ -486,8 +489,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Multinomial::evaluate()
* Use the evaluate method in the MathTrig\Multinomial class instead
* @See MathTrig\Factorial::multinomial()
* Use the multinomial method in the MathTrig\Factorial class instead
*
* @param mixed[] $args An array of mixed values for the Data Series
*
@ -495,7 +498,7 @@ class MathTrig
*/
public static function MULTINOMIAL(...$args)
{
return MathTrig\Multinomial::evaluate(...$args);
return MathTrig\Factorial::multinomial(...$args);
}
/**
@ -505,16 +508,16 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Odd::evaluate()
* Use the evaluate method in the MathTrig\Odd class instead
* @See MathTrig\Round::odd()
* Use the odd method in the MathTrig\Round class instead
*
* @param float $number Number to round
*
* @return int|string Rounded Number, or a string containing an error
* @return float|int|string Rounded Number, or a string containing an error
*/
public static function ODD($number)
{
return MathTrig\Odd::evaluate($number);
return MathTrig\Round::odd($number);
}
/**
@ -524,7 +527,7 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Power::evaluate()
* @See MathTrig\Operations::power()
* Use the evaluate method in the MathTrig\Power class instead
*
* @param float $x
@ -534,7 +537,7 @@ class MathTrig
*/
public static function POWER($x = 0, $y = 2)
{
return MathTrig\Power::evaluate($x, $y);
return MathTrig\Operations::power($x, $y);
}
/**
@ -544,8 +547,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Product::evaluate()
* Use the evaluate method in the MathTrig\Product class instead
* @See MathTrig\Operations::product()
* Use the product method in the MathTrig\Operations class instead
*
* Excel Function:
* PRODUCT(value1[,value2[, ...]])
@ -556,7 +559,7 @@ class MathTrig
*/
public static function PRODUCT(...$args)
{
return MathTrig\Product::evaluate(...$args);
return MathTrig\Operations::product(...$args);
}
/**
@ -567,8 +570,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Quotient::evaluate()
* Use the evaluate method in the MathTrig\Quotient class instead
* @See MathTrig\Operations::quotient()
* Use the quotient method in the MathTrig\Operations class instead
*
* Excel Function:
* QUOTIENT(value1[,value2[, ...]])
@ -580,7 +583,7 @@ class MathTrig
*/
public static function QUOTIENT($numerator, $denominator)
{
return MathTrig\Quotient::evaluate($numerator, $denominator);
return MathTrig\Operations::quotient($numerator, $denominator);
}
/**
@ -628,8 +631,8 @@ class MathTrig
*
* @Deprecated 1.17.0
*
* @See MathTrig\RoundUp::evaluate()
* Use the evaluate() method in the MathTrig\RoundUp class instead
* @See MathTrig\Round::up()
* Use the up() method in the MathTrig\Round class instead
*
* @param float $number Number to round
* @param int $digits Number of digits to which you want to round $number
@ -638,7 +641,7 @@ class MathTrig
*/
public static function ROUNDUP($number, $digits)
{
return MathTrig\RoundUp::evaluate($number, $digits);
return MathTrig\Round::up($number, $digits);
}
/**
@ -648,8 +651,8 @@ class MathTrig
*
* @Deprecated 1.17.0
*
* @See MathTrig\RoundDown::evaluate()
* Use the evaluate() method in the MathTrig\RoundDown class instead
* @See MathTrig\Round::down()
* Use the down() method in the MathTrig\Round class instead
*
* @param float $number Number to round
* @param int $digits Number of digits to which you want to round $number
@ -658,7 +661,7 @@ class MathTrig
*/
public static function ROUNDDOWN($number, $digits)
{
return MathTrig\RoundDown::evaluate($number, $digits);
return MathTrig\Round::down($number, $digits);
}
/**
@ -723,8 +726,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\SqrtPi::evaluate()
* Use the evaluate method in the MathTrig\SqrtPi class instead
* @See MathTrig\Sqrt::sqrt()
* Use the pi method in the MathTrig\Sqrt class instead
*
* @param float $number Number
*
@ -732,7 +735,7 @@ class MathTrig
*/
public static function SQRTPI($number)
{
return MathTrig\SqrtPi::evaluate($number);
return MathTrig\Sqrt::pi($number);
}
/**
@ -768,8 +771,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Sum::funcSumNoStrings()
* Use the funcSumNoStrings method in the MathTrig\Sum class instead
* @See MathTrig\Sum::sumErroringStrings()
* Use the sumErroringStrings method in the MathTrig\Sum class instead
*
* Excel Function:
* SUM(value1[,value2[, ...]])
@ -780,7 +783,7 @@ class MathTrig
*/
public static function SUM(...$args)
{
return MathTrig\Sum::funcSum(...$args);
return MathTrig\Sum::sumIgnoringStrings(...$args);
}
/**
@ -822,7 +825,7 @@ class MathTrig
*
* @param mixed $args Data values
*
* @return float|string
* @return null|float|string
*/
public static function SUMIFS(...$args)
{
@ -837,8 +840,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\SumProduct::evaluate()
* Use the evaluate method in the MathTrig\SumProduct class instead
* @See MathTrig\Sum::product()
* Use the product method in the MathTrig\Sum class instead
*
* @param mixed ...$args Data values
*
@ -846,7 +849,7 @@ class MathTrig
*/
public static function SUMPRODUCT(...$args)
{
return MathTrig\SumProduct::evaluate(...$args);
return MathTrig\Sum::product(...$args);
}
/**
@ -952,8 +955,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Sec::evaluate()
* Use the evaluate method in the MathTrig\Sec class instead
* @See MathTrig\Trig\Secant::sec()
* Use the sec method in the MathTrig\Trig\Secant class instead
*
* @param float $angle Number
*
@ -961,7 +964,7 @@ class MathTrig
*/
public static function SEC($angle)
{
return MathTrig\Sec::evaluate($angle);
return MathTrig\Trig\Secant::sec($angle);
}
/**
@ -971,8 +974,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\SecH::evaluate()
* Use the evaluate method in the MathTrig\Sech class instead
* @See MathTrig\Trig\Secant::sech()
* Use the sech method in the MathTrig\Trig\Secant class instead
*
* @param float $angle Number
*
@ -980,7 +983,7 @@ class MathTrig
*/
public static function SECH($angle)
{
return MathTrig\Sech::evaluate($angle);
return MathTrig\Trig\Secant::sech($angle);
}
/**
@ -990,8 +993,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Csc::evaluate()
* Use the evaluate method in the MathTrig\Csc class instead
* @See MathTrig\Trig\Cosecant::csc()
* Use the csc method in the MathTrig\Trig\Cosecant class instead
*
* @param float $angle Number
*
@ -999,7 +1002,7 @@ class MathTrig
*/
public static function CSC($angle)
{
return MathTrig\Csc::evaluate($angle);
return MathTrig\Trig\Cosecant::csc($angle);
}
/**
@ -1009,8 +1012,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Csch::evaluate()
* Use the evaluate method in the MathTrig\Csch class instead
* @See MathTrig\Trig\Cosecant::csch()
* Use the csch method in the MathTrig\Trig\Cosecant class instead
*
* @param float $angle Number
*
@ -1018,7 +1021,7 @@ class MathTrig
*/
public static function CSCH($angle)
{
return MathTrig\Csch::evaluate($angle);
return MathTrig\Trig\Cosecant::csch($angle);
}
/**
@ -1028,8 +1031,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Cot::evaluate()
* Use the evaluate method in the MathTrig\Cot class instead
* @See MathTrig\Trig\Cotangent::cot()
* Use the cot method in the MathTrig\Trig\Cotangent class instead
*
* @param float $angle Number
*
@ -1037,7 +1040,7 @@ class MathTrig
*/
public static function COT($angle)
{
return MathTrig\Cot::evaluate($angle);
return MathTrig\Trig\Cotangent::cot($angle);
}
/**
@ -1047,8 +1050,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Coth::evaluate()
* Use the evaluate method in the MathTrig\Coth class instead
* @See MathTrig\Trig\Cotangent::coth()
* Use the coth method in the MathTrig\Trig\Cotangent class instead
*
* @param float $angle Number
*
@ -1056,7 +1059,7 @@ class MathTrig
*/
public static function COTH($angle)
{
return MathTrig\Coth::evaluate($angle);
return MathTrig\Trig\Cotangent::coth($angle);
}
/**
@ -1066,8 +1069,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Acot::evaluate()
* Use the evaluate method in the MathTrig\Acot class instead
* @See MathTrig\Trig\Cotangent::acot()
* Use the acot method in the MathTrig\Trig\Cotangent class instead
*
* @param float $number Number
*
@ -1075,7 +1078,7 @@ class MathTrig
*/
public static function ACOT($number)
{
return MathTrig\Acot::evaluate($number);
return MathTrig\Trig\Cotangent::acot($number);
}
/**
@ -1102,8 +1105,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Acoth::evaluate()
* Use the evaluate method in the MathTrig\Acoth class instead
* @See MathTrig\Trig\Cotangent::acoth()
* Use the acoth method in the MathTrig\Trig\Cotangent class instead
*
* @param float $number Number
*
@ -1111,7 +1114,7 @@ class MathTrig
*/
public static function ACOTH($number)
{
return MathTrig\Acoth::evaluate($number);
return MathTrig\Trig\Cotangent::acoth($number);
}
/**
@ -1121,8 +1124,8 @@ class MathTrig
*
* @Deprecated 1.17.0
*
* @See MathTrig\Round::evaluate()
* Use the evaluate() method in the MathTrig\Round class instead
* @See MathTrig\Round::round()
* Use the round() method in the MathTrig\Round class instead
*
* @param mixed $number Should be numeric
* @param mixed $precision Should be int
@ -1131,7 +1134,7 @@ class MathTrig
*/
public static function builtinROUND($number, $precision)
{
return MathTrig\Round::evaluate($number, $precision);
return MathTrig\Round::round($number, $precision);
}
/**
@ -1158,8 +1161,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Acos::evaluate()
* Use the evaluate method in the MathTrig\Acos class instead
* @See MathTrig\Trig\Cosine::acos()
* Use the acos method in the MathTrig\Trig\Cosine class instead
*
* Returns the result of builtin function acos after validating args.
*
@ -1169,7 +1172,7 @@ class MathTrig
*/
public static function builtinACOS($number)
{
return MathTrig\Acos::evaluate($number);
return MathTrig\Trig\Cosine::acos($number);
}
/**
@ -1179,8 +1182,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Acosh::evaluate()
* Use the evaluate method in the MathTrig\Acosh class instead
* @See MathTrig\Trig\Cosine::acosh()
* Use the acosh method in the MathTrig\Trig\Cosine class instead
*
* @param mixed $number Should be numeric
*
@ -1188,7 +1191,7 @@ class MathTrig
*/
public static function builtinACOSH($number)
{
return MathTrig\Acosh::evaluate($number);
return MathTrig\Trig\Cosine::acosh($number);
}
/**
@ -1198,8 +1201,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Asin::evaluate()
* Use the evaluate method in the MathTrig\Asin class instead
* @See MathTrig\Trig\Sine::asin()
* Use the asin method in the MathTrig\Trig\Sine class instead
*
* @param mixed $number Should be numeric
*
@ -1207,7 +1210,7 @@ class MathTrig
*/
public static function builtinASIN($number)
{
return MathTrig\Asin::evaluate($number);
return MathTrig\Trig\Sine::asin($number);
}
/**
@ -1217,8 +1220,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Asinh::evaluate()
* Use the evaluate method in the MathTrig\Asinh class instead
* @See MathTrig\Trig\Sine::asinh()
* Use the asinh method in the MathTrig\Trig\Sine class instead
*
* @param mixed $number Should be numeric
*
@ -1226,7 +1229,7 @@ class MathTrig
*/
public static function builtinASINH($number)
{
return MathTrig\Asinh::evaluate($number);
return MathTrig\Trig\Sine::asinh($number);
}
/**
@ -1236,8 +1239,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Atan::evaluate()
* Use the evaluate method in the MathTrig\Atan class instead
* @See MathTrig\Trig\Tangent::atan()
* Use the atan method in the MathTrig\Trig\Tangent class instead
*
* @param mixed $number Should be numeric
*
@ -1245,7 +1248,7 @@ class MathTrig
*/
public static function builtinATAN($number)
{
return MathTrig\Atan::evaluate($number);
return MathTrig\Trig\Tangent::atan($number);
}
/**
@ -1255,8 +1258,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Atanh::evaluate()
* Use the evaluate method in the MathTrig\Atanh class instead
* @See MathTrig\Trig\Tangent::atanh()
* Use the atanh method in the MathTrig\Trig\Tangent class instead
*
* @param mixed $number Should be numeric
*
@ -1264,7 +1267,7 @@ class MathTrig
*/
public static function builtinATANH($number)
{
return MathTrig\Atanh::evaluate($number);
return MathTrig\Trig\Tangent::atanh($number);
}
/**
@ -1274,8 +1277,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Cos::evaluate()
* Use the evaluate method in the MathTrig\Cos class instead
* @See MathTrig\Trig\Cosine::cos()
* Use the cos method in the MathTrig\Trig\Cosine class instead
*
* @param mixed $number Should be numeric
*
@ -1283,7 +1286,7 @@ class MathTrig
*/
public static function builtinCOS($number)
{
return MathTrig\Cos::evaluate($number);
return MathTrig\Trig\Cosine::cos($number);
}
/**
@ -1293,8 +1296,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Cosh::evaluate()
* Use the evaluate method in the MathTrig\Cosh class instead
* @See MathTrig\Trig\Cosine::cosh()
* Use the cosh method in the MathTrig\Trig\Cosine class instead
*
* @param mixed $number Should be numeric
*
@ -1302,7 +1305,7 @@ class MathTrig
*/
public static function builtinCOSH($number)
{
return MathTrig\Cosh::evaluate($number);
return MathTrig\Trig\Cosine::cosh($number);
}
/**
@ -1312,8 +1315,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Degrees::evaluate()
* Use the evaluate method in the MathTrig\Degrees class instead
* @See MathTrig\Angle::toDegrees()
* Use the toDegrees method in the MathTrig\Angle class instead
*
* @param mixed $number Should be numeric
*
@ -1321,7 +1324,7 @@ class MathTrig
*/
public static function builtinDEGREES($number)
{
return MathTrig\Degrees::evaluate($number);
return MathTrig\Angle::toDegrees($number);
}
/**
@ -1388,8 +1391,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Radians::evaluate()
* Use the evaluate method in the MathTrig\Radians class instead
* @See MathTrig\Angle::toRadians()
* Use the toRadians method in the MathTrig\Angle class instead
*
* @param mixed $number Should be numeric
*
@ -1397,7 +1400,7 @@ class MathTrig
*/
public static function builtinRADIANS($number)
{
return MathTrig\Radians::evaluate($number);
return MathTrig\Angle::toRadians($number);
}
/**
@ -1407,16 +1410,16 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Sin::evaluate()
* Use the evaluate method in the MathTrig\Sin class instead
* @See MathTrig\Trig\Sine::evaluate()
* Use the sin method in the MathTrig\Trig\Sine class instead
*
* @param mixed $number Should be numeric
*
* @return float|string Rounded number
* @return float|string sine
*/
public static function builtinSIN($number)
{
return MathTrig\Sin::evaluate($number);
return MathTrig\Trig\Sine::sin($number);
}
/**
@ -1426,8 +1429,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Sinh::evaluate()
* Use the evaluate method in the MathTrig\Sinh class instead
* @See MathTrig\Trig\Sine::sinh()
* Use the sinh method in the MathTrig\Trig\Sine class instead
*
* @param mixed $number Should be numeric
*
@ -1435,7 +1438,7 @@ class MathTrig
*/
public static function builtinSINH($number)
{
return MathTrig\Sinh::evaluate($number);
return MathTrig\Trig\Sine::sinh($number);
}
/**
@ -1445,8 +1448,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Sqrt::evaluate()
* Use the evaluate method in the MathTrig\Sqrt class instead
* @See MathTrig\Sqrt::sqrt()
* Use the sqrt method in the MathTrig\Sqrt class instead
*
* @param mixed $number Should be numeric
*
@ -1454,7 +1457,7 @@ class MathTrig
*/
public static function builtinSQRT($number)
{
return MathTrig\Sqrt::evaluate($number);
return MathTrig\Sqrt::sqrt($number);
}
/**
@ -1464,8 +1467,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Tan::evaluate()
* Use the evaluate method in the MathTrig\Tan class instead
* @See MathTrig\Trig\Tangent::tan()
* Use the tan method in the MathTrig\Trig\Tangent class instead
*
* @param mixed $number Should be numeric
*
@ -1473,7 +1476,7 @@ class MathTrig
*/
public static function builtinTAN($number)
{
return MathTrig\Tan::evaluate($number);
return MathTrig\Trig\Tangent::tan($number);
}
/**
@ -1483,8 +1486,8 @@ class MathTrig
*
* @Deprecated 1.18.0
*
* @See MathTrig\Tan::evaluate()
* Use the evaluate method in the MathTrig\Tanh class instead
* @See MathTrig\Trig\Tangent::tanh()
* Use the tanh method in the MathTrig\Trig\Tangent class instead
*
* @param mixed $number Should be numeric
*
@ -1492,7 +1495,7 @@ class MathTrig
*/
public static function builtinTANH($number)
{
return MathTrig\Tanh::evaluate($number);
return MathTrig\Trig\Tangent::tanh($number);
}
/**

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
class Absolute
{

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Acos
{
/**
* ACOS.
*
* Returns the arccosine of a number.
*
* @param float $number Number
*
* @return float|string The arccosine of the number
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::numberOrNan(acos($number));
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Acosh
{
/**
* ACOSH.
*
* Returns the arc hyperbolic cosine of a number.
*
* @param float $number Number
*
* @return float|string The arccosine of the number, or an error string
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::numberOrNan(acosh($number));
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Acot
{
/**
* ACOT.
*
* Returns the arccotangent of a number.
*
* @param float $number Number
*
* @return float|string The arccotangent of the number
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return (M_PI / 2) - atan($number);
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Acoth
{
/**
* ACOTH.
*
* Returns the hyperbolic arccotangent of a number.
*
* @param float $number Number
*
* @return float|string The hyperbolic arccotangent of the number
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
$result = ($number === 1) ? NAN : (log(($number + 1) / ($number - 1)) / 2);
return Helpers::numberOrNan($result);
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
class Angle
{
/**
* DEGREES.
*
* Returns the result of builtin function rad2deg after validating args.
*
* @param mixed $number Should be numeric
*
* @return float|string Rounded number
*/
public static function toDegrees($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return rad2deg($number);
}
/**
* RADIANS.
*
* Returns the result of builtin function deg2rad after validating args.
*
* @param mixed $number Should be numeric
*
* @return float|string Rounded number
*/
public static function toRadians($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return deg2rad($number);
}
}

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Arabic
@ -47,11 +47,19 @@ class Arabic
return $sum;
}
/**
* @param mixed $value
*/
private static function mollifyScrutinizer($value): array
{
return is_array($value) ? $value : [];
}
private static function strSplit(string $roman): array
{
$rslt = str_split($roman);
return is_array($rslt) ? $rslt : [];
return self::mollifyScrutinizer($rslt);
}
/**

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Asin
{
/**
* ASIN.
*
* Returns the arcsine of a number.
*
* @param float $number Number
*
* @return float|string The arcsine of the number
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::numberOrNan(asin($number));
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Asinh
{
/**
* ASINH.
*
* Returns the arc hyperbolic sine of a number.
*
* @param float $number Number
*
* @return float|string The arc hyperbolic sine of the number
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::numberOrNan(asinh($number));
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Atan
{
/**
* ATAN.
*
* Returns the arctangent of a number.
*
* @param float $number Number
*
* @return float|string The arctangent of the number
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::numberOrNan(atan($number));
}
}

View File

@ -1,46 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Atan2
{
/**
* ATAN2.
*
* This function calculates the arc tangent of the two variables x and y. It is similar to
* calculating the arc tangent of y ÷ x, except that the signs of both arguments are used
* to determine the quadrant of the result.
* The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a
* point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between
* -pi and pi, excluding -pi.
*
* Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard
* PHP atan2() function, so we need to reverse them here before calling the PHP atan() function.
*
* Excel Function:
* ATAN2(xCoordinate,yCoordinate)
*
* @param mixed $xCoordinate should be float, the x-coordinate of the point
* @param mixed $yCoordinate should be float, the y-coordinate of the point
*
* @return float|string the inverse tangent of the specified x- and y-coordinates, or a string containing an error
*/
public static function evaluate($xCoordinate, $yCoordinate)
{
try {
$xCoordinate = Helpers::validateNumericNullBool($xCoordinate);
$yCoordinate = Helpers::validateNumericNullBool($yCoordinate);
} catch (Exception $e) {
return $e->getMessage();
}
if (($xCoordinate == 0) && ($yCoordinate == 0)) {
return Functions::DIV0();
}
return atan2($yCoordinate, $xCoordinate);
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Atanh
{
/**
* ATANH.
*
* Returns the arc hyperbolic tangent of a number.
*
* @param float $number Number
*
* @return float|string The arc hyperbolic tangent of the number
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::numberOrNan(atanh($number));
}
}

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Base

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Ceiling
@ -23,7 +23,7 @@ class Ceiling
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function evaluate($number, $significance = null)
public static function ceiling($number, $significance = null)
{
if ($significance === null) {
self::floorCheck1Arg();
@ -39,6 +39,78 @@ class Ceiling
return self::argumentsOk((float) $number, (float) $significance);
}
/**
* CEILING.MATH.
*
* Round a number down to the nearest integer or to the nearest multiple of significance.
*
* Excel Function:
* CEILING.MATH(number[,significance[,mode]])
*
* @param mixed $number Number to round
* @param mixed $significance Significance
* @param int $mode direction to round negative numbers
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function math($number, $significance = null, $mode = 0)
{
try {
$number = Helpers::validateNumericNullBool($number);
$significance = Helpers::validateNumericNullSubstitution($significance, ($number < 0) ? -1 : 1);
$mode = Helpers::validateNumericNullSubstitution($mode, null);
} catch (Exception $e) {
return $e->getMessage();
}
if (empty($significance * $number)) {
return 0.0;
}
if (self::ceilingMathTest((float) $significance, (float) $number, (int) $mode)) {
return floor($number / $significance) * $significance;
}
return ceil($number / $significance) * $significance;
}
/**
* CEILING.PRECISE.
*
* Rounds number up, away from zero, to the nearest multiple of significance.
*
* Excel Function:
* CEILING.PRECISE(number[,significance])
*
* @param mixed $number the number you want to round
* @param float $significance the multiple to which you want to round
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function precise($number, $significance = 1)
{
try {
$number = Helpers::validateNumericNullBool($number);
$significance = Helpers::validateNumericNullSubstitution($significance, null);
} catch (Exception $e) {
return $e->getMessage();
}
if (!$significance) {
return 0.0;
}
$result = $number / abs($significance);
return ceil($result) * $significance * (($significance < 0) ? -1 : 1);
}
/**
* Let CEILINGMATH complexity pass Scrutinizer.
*/
private static function ceilingMathTest(float $significance, float $number, int $mode): bool
{
return ((float) $significance < 0) || ((float) $number < 0 && !empty($mode));
}
/**
* Avoid Scrutinizer problems concerning complexity.
*

View File

@ -1,50 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class CeilingMath
{
/**
* CEILING.MATH.
*
* Round a number down to the nearest integer or to the nearest multiple of significance.
*
* Excel Function:
* CEILING.MATH(number[,significance[,mode]])
*
* @param mixed $number Number to round
* @param mixed $significance Significance
* @param int $mode direction to round negative numbers
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function evaluate($number, $significance = null, $mode = 0)
{
try {
$number = Helpers::validateNumericNullBool($number);
$significance = Helpers::validateNumericNullSubstitution($significance, ($number < 0) ? -1 : 1);
$mode = Helpers::validateNumericNullSubstitution($mode, null);
} catch (Exception $e) {
return $e->getMessage();
}
if (empty($significance * $number)) {
return 0.0;
}
if (self::ceilingMathTest((float) $significance, (float) $number, (int) $mode)) {
return floor($number / $significance) * $significance;
}
return ceil($number / $significance) * $significance;
}
/**
* Let CEILINGMATH complexity pass Scrutinizer.
*/
private static function ceilingMathTest(float $significance, float $number, int $mode): bool
{
return ((float) $significance < 0) || ((float) $number < 0 && !empty($mode));
}
}

View File

@ -1,38 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class CeilingPrecise
{
/**
* CEILING.PRECISE.
*
* Rounds number up, away from zero, to the nearest multiple of significance.
*
* Excel Function:
* CEILING.PRECISE(number[,significance])
*
* @param mixed $number the number you want to round
* @param float $significance the multiple to which you want to round
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function evaluate($number, $significance = 1)
{
try {
$number = Helpers::validateNumericNullBool($number);
$significance = Helpers::validateNumericNullSubstitution($significance, null);
} catch (Exception $e) {
return $e->getMessage();
}
if (!$significance) {
return 0.0;
}
$result = $number / abs($significance);
return ceil($result) * $significance * (($significance < 0) ? -1 : 1);
}
}

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
class Combinations
{
@ -31,7 +31,7 @@ class Combinations
return $e->getMessage();
}
return round(Fact::evaluate($numObjs) / Fact::evaluate($numObjs - $numInSet)) / Fact::evaluate($numInSet);
return round(Factorial::fact($numObjs) / Factorial::fact($numObjs - $numInSet)) / Factorial::fact($numInSet);
}
/**
@ -69,6 +69,6 @@ class Combinations
return $e->getMessage();
}
return round(Fact::evaluate($numObjs + $numInSet - 1) / Fact::evaluate($numObjs - 1)) / Fact::evaluate($numInSet);
return round(Factorial::fact($numObjs + $numInSet - 1) / Factorial::fact($numObjs - 1)) / Factorial::fact($numInSet);
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Cos
{
/**
* COS.
*
* Returns the result of builtin function cos after validating args.
*
* @param mixed $number Should be numeric
*
* @return float|string cosine
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return cos($number);
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Cosh
{
/**
* COSH.
*
* Returns the result of builtin function cosh after validating args.
*
* @param mixed $number Should be numeric
*
* @return float|string cosine
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return cosh($number);
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Cot
{
/**
* COT.
*
* Returns the cotangent of an angle.
*
* @param float $angle Number
*
* @return float|string The cotangent of the angle
*/
public static function evaluate($angle)
{
try {
$angle = Helpers::validateNumericNullBool($angle);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::verySmallDenominator(cos($angle), sin($angle));
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Coth
{
/**
* COTH.
*
* Returns the hyperbolic cotangent of an angle.
*
* @param float $angle Number
*
* @return float|string The hyperbolic cotangent of the angle
*/
public static function evaluate($angle)
{
try {
$angle = Helpers::validateNumericNullBool($angle);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::verySmallDenominator(1.0, tanh($angle));
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Csc
{
/**
* CSC.
*
* Returns the cosecant of an angle.
*
* @param float $angle Number
*
* @return float|string The cosecant of the angle
*/
public static function evaluate($angle)
{
try {
$angle = Helpers::validateNumericNullBool($angle);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::verySmallDenominator(1.0, sin($angle));
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Csch
{
/**
* CSCH.
*
* Returns the hyperbolic cosecant of an angle.
*
* @param float $angle Number
*
* @return float|string The hyperbolic cosecant of the angle
*/
public static function evaluate($angle)
{
try {
$angle = Helpers::validateNumericNullBool($angle);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::verySmallDenominator(1.0, sinh($angle));
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Degrees
{
/**
* DEGREES.
*
* Returns the result of builtin function rad2deg after validating args.
*
* @param mixed $number Should be numeric
*
* @return float|string Rounded number
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return rad2deg($number);
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class Even
{
/**
* EVEN.
*
* Returns number rounded up to the nearest even integer.
* You can use this function for processing items that come in twos. For example,
* a packing crate accepts rows of one or two items. The crate is full when
* the number of items, rounded up to the nearest two, matches the crate's
* capacity.
*
* Excel Function:
* EVEN(number)
*
* @param float $number Number to round
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function evaluate($number)
{
try {
$number = Helpers::validateNumericNullBool($number);
} catch (Exception $e) {
return $e->getMessage();
}
return Helpers::getEven($number);
}
}

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
class Exp
{

View File

@ -1,47 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
class Fact
{
/**
* FACT.
*
* Returns the factorial of a number.
* The factorial of a number is equal to 1*2*3*...* number.
*
* Excel Function:
* FACT(factVal)
*
* @param float $factVal Factorial Value
*
* @return float|int|string Factorial, or a string containing an error
*/
public static function evaluate($factVal)
{
try {
$factVal = Helpers::validateNumericNullBool($factVal);
Helpers::validateNotNegative($factVal);
} catch (Exception $e) {
return $e->getMessage();
}
$factLoop = floor($factVal);
if ($factVal > $factLoop) {
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
return Statistical\Distributions\Gamma::gammaValue($factVal + 1);
}
}
$factorial = 1;
while ($factLoop > 1) {
$factorial *= $factLoop--;
}
return $factorial;
}
}

View File

@ -1,39 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
class FactDouble
{
/**
* FACTDOUBLE.
*
* Returns the double factorial of a number.
*
* Excel Function:
* FACTDOUBLE(factVal)
*
* @param float $factVal Factorial Value
*
* @return float|int|string Double Factorial, or a string containing an error
*/
public static function evaluate($factVal)
{
try {
$factVal = Helpers::validateNumericNullSubstitution($factVal, 0);
Helpers::validateNotNegative($factVal);
} catch (Exception $e) {
return $e->getMessage();
}
$factLoop = floor($factVal);
$factorial = 1;
while ($factLoop > 1) {
$factorial *= $factLoop;
$factLoop -= 2;
}
return $factorial;
}
}

View File

@ -0,0 +1,110 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
class Factorial
{
/**
* FACT.
*
* Returns the factorial of a number.
* The factorial of a number is equal to 1*2*3*...* number.
*
* Excel Function:
* FACT(factVal)
*
* @param float $factVal Factorial Value
*
* @return float|int|string Factorial, or a string containing an error
*/
public static function fact($factVal)
{
try {
$factVal = Helpers::validateNumericNullBool($factVal);
Helpers::validateNotNegative($factVal);
} catch (Exception $e) {
return $e->getMessage();
}
$factLoop = floor($factVal);
if ($factVal > $factLoop) {
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
return Statistical\Distributions\Gamma::gammaValue($factVal + 1);
}
}
$factorial = 1;
while ($factLoop > 1) {
$factorial *= $factLoop--;
}
return $factorial;
}
/**
* FACTDOUBLE.
*
* Returns the double factorial of a number.
*
* Excel Function:
* FACTDOUBLE(factVal)
*
* @param float $factVal Factorial Value
*
* @return float|int|string Double Factorial, or a string containing an error
*/
public static function factDouble($factVal)
{
try {
$factVal = Helpers::validateNumericNullSubstitution($factVal, 0);
Helpers::validateNotNegative($factVal);
} catch (Exception $e) {
return $e->getMessage();
}
$factLoop = floor($factVal);
$factorial = 1;
while ($factLoop > 1) {
$factorial *= $factLoop;
$factLoop -= 2;
}
return $factorial;
}
/**
* MULTINOMIAL.
*
* Returns the ratio of the factorial of a sum of values to the product of factorials.
*
* @param mixed[] $args An array of mixed values for the Data Series
*
* @return float|string The result, or a string containing an error
*/
public static function multinomial(...$args)
{
$summer = 0;
$divisor = 1;
try {
// Loop through arguments
foreach (Functions::flattenArray($args) as $argx) {
$arg = Helpers::validateNumericNullSubstitution($argx, null);
Helpers::validateNotNegative($arg);
$arg = (int) $arg;
$summer += $arg;
$divisor *= self::fact($arg);
}
} catch (Exception $e) {
return $e->getMessage();
}
$summer = self::fact($summer);
return $summer / $divisor;
}
}

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Floor
@ -28,7 +28,7 @@ class Floor
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function evaluate($number, $significance = null)
public static function floor($number, $significance = null)
{
if ($significance === null) {
self::floorCheck1Arg();
@ -44,6 +44,103 @@ class Floor
return self::argumentsOk((float) $number, (float) $significance);
}
/**
* FLOOR.MATH.
*
* Round a number down to the nearest integer or to the nearest multiple of significance.
*
* Excel Function:
* FLOOR.MATH(number[,significance[,mode]])
*
* @param mixed $number Number to round
* @param mixed $significance Significance
* @param mixed $mode direction to round negative numbers
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function math($number, $significance = null, $mode = 0)
{
try {
$number = Helpers::validateNumericNullBool($number);
$significance = Helpers::validateNumericNullSubstitution($significance, ($number < 0) ? -1 : 1);
$mode = Helpers::validateNumericNullSubstitution($mode, null);
} catch (Exception $e) {
return $e->getMessage();
}
return self::argsOk((float) $number, (float) $significance, (int) $mode);
}
/**
* FLOOR.PRECISE.
*
* Rounds number down, toward zero, to the nearest multiple of significance.
*
* Excel Function:
* FLOOR.PRECISE(number[,significance])
*
* @param float $number Number to round
* @param float $significance Significance
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function precise($number, $significance = 1)
{
try {
$number = Helpers::validateNumericNullBool($number);
$significance = Helpers::validateNumericNullSubstitution($significance, null);
} catch (Exception $e) {
return $e->getMessage();
}
return self::argumentsOkPrecise((float) $number, (float) $significance);
}
/**
* Avoid Scrutinizer problems concerning complexity.
*
* @return float|string
*/
private static function argumentsOkPrecise(float $number, float $significance)
{
if ($significance == 0.0) {
return Functions::DIV0();
}
if ($number == 0.0) {
return 0.0;
}
return floor($number / abs($significance)) * abs($significance);
}
/**
* Avoid Scrutinizer complexity problems.
*
* @return float|string Rounded Number, or a string containing an error
*/
private static function argsOk(float $number, float $significance, int $mode)
{
if (!$significance) {
return Functions::DIV0();
}
if (!$number) {
return 0.0;
}
if (self::floorMathTest($number, $significance, $mode)) {
return ceil($number / $significance) * $significance;
}
return floor($number / $significance) * $significance;
}
/**
* Let FLOORMATH complexity pass Scrutinizer.
*/
private static function floorMathTest(float $number, float $significance, int $mode): bool
{
return Helpers::returnSign($significance) == -1 || (Helpers::returnSign($number) == -1 && !empty($mode));
}
/**
* Avoid Scrutinizer problems concerning complexity.
*

View File

@ -1,64 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class FloorMath
{
/**
* FLOOR.MATH.
*
* Round a number down to the nearest integer or to the nearest multiple of significance.
*
* Excel Function:
* FLOOR.MATH(number[,significance[,mode]])
*
* @param mixed $number Number to round
* @param mixed $significance Significance
* @param mixed $mode direction to round negative numbers
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function evaluate($number, $significance = null, $mode = 0)
{
try {
$number = Helpers::validateNumericNullBool($number);
$significance = Helpers::validateNumericNullSubstitution($significance, ($number < 0) ? -1 : 1);
$mode = Helpers::validateNumericNullSubstitution($mode, null);
} catch (Exception $e) {
return $e->getMessage();
}
return self::argsOk((float) $number, (float) $significance, (int) $mode);
}
/**
* Avoid Scrutinizer complexity problems.
*
* @return float|string Rounded Number, or a string containing an error
*/
private static function argsOk(float $number, float $significance, int $mode)
{
if (!$significance) {
return Functions::DIV0();
}
if (!$number) {
return 0.0;
}
if (self::floorMathTest($number, $significance, $mode)) {
return ceil($number / $significance) * $significance;
}
return floor($number / $significance) * $significance;
}
/**
* Let FLOORMATH complexity pass Scrutinizer.
*/
private static function floorMathTest(float $number, float $significance, int $mode): bool
{
return Helpers::returnSign($significance) == -1 || (Helpers::returnSign($number) == -1 && !empty($mode));
}
}

View File

@ -1,51 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class FloorPrecise
{
/**
* FLOOR.PRECISE.
*
* Rounds number down, toward zero, to the nearest multiple of significance.
*
* Excel Function:
* FLOOR.PRECISE(number[,significance])
*
* @param float $number Number to round
* @param float $significance Significance
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function evaluate($number, $significance = 1)
{
try {
$number = Helpers::validateNumericNullBool($number);
$significance = Helpers::validateNumericNullSubstitution($significance, null);
} catch (Exception $e) {
return $e->getMessage();
}
return self::argumentsOk((float) $number, (float) $significance);
}
/**
* Avoid Scrutinizer problems concerning complexity.
*
* @return float|string
*/
private static function argumentsOk(float $number, float $significance)
{
if ($significance == 0.0) {
return Functions::DIV0();
}
if ($number == 0.0) {
return 0.0;
}
return floor($number / abs($significance)) * abs($significance);
}
}

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class Gcd

Some files were not shown because too many files have changed in this diff Show More