Completed
Push — master ( 5ad39d...f36908 )
by Dan
03:26
created
autoload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,6 +6,6 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 define("ROOT", __DIR__);
9
-define("SRC", __DIR__ . '/Src');
9
+define("SRC", __DIR__.'/Src');
10 10
 
11 11
 require_once './vendor/autoload.php';
Please login to merge, or discard this patch.
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.
Tests/Authenticate/HashHmacTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
         $decode = base64_decode($hash);
76 76
         $parts = explode('=', $decode);
77 77
         $wrongHash = \hash_hmac('sha512', 'data', 'key');
78
-        $newHash = $parts[0] . '=' . $wrongHash . '=' . $parts[2] . '=' . $parts[3];
78
+        $newHash = $parts[0].'='.$wrongHash.'='.$parts[2].'='.$parts[3];
79 79
         $encoded = base64_encode($newHash);
80 80
         $data = ['foos' => 'bar'];
81 81
         $this->assertEquals($data, $this->auth->compareHash($encoded, $data));
Please login to merge, or discard this patch.
Src/Authenticate/HashHmac.php 2 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@  discard block
 block discarded – undo
58 58
      * Creates hash from payload.
59 59
      *
60 60
      * @param  array $payload
61
-     * @return mixed
61
+     * @param string $privateKey
62
+     * @return string
62 63
      */
63 64
     public function createHash($algorithm, array $payload = [], $privateKey)
64 65
     {
@@ -81,7 +82,7 @@  discard block
 block discarded – undo
81 82
     /**
82 83
      * Compare received hash against payload.
83 84
      *
84
-     * @param  $encodedHash
85
+     * @param  string $encodedHash
85 86
      * @param  array       $payload
86 87
      * @return bool
87 88
      * @throws \Exception
@@ -107,7 +108,7 @@  discard block
 block discarded – undo
107 108
 
108 109
 
109 110
     /**
110
-     * @param $key
111
+     * @param string $key
111 112
      * @return $this
112 113
      */
113 114
     public function setPrivateKey($key)
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         );
73 73
     }
74 74
 
75
-    public function getEncodedHash(array $payload = []){
75
+    public function getEncodedHash(array $payload = []) {
76 76
         $hash = $this->createHash($this->algorithm, $payload);
77 77
         return base64_encode($this->algorithm.'='.$hash);
78 78
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $decodedHash = base64_decode($encodedHash);
92 92
 
93
-        list($algo, $hash) = array_pad( explode('=', $decodedHash), 4, $this->algorithm);
93
+        list($algo, $hash) = array_pad(explode('=', $decodedHash), 4, $this->algorithm);
94 94
         $payloadHash = $this->createHash($this->algorithm, $payload, $this->privateKey);
95 95
 
96 96
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     }
129 129
 
130 130
 
131
-    public function getPayload(){
131
+    public function getPayload() {
132 132
         return $this->payload;
133 133
     }
134 134
 
Please login to merge, or discard this patch.