Passed
Push — master ( 7f2ac9...01b5e4 )
by Sebastian
04:22
created
src/RequestHelper/Boundaries.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
     */
84 84
     public function addFile(string $varName, string $fileName, string $content, string $contentType = '', string $encoding = '') : RequestHelper_Boundaries
85 85
     {
86
-        if(empty($contentType))
86
+        if (empty($contentType))
87 87
         {
88 88
             $contentType = FileHelper::detectMimeType($fileName);
89 89
         }
90 90
         
91
-        if(empty($encoding))
91
+        if (empty($encoding))
92 92
         {
93 93
             $encoding = RequestHelper::ENCODING_UTF8;
94 94
             $content = ConvertHelper::string2utf8($content);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     */
154 154
     public function render() : string
155 155
     {
156
-        if(empty($this->boundaries)) 
156
+        if (empty($this->boundaries)) 
157 157
         {
158 158
             throw new RequestHelper_Exception(
159 159
                 'No mime boundaries added',
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
         
165 165
         $result = '';
166 166
         
167
-        foreach($this->boundaries as $boundary)
167
+        foreach ($this->boundaries as $boundary)
168 168
         {
169 169
             $result .= $boundary->render();
170 170
         }
171 171
         
172
-        $result .= "--" . $this->getMimeBoundary() . "--" . 
173
-        $this->getEOL() . $this->getEOL(); // always finish with two eol's!!
172
+        $result .= "--".$this->getMimeBoundary()."--". 
173
+        $this->getEOL().$this->getEOL(); // always finish with two eol's!!
174 174
         
175 175
         return $result;
176 176
     }
Please login to merge, or discard this patch.
src/RequestHelper/Boundaries/Boundary.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
         $lines[] = '--'.$this->boundaries->getMimeBoundary();
133 133
         $lines[] = $this->renderContentDisposition();
134 134
         
135
-        if(!empty($this->contentType)) 
135
+        if (!empty($this->contentType)) 
136 136
         {
137 137
             $lines[] = $this->renderContentType();
138 138
         }
139 139
         
140
-        if(!empty($this->transferEncoding))
140
+        if (!empty($this->transferEncoding))
141 141
         {
142 142
             $lines[] = $this->renderTransferEncoding();
143 143
         }
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $result = 'Content-Disposition: form-data';
154 154
         
155
-        foreach($this->dispositionParams as $name => $value) 
155
+        foreach ($this->dispositionParams as $name => $value) 
156 156
         {
157
-            $result .= '; '.$name.'="' . $value . '"';
157
+            $result .= '; '.$name.'="'.$value.'"';
158 158
         }   
159 159
         
160 160
         return $result;
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
     
163 163
     protected function renderContentType() : string
164 164
     {
165
-        $result = 'Content-Type: ' . $this->contentType; 
165
+        $result = 'Content-Type: '.$this->contentType; 
166 166
         
167
-        if(!empty($this->contentEncoding)) 
167
+        if (!empty($this->contentEncoding)) 
168 168
         {
169
-            $result .= '; charset="' . $this->contentEncoding.'"';
169
+            $result .= '; charset="'.$this->contentEncoding.'"';
170 170
         }
171 171
         
172 172
         return $result;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     
175 175
     protected function renderTransferEncoding() : string
176 176
     {
177
-        $result = 'Content-Transfer-Encoding: ' . $this->transferEncoding;
177
+        $result = 'Content-Transfer-Encoding: '.$this->transferEncoding;
178 178
         
179 179
         return $result;
180 180
     }
Please login to merge, or discard this patch.
src/RequestHelper.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
         $output = curl_exec($ch);
242 242
 
243
-        if(isset($this->logfilePointer))
243
+        if (isset($this->logfilePointer))
244 244
         {
245 245
             fclose($this->logfilePointer);
246 246
         }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         // CURL will complain about an empty response when the 
253 253
         // server sends a 100-continue code. That should not be
254 254
         // regarded as an error.
255
-        if($output === false && $this->response->getCode() !== 100)
255
+        if ($output === false && $this->response->getCode() !== 100)
256 256
         {
257 257
             $this->response->setError(
258 258
                 curl_errno($ch),
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     {
287 287
         $ch = curl_init();
288 288
         
289
-        if(!is_resource($ch))
289
+        if (!is_resource($ch))
290 290
         {
291 291
             throw new RequestHelper_Exception(
292 292
                 'Could not initialize a new cURL instance.',
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         }
297 297
 
298 298
         $this->setHeader('Content-Length', (string)$this->boundaries->getContentLength());
299
-        $this->setHeader('Content-Type', 'multipart/form-data; boundary=' . $this->mimeBoundary);
299
+        $this->setHeader('Content-Type', 'multipart/form-data; boundary='.$this->mimeBoundary);
300 300
 
301 301
         curl_setopt($ch, CURLOPT_POST, true);
302 302
         curl_setopt($ch, CURLOPT_URL, $url->getNormalizedWithoutAuth());
@@ -309,18 +309,18 @@  discard block
 block discarded – undo
309 309
         
310 310
         $loggingEnabled = $this->configureLogging($ch);
311 311
         
312
-        if(!$loggingEnabled) 
312
+        if (!$loggingEnabled) 
313 313
         {
314 314
             curl_setopt($ch, CURLINFO_HEADER_OUT, true);
315 315
         }
316 316
         
317
-        if($this->verifySSL)
317
+        if ($this->verifySSL)
318 318
         {
319 319
             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
320 320
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
321 321
         }
322 322
         
323
-        if($url->hasUsername())
323
+        if ($url->hasUsername())
324 324
         {
325 325
             curl_setopt($ch, CURLOPT_USERNAME, $url->getUsername());
326 326
             curl_setopt($ch, CURLOPT_PASSWORD, $url->getPassword());
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
     */
336 336
     protected function configureLogging($ch) : bool
337 337
     {
338
-        if(empty($this->logfile))
338
+        if (empty($this->logfile))
339 339
         {
340 340
             return false;
341 341
         }
342 342
         
343 343
         $res = fopen($this->logfile, 'w+');
344 344
         
345
-        if($res === false)
345
+        if ($res === false)
346 346
         {
347 347
             throw new RequestHelper_Exception(
348 348
                 'Cannot open logfile for writing.',
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         
373 373
         $this->setHeader('Expect', '');
374 374
         
375
-        foreach($this->headers as $name => $value) {
375
+        foreach ($this->headers as $name => $value) {
376 376
             $result[] = $name.': '.$value;
377 377
         }
378 378
         
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     {
390 390
         $response = $this->getResponse();
391 391
         
392
-        if($response !== null) {
392
+        if ($response !== null) {
393 393
             return $response->getHeaders();
394 394
         }
395 395
 
Please login to merge, or discard this patch.