Passed
Push — lib ( 71f6fb...697524 )
by Michel
01:34 queued 11s
created
Michelf/Markdown.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -775,8 +775,9 @@
 block discarded – undo
775 775
 		// tag parser and hashed. Need to reverse the process before using
776 776
 		// the URL.
777 777
 		$unhashed = $this->unhash($url);
778
-		if ($unhashed !== $url)
779
-			$url = preg_replace('/^<(.*)>$/', '\1', $unhashed);
778
+		if ($unhashed !== $url) {
779
+					$url = preg_replace('/^<(.*)>$/', '\1', $unhashed);
780
+		}
780 781
 
781 782
 		$url = $this->encodeURLAttribute($url);
782 783
 
Please login to merge, or discard this patch.
Michelf/MarkdownExtra.php 1 patch
Braces   +42 added lines, -36 removed lines patch added patch discarded remove patch
@@ -187,8 +187,9 @@  discard block
 block discarded – undo
187 187
 		$this->footnotes_assembled = null;
188 188
 
189 189
 		foreach ($this->predef_abbr as $abbr_word => $abbr_desc) {
190
-			if ($this->abbr_word_re)
191
-				$this->abbr_word_re .= '|';
190
+			if ($this->abbr_word_re) {
191
+							$this->abbr_word_re .= '|';
192
+			}
192 193
 			$this->abbr_word_re .= preg_quote($abbr_word);
193 194
 			$this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
194 195
 		}
@@ -205,8 +206,9 @@  discard block
 block discarded – undo
205 206
 		$this->abbr_desciptions = array();
206 207
 		$this->abbr_word_re = '';
207 208
 
208
-		if ( ! $this->omit_footnotes )
209
-			$this->footnotes_assembled = null;
209
+		if ( ! $this->omit_footnotes ) {
210
+					$this->footnotes_assembled = null;
211
+		}
210 212
 
211 213
 		parent::teardown();
212 214
 	}
@@ -259,7 +261,9 @@  discard block
 block discarded – undo
259 261
 			if ($element[0] === '.') {
260 262
 				$classes[] = substr($element, 1);
261 263
 			} else if ($element[0] === '#') {
262
-				if ($id === false) $id = substr($element, 1);
264
+				if ($id === false) {
265
+					$id = substr($element, 1);
266
+				}
263 267
 			} else if (strpos($element, '=') > 0) {
264 268
 				$parts = explode('=', $element, 2);
265 269
 				$attributes[] = $parts[0] . '="' . $parts[1] . '"';
@@ -435,7 +439,9 @@  discard block
 block discarded – undo
435 439
 										$enclosing_tag_re = '', $span = false)
436 440
 	{
437 441
 
438
-		if ($text === '') return array('', '');
442
+		if ($text === '') {
443
+			return array('', '');
444
+		}
439 445
 
440 446
 		// Regex to check for the presense of newlines around a block tag.
441 447
 		$newline_before_re = '/(?:^\n?|\n\n)*$/';
@@ -546,8 +552,7 @@  discard block
 block discarded – undo
546 552
 					// End marker found: pass text unchanged until marker.
547 553
 					$parsed .= $tag . $matches[0];
548 554
 					$text = substr($text, strlen($matches[0]));
549
-				}
550
-				else {
555
+				} else {
551 556
 					// No end marker: just skip it.
552 557
 					$parsed .= $tag;
553 558
 				}
@@ -569,8 +574,7 @@  discard block
 block discarded – undo
569 574
 					// End marker found: pass text unchanged until marker.
570 575
 					$parsed .= $tag . $matches[0];
571 576
 					$text = substr($text, strlen($matches[0]));
572
-				}
573
-				else {
577
+				} else {
574 578
 					// Unmatched marker: just skip it.
575 579
 					$parsed .= $tag;
576 580
 				}
@@ -623,8 +627,7 @@  discard block
 block discarded – undo
623 627
 				}
624 628
 
625 629
 				$parsed .= $tag;
626
-			}
627
-			else {
630
+			} else {
628 631
 				$parsed .= $tag;
629 632
 			}
630 633
 		} while ($depth >= 0);
@@ -647,7 +650,9 @@  discard block
 block discarded – undo
647 650
 	 * @return array
648 651
 	 */
649 652
 	protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
650
-		if ($text === '') return array('', '');
653
+		if ($text === '') {
654
+			return array('', '');
655
+		}
651 656
 
652 657
 		// Regex to match `markdown` attribute inside of a tag.
653 658
 		$markdown_attr_re = '
@@ -697,8 +702,9 @@  discard block
 block discarded – undo
697 702
 
698 703
 		// Get the name of the starting tag.
699 704
 		// (This pattern makes $base_tag_name_re safe without quoting.)
700
-		if (preg_match('/^<([\w:$]*)\b/', $text, $matches))
701
-			$base_tag_name_re = $matches[1];
705
+		if (preg_match('/^<([\w:$]*)\b/', $text, $matches)) {
706
+					$base_tag_name_re = $matches[1];
707
+		}
702 708
 
