From 70ec8e340eaa53015e958ba1c91e825ae79cca7d Mon Sep 17 00:00:00 2001 From: "Bruno O. Notario" Date: Sun, 22 Oct 2023 17:29:58 -0300 Subject: [PATCH] Renamed case for Exception folder --- system/Exception/BadFunctionCallException.php | 19 +++++ system/Exception/BadMethodCallException.php | 19 +++++ system/Exception/DomainException.php | 19 +++++ system/Exception/InvalidArgumentException.php | 18 +++++ system/Exception/LengthException.php | 19 +++++ system/Exception/LogicException.php | 18 +++++ system/Exception/OutOfBoundsException.php | 19 +++++ system/Exception/OutOfRangeException.php | 19 +++++ system/Exception/OverflowException.php | 19 +++++ system/Exception/RESTException.php | 18 +++++ system/Exception/RangeException.php | 19 +++++ system/Exception/RuntimeException.php | 18 +++++ system/Exception/Throwable.php | 36 +++++++++ system/Exception/UnderflowException.php | 19 +++++ system/Exception/UnexpectedValueException.php | 19 +++++ system/Exception/WebApiException.php | 53 ++++++++++++ system/arrayClass/Aux/LegacyAux.php | 79 ++++++++++++++++++ system/arrayClass/Aux/ModernAux.php | 80 +++++++++++++++++++ system/arrayClass/CaseInsensitiveArray.php | 38 +++++++++ 19 files changed, 548 insertions(+) create mode 100644 system/Exception/BadFunctionCallException.php create mode 100644 system/Exception/BadMethodCallException.php create mode 100644 system/Exception/DomainException.php create mode 100644 system/Exception/InvalidArgumentException.php create mode 100644 system/Exception/LengthException.php create mode 100644 system/Exception/LogicException.php create mode 100644 system/Exception/OutOfBoundsException.php create mode 100644 system/Exception/OutOfRangeException.php create mode 100644 system/Exception/OverflowException.php create mode 100644 system/Exception/RESTException.php create mode 100644 system/Exception/RangeException.php create mode 100644 system/Exception/RuntimeException.php create mode 100644 system/Exception/Throwable.php create mode 100644 system/Exception/UnderflowException.php create mode 100644 system/Exception/UnexpectedValueException.php create mode 100644 system/Exception/WebApiException.php create mode 100644 system/arrayClass/Aux/LegacyAux.php create mode 100644 system/arrayClass/Aux/ModernAux.php create mode 100644 system/arrayClass/CaseInsensitiveArray.php diff --git a/system/Exception/BadFunctionCallException.php b/system/Exception/BadFunctionCallException.php new file mode 100644 index 0000000..40dc997 --- /dev/null +++ b/system/Exception/BadFunctionCallException.php @@ -0,0 +1,19 @@ +_container[] = $value; + } else { + $this->_container[$offset] = $value; + } + } + + /** + * Whether or not an offset exists + * + * @param string $offset An offset to check for + * @access public + * @return bool + * @abstracting ArrayAccess + */ + public function offsetExists($offset) + { + if (is_string($offset)) $offset = strtolower($offset); + return isset($this->_container[$offset]); + } + + /** + * Unsets an offset + * + * @param string $offset The offset to unset + * @access public + * @abstracting ArrayAccess + * + * @return void + */ + public function offsetUnset($offset) + { + if (is_string($offset)) $offset = strtolower($offset); + unset($this->_container[$offset]); + } + + /** + * Returns the value at specified offset + * + * @param string $offset The offset to retrieve + * @access public + * @return mixed + * @abstracting ArrayAccess + */ + public function offsetGet($offset) + { + if (is_string($offset)) $offset = strtolower($offset); + return isset($this->_container[$offset]) + ? $this->_container[$offset] + : null; + } +} \ No newline at end of file diff --git a/system/arrayClass/Aux/ModernAux.php b/system/arrayClass/Aux/ModernAux.php new file mode 100644 index 0000000..a3b8bdc --- /dev/null +++ b/system/arrayClass/Aux/ModernAux.php @@ -0,0 +1,80 @@ +_container[] = $value; + } else { + $this->_container[$offset] = $value; + } + } + + /** + * Whether or not an offset exists + * + * @param string $offset An offset to check for + * @access public + * @return bool + * @abstracting ArrayAccess + */ + public function offsetExists($offset): bool + { + if (is_string($offset)) $offset = strtolower($offset); + return isset($this->_container[$offset]); + } + + /** + * Unsets an offset + * + * @param string $offset The offset to unset + * @access public + * @abstracting ArrayAccess + * + * @return void + */ + public function offsetUnset($offset): void + { + if (is_string($offset)) $offset = strtolower($offset); + unset($this->_container[$offset]); + } + + /** + * Returns the value at specified offset + * + * @param string $offset The offset to retrieve + * @access public + * @return mixed + * @abstracting ArrayAccess + */ + public function offsetGet($offset): mixed + { + if (is_string($offset)) $offset = strtolower($offset); + return isset($this->_container[$offset]) + ? $this->_container[$offset] + : null; + } +} \ No newline at end of file diff --git a/system/arrayClass/CaseInsensitiveArray.php b/system/arrayClass/CaseInsensitiveArray.php new file mode 100644 index 0000000..366b03d --- /dev/null +++ b/system/arrayClass/CaseInsensitiveArray.php @@ -0,0 +1,38 @@ +_container = array_map("strtolower", $initial_array); + $this->_container = array_change_key_case($initial_array); + } + +} \ No newline at end of file