-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathContentHandler.php
More file actions
53 lines (43 loc) · 993 Bytes
/
ContentHandler.php
File metadata and controls
53 lines (43 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace XIVAPI\Api;
use XIVAPI\Guzzle\Guzzle;
class ContentHandler
{
/** @var string */
private $contentName;
private $page = 1;
private $limiti = 100;
public function setContentName(string $name): ContentHandler
{
$this->contentName = ucfirst($name);
return $this;
}
public function one($id)
{
return Guzzle::get("/{$this->contentName}/{$id}");
}
public function list()
{
return Guzzle::get("/{$this->contentName}", [
"query" => [
"page" => $this->page,
"limit" => $this->limit,
],
]);
}
public function setPage(int $page): ContentHandler
{
$this->page = $page;
return $this;
}
public function setLimit(int $limit): ContentHandler
{
$this->limit = $limit;
return $this;
}
public function next()
{
$this->setPage($this->page + 1);
return $this->list();
}
}