package and depencies
This commit is contained in:
@@ -110,8 +110,9 @@ abstract class DefinedName
|
||||
$segMatcher = false;
|
||||
foreach (explode("'", $value) as $subVal) {
|
||||
// Only test in alternate array entries (the non-quoted blocks)
|
||||
$segMatcher = $segMatcher === false;
|
||||
if (
|
||||
($segMatcher = !$segMatcher) &&
|
||||
$segMatcher &&
|
||||
(preg_match('/' . self::REGEXP_IDENTIFY_FORMULA . '/miu', $subVal))
|
||||
) {
|
||||
return true;
|
||||
@@ -150,7 +151,7 @@ abstract class DefinedName
|
||||
|
||||
// New title
|
||||
$newTitle = $this->name;
|
||||
ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle);
|
||||
ReferenceHelper::getInstance()->updateNamedFormulae($this->worksheet->getParent(), $oldTitle, $newTitle);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -167,9 +168,9 @@ abstract class DefinedName
|
||||
/**
|
||||
* Set worksheet.
|
||||
*/
|
||||
public function setWorksheet(?Worksheet $value): self
|
||||
public function setWorksheet(?Worksheet $worksheet): self
|
||||
{
|
||||
$this->worksheet = $value;
|
||||
$this->worksheet = $worksheet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -203,10 +204,10 @@ abstract class DefinedName
|
||||
/**
|
||||
* Set localOnly.
|
||||
*/
|
||||
public function setLocalOnly(bool $value): self
|
||||
public function setLocalOnly(bool $localScope): self
|
||||
{
|
||||
$this->localOnly = $value;
|
||||
$this->scope = $value ? $this->worksheet : null;
|
||||
$this->localOnly = $localScope;
|
||||
$this->scope = $localScope ? $this->worksheet : null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -222,10 +223,10 @@ abstract class DefinedName
|
||||
/**
|
||||
* Set scope.
|
||||
*/
|
||||
public function setScope(?Worksheet $value): self
|
||||
public function setScope(?Worksheet $worksheet): self
|
||||
{
|
||||
$this->scope = $value;
|
||||
$this->localOnly = $value !== null;
|
||||
$this->scope = $worksheet;
|
||||
$this->localOnly = $worksheet !== null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -241,9 +242,18 @@ abstract class DefinedName
|
||||
/**
|
||||
* Resolve a named range to a regular cell range or formula.
|
||||
*/
|
||||
public static function resolveName(string $pDefinedName, Worksheet $pSheet): ?self
|
||||
public static function resolveName(string $definedName, Worksheet $worksheet, string $sheetName = ''): ?self
|
||||
{
|
||||
return $pSheet->getParent()->getDefinedName($pDefinedName, $pSheet);
|
||||
if ($sheetName === '') {
|
||||
$worksheet2 = $worksheet;
|
||||
} else {
|
||||
$worksheet2 = $worksheet->getParent()->getSheetByName($sheetName);
|
||||
if ($worksheet2 === null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $worksheet->getParent()->getDefinedName($definedName, $worksheet2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user