|
|
|
@ -6,24 +6,20 @@ use OutOfRangeException;
|
|
|
|
|
|
|
|
|
|
trait TInternalArray {
|
|
|
|
|
/**
|
|
|
|
|
* Create or replace a cell value
|
|
|
|
|
*
|
|
|
|
|
* @param mixed $cellName The cell name/offset
|
|
|
|
|
* @param mixed $cellValue The cell new value
|
|
|
|
|
*
|
|
|
|
|
* @return $this
|
|
|
|
|
* @inheritDoc
|
|
|
|
|
*/
|
|
|
|
|
public function set ($cellName, $cellValue): self {
|
|
|
|
|
$this->array[$cellName] = $cellValue;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Remove a cell
|
|
|
|
|
*
|
|
|
|
|
* @param mixed $cellName The cell name/offset
|
|
|
|
|
* @param bool|null $throwsForNonExistentElement If set, temporarily override {@see ImmutableArrayClass::$throwsForNonExistentElement}
|
|
|
|
|
*
|
|
|
|
|
* @return $this
|
|
|
|
|
* @inheritDoc
|
|
|
|
|
*/
|
|
|
|
|
public function push ($cellValue): self {
|
|
|
|
|
return $this->set($this->count(), $cellValue);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* @inheritDoc
|
|
|
|
|
*/
|
|
|
|
|
public function del ($cellName, ?bool $throwsForNonExistentElement = null): self {
|
|
|
|
|
if ($throwsForNonExistentElement ?? $this->throwsForNonExistentElement() && !$this->has($cellName)) {
|
|
|
|
|