Passed
Pull Request — master (#24)
by Timon
06:19
created
src/Rethink.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TBolier\RethinkQL;
5 5
 
Please login to merge, or discard this patch.
src/Connection/Options.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TBolier\RethinkQL\Connection;
5 5
 
Please login to merge, or discard this patch.
src/Connection/RegistryInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TBolier\RethinkQL\Connection;
5 5
 
Please login to merge, or discard this patch.
src/Connection/ConnectionCursorInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TBolier\RethinkQL\Connection;
5 5
 
Please login to merge, or discard this patch.
src/Connection/ConnectionException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TBolier\RethinkQL\Connection;
5 5
 
Please login to merge, or discard this patch.
src/Connection/Registry.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TBolier\RethinkQL\Connection;
5 5
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
         // TODO: Create factory for instantiation Connection.
49 49
         $this->connections[$name] = new Connection(
50
-            function () use ($options) {
50
+            function() use ($options) {
51 51
                 return new Socket(
52 52
                     $options
53 53
                 );
Please login to merge, or discard this patch.
src/Connection/Socket/Handshake.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * @license http://www.apache.org/licenses/ Apache License 2.0
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     private function pkbdf2Hmac(string $password, string $salt, int $iterations): string
147 147
     {
148
-        $t = hash_hmac('sha256', $salt . "\x00\x00\x00\x01", $password, true);
148
+        $t = hash_hmac('sha256', $salt."\x00\x00\x00\x01", $password, true);
149 149
         $u = $t;
150 150
         for ($i = 0; $i < $iterations - 1; ++$i) {
151 151
             $t = hash_hmac('sha256', $t, $password, true);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $response === null or die('Illegal handshake state');
165 165
 
166 166
         $this->myR = base64_encode(openssl_random_pseudo_bytes(18));
167
-        $this->clientFirstMessage = 'n=' . $this->username . ',r=' . $this->myR;
167
+        $this->clientFirstMessage = 'n='.$this->username.',r='.$this->myR;
168 168
 
169 169
         $binaryVersion = pack('V', $this->version);
170 170
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                 [
177 177
                     'protocol_version' => $this->protocolVersion,
178 178
                     'authentication_method' => 'SCRAM-SHA-256',
179
-                    'authentication' => 'n,,' . $this->clientFirstMessage,
179
+                    'authentication' => 'n,,'.$this->clientFirstMessage,
180 180
                 ]
181 181
             )
182 182
             . \chr(0);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
         $json = json_decode($response, true);
201 201
         if ($json['success'] === false) {
202
-            throw new Exception('Handshake failed: ' . $json["error"]);
202
+            throw new Exception('Handshake failed: '.$json["error"]);
203 203
         }
204 204
         if ($this->protocolVersion > $json['max_protocol_version']
205 205
             || $this->protocolVersion < $json['min_protocol_version']) {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     {
221 221
         $json = json_decode($response, true);
222 222
         if ($json['success'] === false) {
223
-            throw new Exception('Handshake failed: ' . $json['error']);
223
+            throw new Exception('Handshake failed: '.$json['error']);
224 224
         }
225 225
         $serverFirstMessage = $json['authentication'];
226 226
         $authentication = [];
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
             throw new Exception('Invalid nonce from server.');
234 234
         }
235 235
         $salt = base64_decode($authentication['s']);
236
-        $iterations = (int)$authentication['i'];
236
+        $iterations = (int) $authentication['i'];
237 237
 
238
-        $clientFinalMessageWithoutProof = 'c=biws,r=' . $serverR;
238
+        $clientFinalMessageWithoutProof = 'c=biws,r='.$serverR;
239 239
         $saltedPassword = $this->pkbdf2Hmac($this->password, $salt, $iterations);
240 240
         $clientKey = hash_hmac('sha256', 'Client Key', $saltedPassword, true);
241 241
         $storedKey = hash('sha256', $clientKey, true);
242 242
 
243 243
         $authMessage =
244
-            $this->clientFirstMessage . ',' . $serverFirstMessage . ',' . $clientFinalMessageWithoutProof;
244
+            $this->clientFirstMessage.','.$serverFirstMessage.','.$clientFinalMessageWithoutProof;
245 245
 
246 246
         $clientSignature = hash_hmac('sha256', $authMessage, $storedKey, true);
247 247
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         return
257 257
             json_encode(
258 258
                 [
259
-                    'authentication' => $clientFinalMessageWithoutProof . ',p=' . base64_encode($clientProof),
259
+                    'authentication' => $clientFinalMessageWithoutProof.',p='.base64_encode($clientProof),
260 260
                 ]
261 261
             )
262 262
             . \chr(0);
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
     {
272 272
         $json = json_decode($response, true);
273 273
         if ($json['success'] === false) {
274
-            throw new Exception('Handshake failed: ' . $json['error']);
274
+            throw new Exception('Handshake failed: '.$json['error']);
275 275
         }
276 276
         $authentication = [];
277 277
         foreach (explode(',', $json['authentication']) as $var) {
Please login to merge, or discard this patch.
src/Connection/Socket/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TBolier\RethinkQL\Connection\Socket;
5 5
 
Please login to merge, or discard this patch.
src/Connection/Socket/Socket.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TBolier\RethinkQL\Connection\Socket;
5 5
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public function __construct(OptionsInterface $options)
30 30
     {
31 31
         $this->openStream(
32
-            ($options->isSsl() ? 'ssl' : 'tcp') . '://' . $options->getHostname() . ':' . $options->getPort(),
32
+            ($options->isSsl() ? 'ssl' : 'tcp').'://'.$options->getHostname().':'.$options->getPort(),
33 33
             $options->getTimeout(),
34 34
             $options->getTimeoutStream()
35 35
         );
Please login to merge, or discard this patch.