作者 lackoxygen

feat:res

... ... @@ -4,9 +4,10 @@ namespace Lackoxygen\TiktokShop\Response;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Arr;
use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware;
use Lackoxygen\TiktokShop\Util\Json;
class ResultSet implements Arrayable, \Countable
class ResultSet implements Arrayable, \Countable, \ArrayAccess
{
/**
* @var array|mixed
... ... @@ -102,4 +103,45 @@ class ResultSet implements Arrayable, \Countable
return $items;
}
/**
* @param $offset
* @return void
*/
public function offsetUnset($offset)
{
unset($this->items[$offset]);
}
/**
* @param $offset
* @param $value
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->items[] = $value;
} else {
$this->items[$offset] = $value;
}
}
/**
* @param $offset
* @return mixed
*/
public function offsetGet($offset)
{
return $this->items[$offset];
}
/**
* @param $offset
* @return bool
*/
public function offsetExists($offset): bool
{
return isset($this->items, $offset);
}
}
... ...