1 | <?php |
||
31 | class HttpClient implements HttpClientInterface |
||
32 | { |
||
33 | /** |
||
34 | * @var Client |
||
35 | */ |
||
36 | private $guzzleClient; |
||
37 | |||
38 | /** |
||
39 | * Panda cloud id |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | private $cloudId; |
||
44 | |||
45 | /** |
||
46 | * Panda Account |
||
47 | * |
||
48 | * @var Account |
||
49 | */ |
||
50 | private $account; |
||
51 | |||
52 | /** |
||
53 | * {@inheritDoc} |
||
54 | */ |
||
55 | 5 | public function setCloudId($cloudId) |
|
59 | |||
60 | /** |
||
61 | * {@inheritDoc} |
||
62 | */ |
||
63 | public function getCloudId() |
||
67 | |||
68 | /** |
||
69 | * {@inheritDoc} |
||
70 | */ |
||
71 | 5 | public function setAccount(Account $account) |
|
75 | |||
76 | /** |
||
77 | * {@inheritDoc} |
||
78 | */ |
||
79 | public function getAccount() |
||
83 | |||
84 | 5 | public function setGuzzleClient(Client $guzzleClient) |
|
88 | |||
89 | public function getGuzzleClient() |
||
93 | |||
94 | /** |
||
95 | * {@inheritDoc} |
||
96 | */ |
||
97 | 2 | public function get($path, array $params = array()) |
|
101 | |||
102 | /** |
||
103 | * {@inheritDoc} |
||
104 | */ |
||
105 | 1 | public function post($path, array $params = array()) |
|
109 | |||
110 | /** |
||
111 | * {@inheritDoc} |
||
112 | */ |
||
113 | 1 | public function put($path, array $params = array()) |
|
117 | |||
118 | /** |
||
119 | * {@inheritDoc} |
||
120 | */ |
||
121 | 1 | public function delete($path, array $params = array()) |
|
125 | |||
126 | /** |
||
127 | * Send signed HTTP requests to the API server. |
||
128 | * |
||
129 | * @param string $method HTTP method (GET, POST, PUT or DELETE) |
||
130 | * @param string $path Request path |
||
131 | * @param array $params Additional request parameters |
||
132 | * |
||
133 | * @return string The API server's response |
||
134 | * |
||
135 | * @throws ApiException if an API error occurs |
||
136 | * @throws HttpException if the request fails |
||
137 | */ |
||
138 | 5 | private function request($method, $path, array $params) |
|
190 | } |
||
191 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.