Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F6602178
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
joshuaspence
Jul 18 2019, 10:33 PM
2019-07-18 22:33:06 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
raw.txt
View Options
<?php
final class ConduitIterator implements Iterator {
private $client;
private $method;
private $parameters;
private $current;
private $cursor;
public function __construct(ConduitClient $client, string $method, array $parameters) {
$this->client = $client;
$this->method = $method;
$this->parameters = $parameters;
}
private function execute(): void {
$parameters = $this->parameters;
if ($this->cursor !== null) {
$parameters['after'] = $this->cursor['after'];
}
$response = $this->client->callMethodSynchronous($this->method, $parameters);
$this->current = new ArrayIterator($response['data']);
$this->cursor = $response['cursor'];
}
private function getResults(): ArrayIterator {
if ($this->current === null) {
$this->execute();
}
return $this->current;
}
/* -( Iterator )----------------------------------------------------------- */
public function current() {
return $this->getResults()->current();
}
public function key() {
return $this->getResults()->key();
}
public function next(): void {
$this->getResults()->next();
}
public function rewind(): void {
$this->current = null;
$this->cursor = null;
}
public function valid(): bool {
$valid = $this->getResults()->valid();
if (!$valid) {
if ($this->cursor['after'] === null) {
return false;
}
$this->execute();
return true;
}
return $valid;
}
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
1718087
Default Alt Text
raw.txt (1 KB)
Attached To
Mode
P2120 ConduitIterator.php
Attached
Detach File
Event Timeline
Log In to Comment