X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fseekat;a=blobdiff_plain;f=lib%2FAPI%2FIterator.php;h=b2187478e3e1eb8835d53fea62d58e525ff9d879;hp=f0179b48087b2718e5a67426ae8aad915119128c;hb=2451d97f1cb7b97e445b4dd839835b8673a4d0fc;hpb=cb67a45f0e94c91583d7563f7a21d89845332c13 diff --git a/lib/API/Iterator.php b/lib/API/Iterator.php index f0179b4..b218747 100644 --- a/lib/API/Iterator.php +++ b/lib/API/Iterator.php @@ -2,13 +2,15 @@ namespace seekat\API; +use http\Url; +use Iterator as BaseIterator; use seekat\API; -class Iterator implements \Iterator +class Iterator implements BaseIterator { /** * The endpoint - * @var \seekat\API + * @var API */ private $api; @@ -33,12 +35,12 @@ class Iterator implements \Iterator /** * Create a new iterator over $data returning \seekat\API instances * - * @var \seekat\API $api The endpoint + * @var API $api The endpoint * @var array|object $data */ function __construct(API $api) { $this->api = $api; - $this->data = (array) $api->export(); + $this->data = (array) $api->export()["data"]; } /** @@ -53,7 +55,7 @@ class Iterator implements \Iterator /** * Get the current data entry * - * @return \seekat\API + * @return API */ function current() { return $this->cur; @@ -63,7 +65,7 @@ class Iterator implements \Iterator if (list($key, $cur) = each($this->data)) { $this->key = $key; if ($this->api->$key->exists("url", $url)) { - $url = new \http\Url($url); + $url = new Url($url); $this->cur = $this->api->withUrl($url)->withData($cur); } else { $this->cur = $this->api->$key->withData($cur);