You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PhpCollections/src/ArrayClasses/InsensitiveCaseArrayClass.php

33 lines
926 B
PHP

<?php
namespace jrosset\ArrayClasses;
/**
* An array with insensitive case cell name
*/
class InsensitiveCaseArrayClass extends ImmutableInsensitiveCaseArrayClass implements IArrayClass {
use TInternalArray {
set as private set__TInternalArray;
del as private del__TInternalArray;
}
/**
* @inheritDoc
*/
public function set ($cellName, $cellValue): self {
return $this->set__TInternalArray(mb_strtolower($cellName), $cellValue);
}
/**
* @inheritDoc
*/
public function del ($cellName, ?bool $throwsForNonExistentElement = null): self {
return $this->del__TInternalArray(mb_strtolower($cellName), $throwsForNonExistentElement);
}
/**
* @inheritDoc
*/
public function toImmutable (): IImmutableArrayClass {
return new ImmutableInsensitiveCaseArrayClass($this->array, $this->throwsForNonExistentElement());
}
}