Skip to content

Commit 74862ea

Browse files
committed
Some PHPdoc updates.
1 parent 2419aa3 commit 74862ea

4 files changed

Lines changed: 72 additions & 8 deletions

File tree

src/Kobas/Auth/Signer.php

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,34 @@ class Signer
1212
protected $request_timestamp;
1313
protected $secret;
1414
protected $params;
15-
16-
1715
protected $company_id;
18-
19-
/**
20-
* @var string
21-
*/
2216
protected $identifier;
23-
2417
protected $region = 'uk-lon-1';
2518
protected $terminator = 'kbs_request';
2619
protected $auth_type = 'Bearer';
2720
protected $signed_headers = array();
2821
protected $signature;
2922

23+
/**
24+
* Signer constructor.
25+
* @param $company_id
26+
* @param $identifier
27+
* @param $secret
28+
*/
3029
public function __construct($company_id, $identifier, $secret)
3130
{
3231
$this->setCompanyId($company_id);
3332
$this->setIdentifier($identifier);
3433
$this->setSecret($secret);
3534
}
3635

36+
/**
37+
* @param $method
38+
* @param $url
39+
* @param array $signed_headers
40+
* @param array $data
41+
* @return array
42+
*/
3743
public function signRequest($method, $url, array $signed_headers = array(), array $data = array())
3844
{
3945
$time = time();
@@ -58,6 +64,10 @@ public function signRequest($method, $url, array $signed_headers = array(), arra
5864
return $headers;
5965
}
6066

67+
/**
68+
* @param $url
69+
* @return $this
70+
*/
6171
public function setUrl($url)
6272
{
6373
$this->parsed_url = parse_url($url);
@@ -424,6 +434,11 @@ public function setHeaders($headers)
424434
return $this;
425435
}
426436

437+
/**
438+
* @param $array
439+
* @param int $sort_flags
440+
* @return bool
441+
*/
427442
protected function sortArray(&$array, $sort_flags = SORT_REGULAR)
428443
{
429444
if (!is_array($array)) {

src/Kobas/Client.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,44 +86,52 @@ public function disableSSLVerification()
8686
$this->ssl_verify_peer = false;
8787
}
8888

89+
8990
/**
9091
* @param $route
9192
* @param array $params
9293
* @param array $headers
9394
* @return mixed
95+
* @throws HttpException
9496
*/
9597
public function get($route, array $params = array(), array $headers = array())
9698
{
9799
return $this->call('GET', $route, $params, $headers);
98100
}
99101

102+
100103
/**
101104
* @param $route
102105
* @param array $params
103106
* @param array $headers
104107
* @return mixed
108+
* @throws HttpException
105109
*/
106110
public function post($route, array $params = array(), array $headers = array())
107111
{
108112
return $this->call('POST', $route, $params, $headers);
109113
}
110114

115+
111116
/**
112117
* @param $route
113118
* @param array $params
114119
* @param array $headers
115120
* @return mixed
121+
* @throws HttpException
116122
*/
117123
public function put($route, array $params = array(), array $headers = array())
118124
{
119125
return $this->call('PUT', $route, $params, $headers);
120126
}
121127

128+
122129
/**
123130
* @param $route
124131
* @param array $params
125132
* @param array $headers
126133
* @return mixed
134+
* @throws HttpException
127135
*/
128136
public function delete($route, array $params = array(), array $headers = array())
129137
{
@@ -184,7 +192,7 @@ protected function call($http_method, $route, array $params = array(), array $he
184192

185193
$this->request->setOption(CURLOPT_HTTPHEADER, $headers);
186194

187-
$result = $this->request->execute();
195+
$result = $this->request->execute();
188196
$last_response = $this->request->getInfo(CURLINFO_HTTP_CODE);
189197

190198
$this->request->close();

src/Kobas/Exception/HttpException.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@
33
namespace Kobas\Exception;
44

55

6+
/**
7+
* Class HttpException
8+
* @package Kobas\Exception
9+
*/
610
class HttpException extends \Exception
711
{
12+
/**
13+
* @var
14+
*/
815
protected $data;
916

17+
/**
18+
* HttpException constructor.
19+
* @param $http_code
20+
* @param string $message
21+
*/
1022
public function __construct($http_code, $message = '')
1123
{
1224
parent::__construct($message, $http_code);

src/Kobas/Request/Curl.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22

33
namespace Kobas\Request;
44

5+
/**
6+
* Class Curl
7+
* @package Kobas\Request
8+
*/
59
class Curl implements HttpRequest
610
{
11+
/**
12+
* @var null
13+
*/
714
private $handle = null;
815

16+
/**
17+
* @return $this
18+
*/
919
public function init()
1020
{
1121
if (is_null($this->handle)) {
@@ -15,27 +25,46 @@ public function init()
1525
return $this;
1626
}
1727

28+
/**
29+
* @param $url
30+
* @return $this|Curl
31+
*/
1832
public function setUrl($url)
1933
{
2034
return $this->setOption(CURLOPT_URL, $url);
2135
}
2236

37+
/**
38+
* @param $name
39+
* @param $value
40+
* @return $this
41+
*/
2342
public function setOption($name, $value)
2443
{
2544
curl_setopt($this->handle, $name, $value);
2645
return $this;
2746
}
2847

48+
/**
49+
* @return mixed
50+
*/
2951
public function execute()
3052
{
3153
return curl_exec($this->handle);
3254
}
3355

56+
/**
57+
* @param $name
58+
* @return mixed
59+
*/
3460
public function getInfo($name)
3561
{
3662
return curl_getinfo($this->handle, $name);
3763
}
3864

65+
/**
66+
* @return $this
67+
*/
3968
public function close()
4069
{
4170
curl_close($this->handle);

0 commit comments

Comments
 (0)