70 $this->value = (string)
$value;
78 $this->
isFormula = self::testIfFormula($this->value);
102 if (substr($value, 0, 1) ===
'=') {
103 $value = substr($value, 1);
106 if (is_numeric($value)) {
111 foreach (explode(
"'", $value) as $subVal) {
114 ($segMatcher = !$segMatcher) &&
115 (preg_match(
'/' . self::REGEXP_IDENTIFY_FORMULA .
'/miu', $subVal))
142 if ($this->worksheet !== null) {
143 $this->worksheet->getParent()->removeNamedRange($this->name, $this->worksheet);
147 if ($this->worksheet !== null) {
148 $this->worksheet->getParent()->addNamedRange($this);
172 $this->worksheet =
$value;
208 $this->localOnly =
$value;
209 $this->scope = $value ? $this->worksheet : null;
228 $this->localOnly = $value !== null;
246 if ($sheetName ===
'') {
249 $pSheet2 = $pSheet->
getParent()->getSheetByName($sheetName);
250 if ($pSheet2 === null) {
255 return $pSheet->
getParent()->getDefinedName($pDefinedName, $pSheet2);
263 $vars = get_object_vars($this);
static createInstance(string $name, ?Worksheet $worksheet=null, ?string $value=null, bool $localOnly=false, ?Worksheet $scope=null)
Create a new defined name, either a range or a formula.
getWorksheet()
Get worksheet.
getLocalOnly()
Get localOnly.
static testIfFormula(string $value)
setValue(string $value)
Set range or formula value.
getValue()
Get range or formula value.
setScope(?Worksheet $value)
Set scope.
setName(string $name)
Set name.
setLocalOnly(bool $value)
Set localOnly.
static resolveName(string $pDefinedName, Worksheet $pSheet, string $sheetName='')
Resolve a named range to a regular cell range or formula.
isFormula()
Identify whether this is a named range or a named formula.
static getInstance()
Get an instance of this class.
const REGEXP_IDENTIFY_FORMULA
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
setWorksheet(?Worksheet $value)
Set worksheet.
__construct(string $name, ?Worksheet $worksheet=null, ?string $value=null, bool $localOnly=false, ?Worksheet $scope=null)
Create a new Defined Name.