Completed
Push — master ( 468717...935663 )
by Lars
04:43
created
src/voku/helper/HtmlDomParser.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
    * @var string[][]
46 46
    */
47 47
   protected static $domLinkReplaceHelper = [
48
-      'orig' => ['[', ']', '{', '}',],
48
+      'orig' => ['[', ']', '{', '}', ],
49 49
       'tmp'  => [
50 50
           '____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_LEFT____',
51 51
           '____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_RIGHT____',
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
       return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments);
167 167
     }
168 168
 
169
-    throw new \BadMethodCallException('Method does not exist: ' . $name);
169
+    throw new \BadMethodCallException('Method does not exist: '.$name);
170 170
   }
171 171
 
172 172
   /**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
       if (!empty($linksOld[1])) {
283 283
         $linksOld = $linksOld[1];
284
-        foreach ((array)$linksOld as $linkKey => $linkOld) {
284
+        foreach ((array) $linksOld as $linkKey => $linkOld) {
285 285
           $linksNew[$linkKey] = \str_replace(
286 286
               self::$domLinkReplaceHelper['orig'],
287 287
               self::$domLinkReplaceHelper['tmp'],
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
           self::$domReplaceHelper['orig']
323 323
       );
324 324
 
325
-      $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<' . self::$domHtmlWrapperHelper . '>';
326
-      $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</' . self::$domHtmlWrapperHelper . '>';
325
+      $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<'.self::$domHtmlWrapperHelper.'>';
326
+      $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</'.self::$domHtmlWrapperHelper.'>';
327 327
 
328 328
       $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start'] = '';
329 329
       $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end'] = '';
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
         ||
397 397
         $this->keepBrokenHtml === true
398 398
     ) {
399
-      $html = '<' . self::$domHtmlWrapperHelper . '>' . $html . '</' . self::$domHtmlWrapperHelper . '>';
399
+      $html = '<'.self::$domHtmlWrapperHelper.'>'.$html.'</'.self::$domHtmlWrapperHelper.'>';
400 400
     }
401 401
 
402 402
     $html = self::replaceToPreserveHtmlEntities($html);
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
       $xmlHackUsed = false;
413 413
       if (\stripos('<?xml', $html) !== 0) {
414 414
         $xmlHackUsed = true;
415
-        $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html;
415
+        $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html;
416 416
       }
417 417
 
418 418
       $this->document->loadHTML($html, $optionsXml);
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
     do {
450 450
       $original = $html;
451 451
 
452
-      $html = (string)preg_replace_callback(
452
+      $html = (string) preg_replace_callback(
453 453
           '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
454
-          function ($matches) {
455
-            return $matches['start'] .
456
-                   '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
457
-                   $matches['value'] .
458
-                   '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
454
+          function($matches) {
455
+            return $matches['start'].
456
+                   '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'.
457
+                   $matches['value'].
458
+                   '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'.
459 459
                    $matches['end'];
460 460
           },
461 461
           $html
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
     do {
467 467
       $original = $html;
468 468
 
469
-      $html = (string)preg_replace_callback(
469
+      $html = (string) preg_replace_callback(
470 470
           '/(?<start>[^<]*)?(?<broken>(?:(?:<\/\w+(?:\s+\w+=\\"[^\"]+\\")*+)(?:[^<]+)>)+)(?<end>.*)/u',
471
-          function ($matches) {
471
+          function($matches) {
472 472
 
473 473
             $matches['broken'] = str_replace(
474 474
                 ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'],
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
             );
478 478
 
479 479
             self::$domBrokenReplaceHelper['orig'][] = $matches['broken'];
480
-            self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '____simple_html_dom__voku__broken_html____' . crc32($matches['broken']);
480
+            self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '____simple_html_dom__voku__broken_html____'.crc32($matches['broken']);
481 481
 
482
-            return $matches['start'] . $matchesHash . $matches['end'];
482
+            return $matches['start'].$matchesHash.$matches['end'];
483 483
           },
484 484
           $html
485 485
       );
@@ -665,8 +665,8 @@  discard block
 block discarded – undo
665 665
     }
666 666
 
667 667
     if ($this->isDOMDocumentCreatedWithoutWrapper === true) {
668
-      $content = (string)\preg_replace('/^<p>/', '', $content);
669
-      $content = (string)\preg_replace('/<\/p>/', '', $content);
668
+      $content = (string) \preg_replace('/^<p>/', '', $content);
669
+      $content = (string) \preg_replace('/<\/p>/', '', $content);
670 670
     }
671 671
 
672 672
     if ($this->isDOMDocumentCreatedWithoutHtml === true) {
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
     $xml = $this->document->saveXML(null, \LIBXML_NOEMPTYTAG);
837 837
 
838 838
     // remove the XML-header
839
-    $xml = \ltrim((string)\preg_replace('/<\?xml.*\?>/', '', $xml));
839
+    $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml));
840 840
 
841 841
     return $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity);
842 842
   }
Please login to merge, or discard this patch.