|
1 | 1 | <?php namespace AlwaysBlank\Brief; |
2 | 2 |
|
3 | | -class Brief |
| 3 | +class Brief implements \ArrayAccess |
4 | 4 | { |
5 | 5 | /** |
6 | 6 | * A limited list of terms that cannot be used as argument keys. |
@@ -922,4 +922,66 @@ public function delete($key) { |
922 | 922 | } |
923 | 923 | unset($this->store[$internalKey]); |
924 | 924 | } |
| 925 | + |
| 926 | + /** |
| 927 | + * Whether a offset exists |
| 928 | + * @link https://php.net/manual/en/arrayaccess.offsetexists.php |
| 929 | + * |
| 930 | + * @param mixed $offset <p> |
| 931 | + * An offset to check for. |
| 932 | + * </p> |
| 933 | + * |
| 934 | + * @return bool true on success or false on failure. |
| 935 | + * </p> |
| 936 | + * <p> |
| 937 | + * The return value will be casted to boolean if non-boolean was returned. |
| 938 | + */ |
| 939 | + public function offsetExists( $offset ) { |
| 940 | + return $this->get($offset) !== null; |
| 941 | + } |
| 942 | + |
| 943 | + /** |
| 944 | + * Offset to retrieve |
| 945 | + * @link https://php.net/manual/en/arrayaccess.offsetget.php |
| 946 | + * |
| 947 | + * @param mixed $offset <p> |
| 948 | + * The offset to retrieve. |
| 949 | + * </p> |
| 950 | + * |
| 951 | + * @return TValue Can return all value types. |
| 952 | + */ |
| 953 | + public function offsetGet( $offset ) { |
| 954 | + return $this->get($offset); |
| 955 | + } |
| 956 | + |
| 957 | + /** |
| 958 | + * Offset to set |
| 959 | + * @link https://php.net/manual/en/arrayaccess.offsetset.php |
| 960 | + * |
| 961 | + * @param TKey $offset <p> |
| 962 | + * The offset to assign the value to. |
| 963 | + * </p> |
| 964 | + * @param TValue $value <p> |
| 965 | + * The value to set. |
| 966 | + * </p> |
| 967 | + * |
| 968 | + * @return void |
| 969 | + */ |
| 970 | + public function offsetSet( $offset, $value ) { |
| 971 | + $this->set($offset, $value); |
| 972 | + } |
| 973 | + |
| 974 | + /** |
| 975 | + * Offset to unset |
| 976 | + * @link https://php.net/manual/en/arrayaccess.offsetunset.php |
| 977 | + * |
| 978 | + * @param TKey $offset <p> |
| 979 | + * The offset to unset. |
| 980 | + * </p> |
| 981 | + * |
| 982 | + * @return void |
| 983 | + */ |
| 984 | + public function offsetUnset($offset){ |
| 985 | + $this->delete($oddffset); |
| 986 | + } |
925 | 987 | } |
0 commit comments