Passed
Push — master ( 7a3879...fb1031 )
by MOHAMMAD
01:31
created
src/Converter/BBCodeConverter.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             $text = $this->text;
53 53
         }
54 54
 
55
-        if ( ! $text) {
55
+        if (!$text) {
56 56
             return $text;
57 57
         }
58 58
 
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
      */
78 78
     protected function removeColor()
79 79
     {
80
-        $this->cleaners['removeColor'] = function ($text) {
80
+        $this->cleaners['removeColor'] = function($text) {
81 81
             return preg_replace_callback('%\[color=\#?\w+\]([\W\D\w\s]*?)\[/color\]%iu',
82
-                function ($matches) {
82
+                function($matches) {
83 83
                     return $matches[1];
84 84
                 },
85 85
 
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
      */
94 94
     protected function replaceSize()
95 95
     {
96
-        $this->cleaners['replaceSize'] = function ($text) {
96
+        $this->cleaners['replaceSize'] = function($text) {
97 97
             return preg_replace_callback('%\[size=(\d*)\]([\W\D\w\s]*?)\[/size\]%iu',
98
-                function ($matches) {
98
+                function($matches) {
99 99
                     $size = min((int) $matches[1], 6);
100 100
 
101 101
                     $multiplier = -1 * $size + 7;
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
      */
114 114
     protected function removeCenter()
115 115
     {
116
-        $this->cleaners['removeCenter'] = function ($text) {
116
+        $this->cleaners['removeCenter'] = function($text) {
117 117
             return preg_replace_callback('%\[center\]([\W\D\w\s]*?)\[/center\]%iu',
118
-                function ($matches) {
118
+                function($matches) {
119 119
                     return $matches[1];
120 120
                 },
121 121
 
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
      */
130 130
     protected function replaceBold()
131 131
     {
132
-        $this->cleaners['replaceBold'] = function ($text) {
132
+        $this->cleaners['replaceBold'] = function($text) {
133 133
             return preg_replace_callback('%\[b\]([\W\D\w\s]*?)\[/b\]%iu',
134
-                function ($matches) {
134
+                function($matches) {
135 135
                     return '**'.trim($matches[1], ' ').'**';
136 136
                 },
137 137
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
      */
146 146
     protected function replaceItalic()
147 147
     {
148
-        $this->cleaners['replaceItalic'] = function ($text) {
148
+        $this->cleaners['replaceItalic'] = function($text) {
149 149
             return preg_replace_callback('%\[i\]([\W\D\w\s]*?)\[/i\]%iu',
150
-                function ($matches) {
150
+                function($matches) {
151 151
                     return '*'.trim($matches[1], ' ').'*';
152 152
                 },
153 153
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
      */
162 162
     protected function replaceUnderline()
163 163
     {
164
-        $this->cleaners['replaceUnderline'] = function ($text) {
164
+        $this->cleaners['replaceUnderline'] = function($text) {
165 165
             return preg_replace_callback('%\[u\]([\W\D\w\s]*?)\[/u\]%iu',
166
-                function ($matches) {
166
+                function($matches) {
167 167
                     return '_'.trim($matches[1], ' ').'_';
168 168
                 },
169 169
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
      */
178 178
     protected function replaceStrikethrough()
179 179
     {
180
-        $this->cleaners['replaceStrikethrough'] = function ($text) {
180
+        $this->cleaners['replaceStrikethrough'] = function($text) {
181 181
             return preg_replace_callback('%\[s\]([\W\D\w\s]*?)\[/s\]%iu',
182
-                function ($matches) {
182
+                function($matches) {
183 183
                     return '~~'.trim($matches[1], ' ').'~~';
184 184
                 },
185 185
 
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
      */
194 194
     protected function replaceLists()
195 195
     {
196
-        $this->cleaners['replaceLists'] = function ($text, $id = null) {
196
+        $this->cleaners['replaceLists'] = function($text, $id = null) {
197 197
             return preg_replace_callback('%\[list(?P<type>=1)?\](?P<items>[\W\D\w\s]*?)\[/list\]%iu',
198
-                function ($matches) use ($id) {
198
+                function($matches) use ($id) {
199 199
                     $buffer = '';
200 200
 
201 201
                     $list = preg_replace('/\s*$|^\s*/mu', '', $matches['items']);
@@ -209,21 +209,21 @@  discard block
 block discarded – undo
209 209
                     if (isset($matches['type']) && '=1' == $matches['type']) { // ordered list
210 210
                         // We start from 1 to discard the first string, in fact, it's empty.
211 211
                         for ($i = 1; $i < $counter; ++$i) {
212
-                            if ( ! empty($items[$i])) {
212
+                            if (!empty($items[$i])) {
213 213
                                 $buffer .= (string) ($i).'. '.trim($items[$i]).PHP_EOL;
214 214
                             }
215 215
                         }
216 216
                     } else { // unordered list
217 217
                         // We start from 1 to discard the first string, in fact, it's empty.
218 218
                         for ($i = 1; $i < $counter; ++$i) {
219
-                            if ( ! empty($items[$i])) {
219
+                            if (!empty($items[$i])) {
220 220
                                 $buffer .= '- '.trim($items[$i]).PHP_EOL;
221 221
                             }
222 222
                         }
223 223
                     }
224 224
 
225 225
                     // We need a like break above the list and another one below.
226
-                    if ( ! empty($buffer)) {
226
+                    if (!empty($buffer)) {
227 227
                         $buffer = PHP_EOL.$buffer.PHP_EOL;
228 228
                     }
229 229
 
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
      */
241 241
     protected function replaceUrls()
242 242
     {
243
-        $this->cleaners['replaceUrls'] = function ($text, $id = null) {
243
+        $this->cleaners['replaceUrls'] = function($text, $id = null) {
244 244
             return preg_replace_callback('%\[url\s*=\s*(?:"([^"]*)"|\A[^\']*\Z|(?:[^\'">\]\s]+))\s*(?:[^]\s]*)\]([\W\D\w\s]*?)\[/url\]%iu',
245
-                function ($matches) use ($id) {
245
+                function($matches) use ($id) {
246 246
                     if (isset($matches[1]) && isset($matches[2])) {
247 247
                         return '['.$matches[2].']('.$matches[1].')';
248 248
                     }
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
      */
261 261
     protected function replaceImages()
262 262
     {
263
-        $this->cleaners['replaceImages'] = function ($text, $id = null) {
263
+        $this->cleaners['replaceImages'] = function($text, $id = null) {
264 264
             return preg_replace_callback('%\[img\s*\]\s*("(?:[^"]*")|\A[^\']*\Z|(?:[^\'">\]\s]+))\s*(?:[^]\s]*)\[/img\]%iu',
265
-                function ($matches) use ($id) {
265
+                function($matches) use ($id) {
266 266
                     if (isset($matches[1])) {
267 267
                         return PHP_EOL.'![]'.'('.$matches[1].')'.PHP_EOL;
268 268
                     }
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
      */
282 282
     protected function replaceQuotes()
283 283
     {
284
-        $this->cleaners['replaceQuotes'] = function ($text, $id = null) {
284
+        $this->cleaners['replaceQuotes'] = function($text, $id = null) {
285 285
             // Removes the inner quotes, leaving just one level.
286 286
             $text = preg_replace('~\G(?<!^)(?>(\[quote\b[^]]*](?>[^[]++|\[(?!/?quote)|(?1))*\[/quote])|(?<!\[)(?>[^[]++|\[(?!/?quote))+\K)|\[quote\b[^]]*]\K~i', '', $text);
287 287
 
288 288
             // Replaces all the remaining quotes with '> ' characters.
289 289
             $text = preg_replace_callback('%\[quote\b[^]]*\]((?>[^[]++|\[(?!/?quote))*)\[/quote\]%i',
290
-                function ($matches) {
290
+                function($matches) {
291 291
                     $quote = preg_replace('/^\s*/mu', '', trim($matches[1]));
292 292
 
293 293
                     return '> '.$quote.PHP_EOL.PHP_EOL;
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
      */
306 306
     protected function replaceSnippets()
307 307
     {
308
-        $this->cleaners['replaceSnippets'] = function ($text, $id = null) {
308
+        $this->cleaners['replaceSnippets'] = function($text, $id = null) {
309 309
             return preg_replace_callback('%\[code\s*=?(?P<language>\w*)\](?P<snippet>[\W\D\w\s]*?)\[\/code\]%iu',
310
-                function ($matches) use ($id) {
310
+                function($matches) use ($id) {
311 311
                     if (isset($matches['snippet'])) {
312 312
                         $language = strtolower($matches['language']);
313 313
 
Please login to merge, or discard this patch.