703 709
 		// Loop through every tag until we find the corresponding closing tag.
704 710
 		do {
@@ -727,8 +733,7 @@  discard block
 block discarded – undo
727 733
 			{
728 734
 				// Just add the tag to the block as if it was text.
729 735
 				$block_text .= $tag;
730
-			}
731
-			else {
736
+			} else {
732 737
 				// Increase/decrease nested tag count. Only do so if
733 738
 				// the tag's name match base tag's.
734 739
 				if (preg_match('{^</?' . $base_tag_name_re . '\b}', $tag)) {
@@ -789,8 +794,9 @@  discard block
 block discarded – undo
789 794
 
790 795
 					// Start over with a new block.
791 796
 					$block_text = "";
797
+				} else {
798
+					$block_text .= $tag;
792 799
 				}
793
-				else $block_text .= $tag;
794 800
 			}
795 801
 
796 802
 		} while ($depth > 0);
@@ -911,14 +917,14 @@  discard block
 block discarded – undo
911 917
 				$title = $this->encodeAttribute($title);
912 918
 				$result .=  " title=\"$title\"";
913 919
 			}
914
-			if (isset($this->ref_attr[$link_id]))
915
-				$result .= $this->ref_attr[$link_id];
920
+			if (isset($this->ref_attr[$link_id])) {
921
+							$result .= $this->ref_attr[$link_id];
922
+			}
916 923
 
917 924
 			$link_text = $this->runSpanGamut($link_text);
918 925
 			$result .= ">$link_text</a>";
919 926
 			$result = $this->hashPart($result);
920
-		}
921
-		else {
927
+		} else {
922 928
 			$result = $whole_match;
923 929
 		}
924 930
 		return $result;
@@ -938,8 +944,9 @@  discard block
 block discarded – undo
938 944
 		// if the URL was of the form <s p a c e s> it got caught by the HTML
939 945
 		// tag parser and hashed. Need to reverse the process before using the URL.
940 946
 		$unhashed = $this->unhash($url);
941
-		if ($unhashed !== $url)
942
-			$url = preg_replace('/^<(.*)>$/', '\1', $unhashed);
947
+		if ($unhashed !== $url) {
948
+					$url = preg_replace('/^<(.*)>$/', '\1', $unhashed);
949
+		}
943 950
 
944 951
 		$url = $this->encodeURLAttribute($url);
945 952
 
@@ -1039,8 +1046,7 @@  discard block
 block discarded – undo
1039 1046
 			}
1040 1047
 			$result .= $this->empty_element_suffix;
1041 1048
 			$result = $this->hashPart($result);
1042
-		}
1043
-		else {
1049
+		} else {
1044 1050
 			// If there's no such link ID, leave intact:
1045 1051
 			$result = $whole_match;
1046 1052
 		}
@@ -1255,14 +1261,15 @@  discard block
 block discarded – undo
1255 1261
 		// Reading alignement from header underline.
1256 1262
 		$separators	= preg_split('/ *[|] */', $underline);
1257 1263
 		foreach ($separators as $n => $s) {
1258
-			if (preg_match('/^ *-+: *$/', $s))
1259
-				$attr[$n] = $this->_doTable_makeAlignAttr('right');
1260
-			else if (preg_match('/^ *:-+: *$/', $s))
1261
-				$attr[$n] = $this->_doTable_makeAlignAttr('center');
1262
-			else if (preg_match('/^ *:-+ *$/', $s))
1263
-				$attr[$n] = $this->_doTable_makeAlignAttr('left');
1264
-			else
1265
-				$attr[$n] = '';
1264
+			if (preg_match('/^ *-+: *$/', $s)) {
1265
+							$attr[$n] = $this->_doTable_makeAlignAttr('right');
1266
+			} else if (preg_match('/^ *:-+: *$/', $s)) {
1267
+							$attr[$n] = $this->_doTable_makeAlignAttr('center');
1268
+			} else if (preg_match('/^ *:-+ *$/', $s)) {
1269
+							$attr[$n] = $this->_doTable_makeAlignAttr('left');
1270
+			} else {
1271
+							$attr[$n] = '';
1272
+			}
1266 1273
 		}
1267 1274
 
1268 1275
 		// Parsing span elements, including code spans, character escapes,
@@ -1445,8 +1452,7 @@  discard block
 block discarded – undo
1445 1452
 			$def = str_repeat(' ', strlen($marker_space)) . $def;
1446 1453
 			$def = $this->runBlockGamut($this->outdent($def . "\n\n"));
1447 1454
 			$def = "\n". $def ."\n";
1448
-		}
1449
-		else {
1455
+		} else {
1450 1456
 			$def = rtrim($def);
1451 1457
 			$def = $this->runSpanGamut($this->outdent($def));
1452 1458
 		}
Please login to merge, or discard this patch.