1 | <?php |
||
19 | abstract class AbstractNode implements NodeInterface |
||
20 | { |
||
21 | const JSON_CONTENT_TYPE = [ |
||
22 | 'Content-Type' => 'application/json', |
||
23 | ]; |
||
24 | |||
25 | /** |
||
26 | * client |
||
27 | * @var \Unikorp\KongAdminApi\Client $client |
||
28 | */ |
||
29 | private $client = null; |
||
30 | |||
31 | /** |
||
32 | * Constructor |
||
33 | * |
||
34 | * @param \Unikorp\KongAdminApi\Client $client |
||
35 | */ |
||
36 | 5 | public function __construct(Client $client) |
|
40 | |||
41 | /** |
||
42 | * get |
||
43 | * |
||
44 | * @param string $endpoint |
||
45 | * |
||
46 | * @return \Psr\Http\Message\ResponseInterface |
||
47 | */ |
||
48 | 12 | protected function get($endpoint) |
|
52 | |||
53 | /** |
||
54 | * post |
||
55 | * |
||
56 | * @param string $endpoint |
||
57 | * @param DocumentInterface $document |
||
58 | * |
||
59 | * @return \Psr\Http\Message\ResponseInterface |
||
60 | */ |
||
61 | 3 | protected function post($endpoint, DocumentInterface $document = null) |
|
67 | |||
68 | /** |
||
69 | * put |
||
70 | * |
||
71 | * @param string $endpoint |
||
72 | * @param DocumentInterface $document |
||
73 | * |
||
74 | * @return \Psr\Http\Message\ResponseInterface |
||
75 | */ |
||
76 | 3 | protected function put($endpoint, DocumentInterface $document = null) |
|
82 | |||
83 | /** |
||
84 | * patch |
||
85 | * |
||
86 | * @param string $endpoint |
||
87 | * @param DocumentInterface $document |
||
88 | * |
||
89 | * @return \Psr\Http\Message\ResponseInterface |
||
90 | */ |
||
91 | 3 | protected function patch($endpoint, DocumentInterface $document = null) |
|
97 | |||
98 | /** |
||
99 | * delete |
||
100 | * |
||
101 | * @param string $endpoint |
||
102 | * @param DocumentInterface $document |
||
103 | * |
||
104 | * @return \Psr\Http\Message\ResponseInterface |
||
105 | */ |
||
106 | 4 | protected function delete($endpoint, DocumentInterface $document = null) |
|
112 | } |
||
113 |