Test Failed
Push — master ( ce0f94...aa19c6 )
by Dan
07:09
created
Tests/Authenticate/PasswordTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -83,28 +83,28 @@
 block discarded – undo
83 83
     public function truePasswordProvider()
84 84
     {
85 85
         return array(
86
-            ['password',\password_hash('password', PASSWORD_DEFAULT)],
87
-            ['foobar',\password_hash('foobar', PASSWORD_DEFAULT)],
88
-            ['234234234cookie',\password_hash('234234234cookie', PASSWORD_DEFAULT)],
89
-            ['fobatraz56278',\password_hash('fobatraz56278', PASSWORD_DEFAULT)],
90
-            ['foo__fgg__bat__789',\password_hash('foo__fgg__bat__789', PASSWORD_DEFAULT)],
91
-            ['passwdsasdads2123ord',\password_hash('passwdsasdads2123ord', PASSWORD_DEFAULT)]
86
+            ['password', \password_hash('password', PASSWORD_DEFAULT)],
87
+            ['foobar', \password_hash('foobar', PASSWORD_DEFAULT)],
88
+            ['234234234cookie', \password_hash('234234234cookie', PASSWORD_DEFAULT)],
89
+            ['fobatraz56278', \password_hash('fobatraz56278', PASSWORD_DEFAULT)],
90
+            ['foo__fgg__bat__789', \password_hash('foo__fgg__bat__789', PASSWORD_DEFAULT)],
91
+            ['passwdsasdads2123ord', \password_hash('passwdsasdads2123ord', PASSWORD_DEFAULT)]
92 92
         );
93 93
     }
94 94
 
95 95
     public function falsePasswordProvider()
96 96
     {
97 97
         return array(
98
-            ['password','$2y$10$rUHpBM6hi0TyCBIgGnJYAuBPLe66sadkE.RW'],
99
-            ['password','cGFzc3dvcmQ='],
100
-            ['password','5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'],
101
-            ['password','5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8'],
102
-            ['password','74dfc2b27acfa364da55f93a5caee29ccad3557247eda238831b3e9bd931b01d77fe994e4f12b9d4cfa92a124461d2065197d8cf7f33fc88566da2db2a4d6eae'],
103
-            ['password','db4d9992897eda89b50f1d3208db607902da7e79c6f3bc6e6933cc5919068564'],
104
-            ['password','35c246d5'],
105
-            ['password','ycbTFtbcTZUqeJ/UuIWO1w=='],
106
-            ['password','c9c6d316d6dc4d952a789fd4b8858ed7'],
107
-            ['password','c9:c6:d3:16:d6:dc:4d:95:2a:78:9f:d4:b8:85:8e:d7'],
98
+            ['password', '$2y$10$rUHpBM6hi0TyCBIgGnJYAuBPLe66sadkE.RW'],
99
+            ['password', 'cGFzc3dvcmQ='],
100
+            ['password', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'],
101
+            ['password', '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8'],
102
+            ['password', '74dfc2b27acfa364da55f93a5caee29ccad3557247eda238831b3e9bd931b01d77fe994e4f12b9d4cfa92a124461d2065197d8cf7f33fc88566da2db2a4d6eae'],
103
+            ['password', 'db4d9992897eda89b50f1d3208db607902da7e79c6f3bc6e6933cc5919068564'],
104
+            ['password', '35c246d5'],
105
+            ['password', 'ycbTFtbcTZUqeJ/UuIWO1w=='],
106
+            ['password', 'c9c6d316d6dc4d952a789fd4b8858ed7'],
107
+            ['password', 'c9:c6:d3:16:d6:dc:4d:95:2a:78:9f:d4:b8:85:8e:d7'],
108 108
         );
109 109
     }
110 110
 }
Please login to merge, or discard this patch.
Src/Authenticate/HashHmac.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param array $payload
59 59
      * @return string
60 60
      */
61
-    public function create(array $payload = []){
61
+    public function create(array $payload = []) {
62 62
         $hash = $this->generate($this->algorithm, $payload, $this->privateKey);
63 63
         return base64_encode($this->algorithm.'='.$hash);
64 64
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     {
93 93
         $decodedHash = base64_decode($encodedHash);
94 94
 
95
-        list($algo, $hash) = array_pad( explode('=', $decodedHash), 4, $this->algorithm);
95
+        list($algo, $hash) = array_pad(explode('=', $decodedHash), 4, $this->algorithm);
96 96
 
97 97
         $payloadHash = $this->generate($this->algorithm, $payload, $this->privateKey);
98 98
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      *
150 150
      * @return array
151 151
      */
152
-    public function getPayload(){
152
+    public function getPayload() {
153 153
         return $this->payload;
154 154
     }
155 155
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,9 @@  discard block
 block discarded – undo
67 67
      * Internal Function to creates hash from payload.
68 68
      *
69 69
      * @param  array $payload
70
-     * @return mixed
70
+     * @param string $algorithm
71
+     * @param string $privateKey
72
+     * @return string
71 73
      */
72 74
     private function generate($algorithm, array $payload = [], $privateKey)
73 75
     {
@@ -83,7 +85,7 @@  discard block
 block discarded – undo
83 85
     /**
84 86
      * Compare received hash against payload.
85 87
      *
86
-     * @param  $encodedHash
88
+     * @param  string $encodedHash
87 89
      * @param  array       $payload
88 90
      * @return bool
89 91
      * @throws \Exception
Please login to merge, or discard this patch.
Tests/Authenticate/HashHmacTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         $this->privateKey = 'privateKey';
41 41
         $this->reflector = new \ReflectionClass(HashHmac::class);
42 42
         $this->data = ['foo' => 'bar'];
43
-        $this->hmac = new HashHmac($this->privateKey,$this->algo);
43
+        $this->hmac = new HashHmac($this->privateKey, $this->algo);
44 44
     }
45 45
 
46 46
     /**
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $actual = $this->hmac->create($this->data);
52 52
         $token = base64_decode($actual);
53
-        $tokenParts = explode('=',$token);
53
+        $tokenParts = explode('=', $token);
54 54
         $tokenHash = $tokenParts[1];
55
-        $expected = hash_hmac($this->algo, json_encode($this->data) , $this->privateKey);
55
+        $expected = hash_hmac($this->algo, json_encode($this->data), $this->privateKey);
56 56
         $this->assertEquals($tokenHash, $expected);
57 57
     }
58 58
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function testCompareHash()
63 63
     {
64 64
         $encodedHash = $this->hmac->create($this->data);
65
-        $this->assertEquals(true, $this->hmac->verify($encodedHash,$this->data));
65
+        $this->assertEquals(true, $this->hmac->verify($encodedHash, $this->data));
66 66
     }
67 67
 
68 68
     /**
Please login to merge, or discard this patch.