ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Formula.php
Go to the documentation of this file.
1<?php
2
4
8
9class Formula
10{
19 public static function text($cellReference = '', ?Cell $pCell = null)
20 {
21 if ($pCell === null) {
22 return Functions::REF();
23 }
24
25 preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellReference, $matches);
26
27 $cellReference = $matches[6] . $matches[7];
28 $worksheetName = trim($matches[3], "'");
29 $worksheet = (!empty($worksheetName))
30 ? $pCell->getWorksheet()->getParent()->getSheetByName($worksheetName)
31 : $pCell->getWorksheet();
32
33 if (
34 $worksheet === null ||
35 !$worksheet->cellExists($cellReference) ||
36 !$worksheet->getCell($cellReference)->isFormula()
37 ) {
38 return Functions::NA();
39 }
40
41 return $worksheet->getCell($cellReference)->getValue();
42 }
43}
An exception for terminatinating execution or to throw for unit testing.
static text($cellReference='', ?Cell $pCell=null)
FORMULATEXT.
Definition: Formula.php:19