Passed
Push — master ( eac24c...ca71fa )
by Sebastian
02:56
created
src/FileHelper/FolderTree.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@  discard block
 block discarded – undo
42 42
         {
43 43
             $info->delete();
44 44
             return true;
45
-        }
46
-        catch (FileHelper_Exception $e)
45
+        } catch (FileHelper_Exception $e)
47 46
         {
48 47
             // Ignore the exception, since we're returning false instead.
49 48
         }
@@ -78,8 +77,7 @@  discard block
 block discarded – undo
78 77
             try
79 78
             {
80 79
                 FileHelper::deleteFile($item);
81
-            }
82
-            catch (FileHelper_Exception $e)
80
+            } catch (FileHelper_Exception $e)
83 81
             {
84 82
                 return false;
85 83
             }
@@ -125,8 +123,7 @@  discard block
 block discarded – undo
125 123
         if ($item->isFolder())
126 124
         {
127 125
             self::copy($item, $target . '/' . $item->getName());
128
-        }
129
-        else if($item->isFile())
126
+        } else if($item->isFile())
130 127
         {
131 128
             $item
132 129
                 ->requireIsFile()
Please login to merge, or discard this patch.
src/XMLHelper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
     public function removeTag(DOMElement $tag) : void
162 162
     {
163
-        if(isset($tag->parentNode))
163
+        if (isset($tag->parentNode))
164 164
         {
165 165
             $tag->parentNode->removeChild($tag);
166 166
         }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
         if (!empty($text)) {
248 248
             $fragment = $this->dom->createDocumentFragment();
249
-            if(!@$fragment->appendXML($text)) {
249
+            if (!@$fragment->appendXML($text)) {
250 250
                 throw new XMLHelper_Exception(
251 251
                     'Cannot append XML fragment',
252 252
                     sprintf(
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     * @param array<string,mixed> $attributes
289 289
     * @return DOMNode
290 290
     */
291
-    public function createRoot(string $name, array $attributes=array())
291
+    public function createRoot(string $name, array $attributes = array())
292 292
     {
293 293
         $root = $this->dom->appendChild($this->dom->createElement($name));
294 294
         $this->addAttributes($root, $attributes);
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
         $string = str_replace('&lt;', 'LT_ESCAPE', $string);
315 315
         $string = str_replace('&gt;', 'GT_ESCAPE', $string);
316 316
 
317
-        $string = str_replace('&nbsp;',' ',  $string);
318
-        $string = str_replace('&','&amp;',  $string);
317
+        $string = str_replace('&nbsp;', ' ', $string);
318
+        $string = str_replace('&', '&amp;', $string);
319 319
 
320 320
         return $string;
321 321
     }
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
     */
335 335
     public static function downloadXML(string $xml, string $filename = 'download.xml') : void
336 336
     {
337
-        if(!headers_sent() && !self::$simulation) 
337
+        if (!headers_sent() && !self::$simulation) 
338 338
         {
339
-            header('Content-Disposition: attachment; filename="' . $filename . '"');
339
+            header('Content-Disposition: attachment; filename="'.$filename.'"');
340 340
         }
341 341
         
342 342
         echo $xml;
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
     */
351 351
     public static function displayXML(string $xml) : void
352 352
     {
353
-        if(!headers_sent() && !self::$simulation) 
353
+        if (!headers_sent() && !self::$simulation) 
354 354
         {
355 355
             header('Content-Type:text/xml; charset=utf-8');
356 356
         }
357 357
         
358
-        if(self::$simulation) 
358
+        if (self::$simulation) 
359 359
         {
360 360
             $xml = '<pre>'.htmlspecialchars($xml).'</pre>';
361 361
         }
@@ -373,16 +373,16 @@  discard block
 block discarded – undo
373 373
      * @param array<string,string> $customInfo Associative array with name => value pairs for custom tags to add to the output xml
374 374
      * @see buildErrorXML()
375 375
      */
376
-    public static function displayErrorXML($code, string $message, string $title, array $customInfo=array())
376
+    public static function displayErrorXML($code, string $message, string $title, array $customInfo = array())
377 377
     {
378
-        if(!headers_sent() && !self::$simulation) {
379
-            header('HTTP/1.1 400 Bad Request: ' . $title, true, 400);
378
+        if (!headers_sent() && !self::$simulation) {
379
+            header('HTTP/1.1 400 Bad Request: '.$title, true, 400);
380 380
         }
381 381
 
382 382
         self::displayXML(self::buildErrorXML($code, $message, $title, $customInfo));
383 383
     }
384 384
     
385
-    public static function setSimulation(bool $simulate=true) : void
385
+    public static function setSimulation(bool $simulate = true) : void
386 386
     {
387 387
         self::$simulation = $simulate;
388 388
     }
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     * @param array<string,string> $customInfo
432 432
     * @return string
433 433
     */
434
-    public static function buildErrorXML($code, string $message, string $title, array $customInfo=array())
434
+    public static function buildErrorXML($code, string $message, string $title, array $customInfo = array())
435 435
     {
436 436
         $xml = new DOMDocument('1.0', 'UTF-8');
437 437
         $xml->formatOutput = true;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         $helper->addTextTag($root, 'title', $title);
446 446
         $helper->addTextTag($root, 'request_uri', $_SERVER['REQUEST_URI']);
447 447
         
448
-        foreach($customInfo as $name => $value) {
448
+        foreach ($customInfo as $name => $value) {
449 449
             $helper->addTextTag($root, $name, $value);
450 450
         }
451 451
 
Please login to merge, or discard this patch.