Passed
Branch master (e63160)
by MOHAMMAD
03:02
created
src/Converter/HTMLConverter.php 1 patch
Braces   +19 added lines, -16 removed lines patch added patch discarded remove patch
@@ -44,12 +44,13 @@  discard block
 block discarded – undo
44 44
 
45 45
     for ($i = 0; $i < $snippetsCount; $i++) {
46 46
       // We try to determine which tags the code is inside: <pre></pre>, <code></code>, [code][/code]
47
-      if (!empty($this->snippets['openpre'][$i]))
48
-        $snippet = "[code]".PHP_EOL.trim($this->snippets['contentpre'][$i]).PHP_EOL."[/code]";
49
-      elseif (!empty($this->snippets['opencode'][$i]))
50
-        $snippet = "[code]".PHP_EOL.trim($this->snippets['contentcode'][$i]).PHP_EOL."[/code]";
51
-      else
52
-        $snippet = $this->snippets['openbbcode'][$i].PHP_EOL.trim($this->snippets['contentbbcode'][$i]).PHP_EOL.$this->snippets['closebbcode'][$i];
47
+      if (!empty($this->snippets['openpre'][$i])) {
48
+              $snippet = "[code]".PHP_EOL.trim($this->snippets['contentpre'][$i]).PHP_EOL."[/code]";
49
+      } elseif (!empty($this->snippets['opencode'][$i])) {
50
+              $snippet = "[code]".PHP_EOL.trim($this->snippets['contentcode'][$i]).PHP_EOL."[/code]";
51
+      } else {
52
+              $snippet = $this->snippets['openbbcode'][$i].PHP_EOL.trim($this->snippets['contentbbcode'][$i]).PHP_EOL.$this->snippets['closebbcode'][$i];
53
+      }
53 54
 
54 55
       $this->text = preg_replace('/___SNIPPET___/', PHP_EOL.trim($snippet).PHP_EOL, $this->text, 1);
55 56
     }
@@ -70,13 +71,14 @@  discard block
 block discarded – undo
70 71
           $href = trim($others[1], '"');
71 72
 
72 73
           // Extracts the target.
73
-          if (preg_match('/\s*target\s*=\s*("([^"]*")|\'[^\']*\'|([^\'">\s]+))/iu', $matches[0], $others) === 1)
74
-            $target = strtolower(trim($others[1], '"'));
75
-          else
76
-            $target = "_self";
74
+          if (preg_match('/\s*target\s*=\s*("([^"]*")|\'[^\']*\'|([^\'">\s]+))/iu', $matches[0], $others) === 1) {
75
+                      $target = strtolower(trim($others[1], '"'));
76
+          } else {
77
+                      $target = "_self";
78
+          }
79
+        } else {
80
+                  throw new \RuntimeException(sprintf("Text identified by '%d' has malformed links", $this->id));
77 81
         }
78
-        else
79
-          throw new \RuntimeException(sprintf("Text identified by '%d' has malformed links", $this->id));
80 82
 
81 83
         return "[url=".$href." t=".$target."]".$matches[1]."[/url]";
82 84
 
@@ -97,10 +99,11 @@  discard block
 block discarded – undo
97 99
       function ($matches) {
98 100
 
99 101
         // Extracts the src.
100
-        if (preg_match('/\s*src\s*=\s*("([^"]*")|\'[^\']*\'|([^\'">\s]+))/iu', $matches[0], $others) === 1)
101
-          $src = trim($others[1], '"');
102
-        else
103
-          throw new \RuntimeException(sprintf("Text identified by '%d' has malformed images", $this->id));
102
+        if (preg_match('/\s*src\s*=\s*("([^"]*")|\'[^\']*\'|([^\'">\s]+))/iu', $matches[0], $others) === 1) {
103
+                  $src = trim($others[1], '"');
104
+        } else {
105
+                  throw new \RuntimeException(sprintf("Text identified by '%d' has malformed images", $this->id));
106
+        }
104 107
 
105 108
         return "[img]".$src."[/img]";
106 109
 
Please login to merge, or discard this patch.