Matrix
in package
uses
ArrayEnabled
Table of Contents
Properties
Methods
- index() : mixed
- INDEX.
- isColumnVector() : bool
- Helper function; NOT an implementation of any Excel Function.
- isRowVector() : bool
- Helper function; NOT an implementation of any Excel Function.
- transpose() : array<string|int, mixed>
- TRANSPOSE.
- evaluateArrayArguments() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
- evaluateArrayArgumentsIgnore() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
- evaluateArrayArgumentsSubset() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
- evaluateArrayArgumentsSubsetFrom() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
- evaluateSingleArgumentArray() : array<string|int, mixed>
- Handles array argument processing when the function accepts a single argument that can be an array argument.
- extractRowValue() : mixed
- initialiseHelper() : void
- testFalse() : bool
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
index()
INDEX.
public
static index(mixed $matrix[, mixed $rowNum = 0 ][, mixed $columnNum = null ]) : mixed
Uses an index to choose a value from a reference or array
Excel Function: =INDEX(range_array, row_num, [column_num], [area_num])
Parameters
- $matrix : mixed
-
A range of cells or an array constant
- $rowNum : mixed = 0
-
The row in the array or range from which to return a value. If row_num is omitted, column_num is required. Or can be an array of values
- $columnNum : mixed = null
-
The column in the array or range from which to return a value. If column_num is omitted, row_num is required. Or can be an array of values
TODO Provide support for area_num, currently not supported
Return values
mixed —the value of a specified cell or array of cells If an array of values is passed as the $rowNum and/or $columnNum arguments, then the returned result will also be an array with the same dimensions
isColumnVector()
Helper function; NOT an implementation of any Excel Function.
public
static isColumnVector(array<string|int, mixed> $values) : bool
Parameters
- $values : array<string|int, mixed>
Return values
boolisRowVector()
Helper function; NOT an implementation of any Excel Function.
public
static isRowVector(array<string|int, mixed> $values) : bool
Parameters
- $values : array<string|int, mixed>
Return values
booltranspose()
TRANSPOSE.
public
static transpose(array<string|int, mixed>|mixed $matrixData) : array<string|int, mixed>
Parameters
- $matrixData : array<string|int, mixed>|mixed
-
A matrix of values
Return values
array<string|int, mixed>evaluateArrayArguments()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
protected
static evaluateArrayArguments(callable $method, mixed ...$arguments) : array<string|int, mixed>
Example use for: ROUND() or DATE().
Parameters
- $method : callable
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsIgnore()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
protected
static evaluateArrayArgumentsIgnore(callable $method, int $ignore, mixed ...$arguments) : array<string|int, mixed>
Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.
Parameters
- $method : callable
- $ignore : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubset()
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
protected
static evaluateArrayArgumentsSubset(callable $method, int $limit, mixed ...$arguments) : array<string|int, mixed>
Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.
Parameters
- $method : callable
- $limit : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubsetFrom()
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
protected
static evaluateArrayArgumentsSubsetFrom(callable $method, int $start, mixed ...$arguments) : array<string|int, mixed>
Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.
Parameters
- $method : callable
- $start : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateSingleArgumentArray()
Handles array argument processing when the function accepts a single argument that can be an array argument.
protected
static evaluateSingleArgumentArray(callable $method, array<string|int, mixed> $values) : array<string|int, mixed>
Example use for: DAYOFMONTH() or FACT().
Parameters
- $method : callable
- $values : array<string|int, mixed>
Return values
array<string|int, mixed>extractRowValue()
private
static extractRowValue(array<string|int, mixed> $matrix, array<string|int, mixed> $rowKeys, int $rowNum) : mixed
Parameters
- $matrix : array<string|int, mixed>
- $rowKeys : array<string|int, mixed>
- $rowNum : int
initialiseHelper()
private
static initialiseHelper(array<string|int, mixed>|false $arguments) : void
Parameters
- $arguments : array<string|int, mixed>|false
-
Can be changed to array for Php8.1+
testFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed