正在显示
1 个修改的文件
包含
43 行增加
和
1 行删除
| @@ -4,9 +4,10 @@ namespace Lackoxygen\TiktokShop\Response; | @@ -4,9 +4,10 @@ namespace Lackoxygen\TiktokShop\Response; | ||
| 4 | 4 | ||
| 5 | use Illuminate\Contracts\Support\Arrayable; | 5 | use Illuminate\Contracts\Support\Arrayable; |
| 6 | use Illuminate\Support\Arr; | 6 | use Illuminate\Support\Arr; |
| 7 | +use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware; | ||
| 7 | use Lackoxygen\TiktokShop\Util\Json; | 8 | use Lackoxygen\TiktokShop\Util\Json; |
| 8 | 9 | ||
| 9 | -class ResultSet implements Arrayable, \Countable | 10 | +class ResultSet implements Arrayable, \Countable, \ArrayAccess |
| 10 | { | 11 | { |
| 11 | /** | 12 | /** |
| 12 | * @var array|mixed | 13 | * @var array|mixed |
| @@ -102,4 +103,45 @@ class ResultSet implements Arrayable, \Countable | @@ -102,4 +103,45 @@ class ResultSet implements Arrayable, \Countable | ||
| 102 | 103 | ||
| 103 | return $items; | 104 | return $items; |
| 104 | } | 105 | } |
| 106 | + | ||
| 107 | + /** | ||
| 108 | + * @param $offset | ||
| 109 | + * @return void | ||
| 110 | + */ | ||
| 111 | + public function offsetUnset($offset) | ||
| 112 | + { | ||
| 113 | + unset($this->items[$offset]); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * @param $offset | ||
| 118 | + * @param $value | ||
| 119 | + * @return void | ||
| 120 | + */ | ||
| 121 | + public function offsetSet($offset, $value) | ||
| 122 | + { | ||
| 123 | + if (is_null($offset)) { | ||
| 124 | + $this->items[] = $value; | ||
| 125 | + } else { | ||
| 126 | + $this->items[$offset] = $value; | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + /** | ||
| 131 | + * @param $offset | ||
| 132 | + * @return mixed | ||
| 133 | + */ | ||
| 134 | + public function offsetGet($offset) | ||
| 135 | + { | ||
| 136 | + return $this->items[$offset]; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * @param $offset | ||
| 141 | + * @return bool | ||
| 142 | + */ | ||
| 143 | + public function offsetExists($offset): bool | ||
| 144 | + { | ||
| 145 | + return isset($this->items, $offset); | ||
| 146 | + } | ||
| 105 | } | 147 | } |
-
请 注册 或 登录 后发表评论