private static function PHPExcel_Calculation::_checkMatrixOperands in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php \PHPExcel_Calculation::_checkMatrixOperands()
* Ensure that paired matrix operands are both matrices and of the same size * *
Parameters
mixed &$operand1 First matrix operand: * @param mixed &$operand2 Second matrix operand * @param integer $resize Flag indicating whether the matrices should be resized to match * and (if so), whether the smaller dimension should grow or the * larger should shrink. * 0 = no resize * 1 = shrink to fit * 2 = extend to fit
3 calls to PHPExcel_Calculation::_checkMatrixOperands()
- PHPExcel_Calculation::_executeBinaryComparisonOperation in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation.php - PHPExcel_Calculation::_executeNumericBinaryOperation in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation.php - PHPExcel_Calculation::_processTokenStack in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation.php
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation.php, line 2438
Class
- PHPExcel_Calculation
- PHPExcel_Calculation (Multiton)
Code
private static function _checkMatrixOperands(&$operand1, &$operand2, $resize = 1) {
// Examine each of the two operands, and turn them into an array if they aren't one already
// Note that this function should only be called if one or both of the operand is already an array
if (!is_array($operand1)) {
list($matrixRows, $matrixColumns) = self::_getMatrixDimensions($operand2);
$operand1 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand1));
$resize = 0;
}
elseif (!is_array($operand2)) {
list($matrixRows, $matrixColumns) = self::_getMatrixDimensions($operand1);
$operand2 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand2));
$resize = 0;
}
list($matrix1Rows, $matrix1Columns) = self::_getMatrixDimensions($operand1);
list($matrix2Rows, $matrix2Columns) = self::_getMatrixDimensions($operand2);
if ($matrix1Rows == $matrix2Columns && $matrix2Rows == $matrix1Columns) {
$resize = 1;
}
if ($resize == 2) {
// Given two matrices of (potentially) unequal size, convert the smaller in each dimension to match the larger
self::_resizeMatricesExtend($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
}
elseif ($resize == 1) {
// Given two matrices of (potentially) unequal size, convert the larger in each dimension to match the smaller
self::_resizeMatricesShrink($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
}
return array(
$matrix1Rows,
$matrix1Columns,
$matrix2Rows,
$matrix2Columns,
);
}