| @@ -1,0 +1,104 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * @package VikWP - Libraries | |
| 4 | + * @subpackage adapter.application | |
| 5 | + * @author E4J s.r.l. | |
| 6 | + * @copyright Copyright (C) 2023 E4J s.r.l. All Rights Reserved. | |
| 7 | + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL | |
| 8 | + * @link https://vikwp.com | |
| 9 | + */ | |
| 10 | + | |
| 11 | +// No direct access | |
| 12 | +defined('ABSPATH') or die('No script kiddies please!'); | |
| 13 | + | |
| 14 | +JLoader::import('adapter.application.object'); | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * Create an alias for JObject class. | |
| 18 | + * | |
| 19 | + * @since 10.1.18 | |
| 20 | + * @since 10.1.35 Implements ArrayAccess interface. | |
| 21 | + */ | |
| 22 | +class JRegistry extends JObject implements ArrayAccess | |
| 23 | +{ | |
| 24 | + /** | |
| 25 | + * Proxy used to access the internal properties. | |
| 26 | + * | |
| 27 | + * @return array | |
| 28 | + * | |
| 29 | + * @since 10.1.35 | |
| 30 | + */ | |
| 31 | + public function toArray() | |
| 32 | + { | |
| 33 | + return $this->getProperties(); | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * Checks whether an offset exists in the iterator. | |
| 38 | + * | |
| 39 | + * @param mixed $offset The array offset. | |
| 40 | + * | |
| 41 | + * @return boolean True if the offset exists, false otherwise. | |
| 42 | + * | |
| 43 | + * @see ArrayAccess | |
| 44 | + * | |
| 45 | + * @since 10.1.35 | |
| 46 | + */ | |
| 47 | + #[ReturnTypeWillChange] | |
| 48 | + public function offsetExists($offset) | |
| 49 | + { | |
| 50 | + return (boolean) ($this->get($offset) !== null); | |
| 51 | + } | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * Gets an offset in the iterator. | |
| 55 | + * | |
| 56 | + * @param mixed $offset The array offset. | |
| 57 | + * | |
| 58 | + * @return mixed The array value if it exists, null otherwise. | |
| 59 | + * | |
| 60 | + * @see ArrayAccess | |
| 61 | + * | |
| 62 | + * @since 10.1.35 | |
| 63 | + */ | |
| 64 | + #[ReturnTypeWillChange] | |
| 65 | + public function offsetGet($offset) | |
| 66 | + { | |
| 67 | + return $this->get($offset); | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * Sets an offset in the iterator. | |
| 72 | + * | |
| 73 | + * @param mixed $offset The array offset. | |
| 74 | + * @param mixed $value The array value. | |
| 75 | + * | |
| 76 | + * @return void | |
| 77 | + * | |
| 78 | + * @see ArrayAccess | |
| 79 | + * | |
| 80 | + * @since 10.1.35 | |
| 81 | + */ | |
| 82 | + #[ReturnTypeWillChange] | |
| 83 | + public function offsetSet($offset, $value) | |
| 84 | + { | |
| 85 | + $this->set($offset, $value); | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * Unsets an offset in the iterator. | |
| 90 | + * | |
| 91 | + * @param mixed $offset The array offset. | |
| 92 | + * | |
| 93 | + * @return void | |
| 94 | + * | |
| 95 | + * @see ArrayAccess | |
| 96 | + * | |
| 97 | + * @since 10.1.35 | |
| 98 | + */ | |
| 99 | + #[ReturnTypeWillChange] | |
| 100 | + public function offsetUnset($offset) | |
| 101 | + { | |
| 102 | + $this->set($offset, null); | |
| 103 | + } | |
| 104 | +} | |