1 | <?php |
||
14 | class SimpleClient |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $apiKey; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $siteUrl; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $timeout = 2; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $baseUserAgent = 'Bouncer Http'; |
||
36 | |||
37 | /** |
||
38 | * Constructor. |
||
39 | * |
||
40 | * @param array|string $options |
||
41 | */ |
||
42 | public function __construct($options = array()) |
||
56 | |||
57 | /** |
||
58 | * @return SimpleClient |
||
59 | */ |
||
60 | public function setApiKey($apiKey) |
||
66 | |||
67 | /** |
||
68 | * @return SimpleClient |
||
69 | */ |
||
70 | public function setSiteUrl($siteUrl) |
||
76 | |||
77 | /** |
||
78 | * @return string |
||
79 | */ |
||
80 | public function getUserAgent() |
||
89 | |||
90 | public function request($method, $url, $data = null) |
||
117 | |||
118 | public function get($url) |
||
122 | |||
123 | public function post($url, $data = null) |
||
127 | |||
128 | } |
||
129 |