1 | <?php |
||
4 | class Auth |
||
5 | { |
||
6 | /** @var string */ |
||
7 | protected $secretAcessKey; |
||
8 | |||
9 | /** @var string */ |
||
10 | protected $accessKey; |
||
11 | |||
12 | /** @var int */ |
||
13 | protected $currentTime; |
||
14 | |||
15 | 3 | public function __construct($secretAcessKey, $accessKey) |
|
20 | |||
21 | /** |
||
22 | * @param string $methodName Method name |
||
23 | * @param array $data Method payload |
||
24 | * @return array Send ready request payload |
||
25 | */ |
||
26 | 3 | public function preparePayload($methodName, array $data) |
|
41 | |||
42 | /** |
||
43 | * @param array $data |
||
44 | * @return array |
||
45 | */ |
||
46 | 3 | protected function prepareValues(array $data) |
|
58 | |||
59 | /** |
||
60 | * Based on code from api.wiziq.com |
||
61 | * |
||
62 | * @param string $data |
||
63 | * @param int $blocksize |
||
64 | * @return string |
||
65 | */ |
||
66 | 3 | protected function hmacsha1($data, $blocksize = 64) |
|
79 | |||
80 | /** |
||
81 | * @return int |
||
82 | */ |
||
83 | 3 | protected function getCurrentTime() |
|
91 | |||
92 | /** |
||
93 | * @param int $time |
||
94 | * @internal For tests only |
||
95 | */ |
||
96 | 3 | public function setCurrentTime($time) |
|
100 | } |
||
101 |