mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
ref
This commit is contained in:
@@ -57,6 +57,14 @@ class VariableGetValueByKeyType extends BaseFunction
|
||||
|
||||
$reference =& $this->getVariables()->$name;
|
||||
|
||||
return $this->getByKey($reference, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Error
|
||||
*/
|
||||
private function getByKey(mixed &$reference, mixed $key): mixed
|
||||
{
|
||||
if (!is_array($reference) && !$reference instanceof stdClass) {
|
||||
throw new Error("Cannot access by key of variable that is non-array and non-object.");
|
||||
}
|
||||
|
||||
@@ -58,6 +58,14 @@ class VariableSetKeyValueType extends BaseFunction
|
||||
|
||||
$reference =& $this->getVariables()->$name;
|
||||
|
||||
$this->setByKey($reference, $key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Error
|
||||
*/
|
||||
private function setByKey(mixed &$reference, mixed $key, mixed $value): void
|
||||
{
|
||||
if (!is_array($reference) && !$reference instanceof stdClass) {
|
||||
throw new Error("Cannot access by key of variable that is non-array and non-object.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user