@@ -60,7 +60,8 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * Creates hash from payload. |
62 | 62 | * @param array $payload |
63 | - * @return mixed |
|
63 | + * @param string $algorithm |
|
64 | + * @return string |
|
64 | 65 | */ |
65 | 66 | public function create($algorithm, array $payload = [], $privateKey) |
66 | 67 | { |
@@ -83,7 +84,7 @@ discard block |
||
83 | 84 | /** |
84 | 85 | * Compare received hash against payload. |
85 | 86 | * |
86 | - * @param $encodedHash |
|
87 | + * @param string $encodedHash |
|
87 | 88 | * @param array $payload |
88 | 89 | * @return bool |
89 | 90 | * @throws \Exception |
@@ -108,7 +109,7 @@ discard block |
||
108 | 109 | |
109 | 110 | |
110 | 111 | /** |
111 | - * @param $key |
|
112 | + * @param string $key |
|
112 | 113 | * @return $this |
113 | 114 | */ |
114 | 115 | public function setPrivateKey($key) |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | $this->data = ['foo' => 'bar']; |
33 | 33 | $this->privateKey = 'privateKey'; |
34 | 34 | |
35 | - $this->hmac = new HashHmac($this->privateKey,$this->algo); |
|
35 | + $this->hmac = new HashHmac($this->privateKey, $this->algo); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | 39 | public function testHash() |
40 | 40 | { |
41 | 41 | $actual = $this->hmac->create($this->algo, $this->data, $this->privateKey); |
42 | - $expected = hash_hmac($this->algo, json_decode($this->data) , $this->privateKey); |
|
42 | + $expected = hash_hmac($this->algo, json_decode($this->data), $this->privateKey); |
|
43 | 43 | $result = $this->hmac->verify($actual, $expected); |
44 | 44 | $this->assertEquals(true, $result); |
45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function testCompareHash() |
48 | 48 | { |
49 | 49 | $encodedHash = $this->hmac->getEncodedHash($this->data); |
50 | - $this->assertEquals(true, $this->auth->compareHash($encodedHash,$this->data)); |
|
50 | + $this->assertEquals(true, $this->auth->compareHash($encodedHash, $this->data)); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function testCompareHashInvalidAlgo() |