Passed
Push — master ( 5bd6a5...cd7482 )
by Nikita
03:52
created
src/GdaemonFiles.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@
 block discarded – undo
136 136
         while($writed < $filesize) {
137 137
             if ($filesize - $writed > $this->maxBufsize) {
138 138
                 $readlen = $this->maxBufsize;
139
-            }
140
-            else {
139
+            } else {
141 140
                 $readlen = $filesize - $writed;
142 141
             }
143 142
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function put($locFile, $remFile, $permission = 0644)
38 38
     {
39 39
         if (is_string($locFile)) {
40
-            set_error_handler(function () {});
40
+            set_error_handler(function() {});
41 41
             $fileHandle = fopen($locFile, 'r');
42 42
             restore_error_handler();
43 43
         } else if (is_resource($locFile)) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             throw new RuntimeException('Couldn\'t upload file: ' . isset($results[1]) ? $results[1] : 'Unknown');
76 76
         }
77 77
 
78
-        while(!feof($fileHandle)) {
78
+        while (!feof($fileHandle)) {
79 79
             $this->writeSocket(fread($fileHandle, $this->maxBufsize));
80 80
         }
81 81
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     public function get($remFile, $locFile)
110 110
     {
111 111
         if (is_string($locFile)) {
112
-            set_error_handler(function () {});
112
+            set_error_handler(function() {});
113 113
             $fileHandle = fopen($locFile, 'w+b');
114 114
             restore_error_handler();
115 115
         } else if (is_resource($locFile)) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         $filesize = $results[2];
146 146
         $writed = 0;
147 147
 
148
-        while($writed < $filesize) {
148
+        while ($writed < $filesize) {
149 149
             if ($filesize - $writed > $this->maxBufsize) {
150 150
                 $readlen = $this->maxBufsize;
151 151
             }
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function listFiles($directory)
178 178
     {
179
-        $writeBinn= new BinnList;
179
+        $writeBinn = new BinnList;
180 180
 
181 181
         $writeBinn->addUint8(self::FSERV_READDIR);
182
-        $writeBinn->addStr($directory);     // Dir path
183
-        $writeBinn->addUint8(0);       // Mode
182
+        $writeBinn->addStr($directory); // Dir path
183
+        $writeBinn->addUint8(0); // Mode
184 184
 
185 185
         $read = $this->writeAndReadSocket($writeBinn->serialize());
186 186
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $filesList = $results[2];
198 198
         $returnList = [];
199 199
 
200
-        foreach($filesList as &$file) {
200
+        foreach ($filesList as &$file) {
201 201
 
202 202
             if (in_array(basename($file[0]), ['.', '..'])) {
203 203
                 continue;
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function directoryContents($directory)
217 217
     {
218
-        $writeBinn= new BinnList;
218
+        $writeBinn = new BinnList;
219 219
 
220 220
         $writeBinn->addUint8(self::FSERV_READDIR);
221
-        $writeBinn->addStr($directory);     // Dir path
222
-        $writeBinn->addUint8(1);       // Mode
221
+        $writeBinn->addStr($directory); // Dir path
222
+        $writeBinn->addUint8(1); // Mode
223 223
 
224 224
         $read = $this->writeAndReadSocket($writeBinn->serialize());
225 225
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         $filesList = $results[2];
237 237
         $returnList = [];
238 238
 
239
-        foreach($filesList as &$file) {
239
+        foreach ($filesList as &$file) {
240 240
             if (in_array(basename($file[0]), ['.', '..'])) {
241 241
                 continue;
242 242
             }
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         $writeBinn->addUint8(self::FSERV_MOVE);
339 339
         $writeBinn->addStr($oldPath);
340 340
         $writeBinn->addStr($newPath);
341
-        $writeBinn->addBool(true);            // Copy
341
+        $writeBinn->addBool(true); // Copy
342 342
 
343 343
         $read = $this->writeAndReadSocket($writeBinn->serialize());
344 344
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
      */
390 390
     public function metadata($path)
391 391
     {
392
-        $writeBinn= new BinnList;
392
+        $writeBinn = new BinnList;
393 393
 
394 394
         $writeBinn->addUint8(self::FSERV_FILEINFO);
395 395
         $writeBinn->addStr($path);
Please login to merge, or discard this patch.
src/Gdaemon.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@
 block discarded – undo
161 161
             throw new RuntimeException('SSL Error');
162 162
         }
163 163
 
164
-         $this->getSocket();
164
+            $this->getSocket();
165 165
     }
166 166
 
167 167
     /**
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     public function setConfig(array $config)
109 109
     {
110 110
         foreach ($this->configurable as $setting) {
111
-            if ( ! isset($config[$setting])) {
111
+            if (!isset($config[$setting])) {
112 112
                 continue;
113 113
             }
114 114
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             $sslContext
145 145
         );
146 146
 
147
-        if ( ! $this->_connection) {
147
+        if (!$this->_connection) {
148 148
             throw new RuntimeException('Could not connect to host: '
149 149
                 . $this->host
150 150
                 . ', port:' . $this->port
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
         stream_set_blocking($this->_connection, true);
155 155
 
156
-        set_error_handler(function () {});
156
+        set_error_handler(function() {});
157 157
         $enableCryptoResult = stream_socket_enable_crypto($this->_connection, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT);
158 158
         restore_error_handler();
159 159
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     protected function getConnection()
171 171
     {
172
-        if (! is_resource($this->_connection)) {
172
+        if (!is_resource($this->_connection)) {
173 173
             $this->disconnect();
174 174
             $this->connect();
175 175
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
             return;
190 190
         }
191 191
 
192
-        $writeBinn= new BinnList;
192
+        $writeBinn = new BinnList;
193 193
 
194 194
         $writeBinn->addInt16(self::DAEMON_SERVER_MODE_AUTH);
195 195
         $writeBinn->addStr($username);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         $read = fread($this->getConnection(), $len);
251 251
 
252 252
         if ($read === false) {
253
-            throw new RuntimeException('Socket read failed: ' );
253
+            throw new RuntimeException('Socket read failed: ');
254 254
         }
255 255
 
256 256
         return $notTrimEndSymbols ? $read : substr($read, 0, -4);
Please login to merge, or discard this patch.