Add "Not yet Implemented" stubs for 14 new Excel Functions

- TEXTBEFORE – Returns text that’s before delimiting characters
- TEXTAFTER – Returns text that’s after delimiting character
- TEXTSPLIT – Splits text into rows or columns using delimiters
- VSTACK – Stacks arrays vertically
- HSTACK – Stacks arrays horizontally
- TOROW – Returns the array as one row
- TOCOL – Returns the array as one column
- WRAPROWS – Wraps a row array into a 2D array
- WRAPCOLS – Wraps a column array into a 2D array
- TAKE – Returns rows or columns from array start or end
- DROP – Drops rows or columns from array start or end
- CHOOSEROWS – Returns the specified rows from an array
- CHOOSECOLS – Returns the specified columns from an array
- EXPAND – Expands an array to the specified dimensions
This commit is contained in:
MarkBaker
2022-04-30 13:02:53 +02:00
parent 0910220518
commit 90931dbea6
15 changed files with 422 additions and 2 deletions
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlChoosecols extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'CHOOSECOLS';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2+';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlChooserows extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'CHOOSEROWS';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2+';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlDrop extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'DROP';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2-3';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlExpand extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'EXPAND';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2-4';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlHstack extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'HSTACK';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '1+';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlTake extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'TAKE';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2-3';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlTextafter extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'TEXTAFTER';
/**
* @var string
*/
protected $category = Category::CATEGORY_TEXT_AND_DATA;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2-4';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlTextbefore extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'TEXTBEFORE';
/**
* @var string
*/
protected $category = Category::CATEGORY_TEXT_AND_DATA;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2-4';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlTextsplit extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'TEXTSPLIT';
/**
* @var string
*/
protected $category = Category::CATEGORY_TEXT_AND_DATA;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2-5';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlTocol extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'TOCOL';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '1-3';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlTorow extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'TOROW';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '1-3';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlVstack extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'VSTACK';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '1+';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlWrapcols extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'WRAPCOLS';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2-3';
}
@@ -0,0 +1,30 @@
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation\Engine\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\XlFunctionAbstract;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
class XlWraprows extends XlFunctionAbstract
{
/**
* @var string
*/
protected $name = 'WRAPROWS';
/**
* @var string
*/
protected $category = Category::CATEGORY_MATH_AND_TRIG;
/**
* @var callable
*/
protected $functionCall = [Functions::class, 'DUMMY'];
/**
* @var string
*/
protected $argumentCount = '2-3';
}
@@ -32,7 +32,7 @@ class ExcelFunctionsCollectionTest extends TestCase
self::expectExceptionMessage('Action not permitted');
$excelFunctionCollection = new ExcelFunctions();
$excelFunctionDefinition = $excelFunctionCollection['ABS']; // @phpstan-ignore-line
$excelFunctionDefinition = $excelFunctionCollection['ABS'];
self::assertInstanceOf(XlFunctionAbstract::class, $excelFunctionDefinition);
self::assertSame('ABS', $excelFunctionDefinition->name);
@@ -45,7 +45,7 @@ class ExcelFunctionsCollectionTest extends TestCase
self::expectExceptionMessage('Action not permitted');
$excelFunctionCollection = new ExcelFunctions();
$excelFunctionDefinition = $excelFunctionCollection['ABS']; // @phpstan-ignore-line
$excelFunctionDefinition = $excelFunctionCollection['ABS'];
self::assertInstanceOf(XlFunctionAbstract::class, $excelFunctionDefinition);
self::assertSame('ABS', $excelFunctionDefinition->name);