Test Failed
Pull Request — lib (#398)
by
unknown
06:53
created
Michelf/Markdown.php 2 patches
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.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
 		// Try to take parser from the static parser list
37 37
 		static $parser_list;
38
-		$parser =& $parser_list[$parser_class];
38
+		$parser = & $parser_list[$parser_class];
39 39
 
40 40
 		// Create the parser it not already set
41 41
 		if (!$parser) {
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 		$this->prepareItalicsAndBold();
158 158
 
159 159
 		$this->nested_brackets_re =
160
-			str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth).
160
+			str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth) .
161 161
 			str_repeat('\])*', $this->nested_brackets_depth);
162 162
 
163 163
 		$this->nested_url_parenthesis_re =
164
-			str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth).
164
+			str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth) .
165 165
 			str_repeat('(?>\)))*', $this->nested_url_parenthesis_depth);
166 166
 
167
-		$this->escape_chars_re = '['.preg_quote($this->escape_chars).']';
167
+		$this->escape_chars_re = '[' . preg_quote($this->escape_chars) . ']';
168 168
 
169 169
 		// Sort document, block, and span gamut in ascendent priority order.
170 170
 		asort($this->document_gamut);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
 		// Link defs are in the form: ^[id]: url "optional title"
285 285
 		$text = preg_replace_callback('{
286
-							^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?:	# id = $1
286
+							^[ ]{0,'.$less_than_tab . '}\[(.+)\][ ]?:	# id = $1
287 287
 							  [ ]*
288 288
 							  \n?				# maybe *one* newline
289 289
 							  [ ]*
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		$link_id = strtolower($matches[1]);
320 320
 		$url = $matches[2] == '' ? $matches[3] : $matches[2];
321 321
 		$this->urls[$link_id] = $url;
322
-		$this->titles[$link_id] =& $matches[4];
322
+		$this->titles[$link_id] = & $matches[4];
323 323
 		return ''; // String that will replace the block
324 324
 	}
325 325
 
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
 		 * *  List "b" is made of tags which are always block-level;
352 352
 		 */
353 353
 		$block_tags_a_re = 'ins|del';
354
-		$block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|'.
355
-						   'script|noscript|style|form|fieldset|iframe|math|svg|'.
356
-						   'article|section|nav|aside|hgroup|header|footer|'.
354
+		$block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|' .
355
+						   'script|noscript|style|form|fieldset|iframe|math|svg|' .
356
+						   'article|section|nav|aside|hgroup|header|footer|' .
357 357
 						   'figure|details|summary';
358 358
 
359 359
 		// Regular expression for the content of a block tag.
@@ -378,12 +378,12 @@  discard block
 block discarded – undo
378 378
 				  [^<]+			# content without tag
379 379
 				|
380 380
 				  <\2			# nested opening tag
381
-					'.$attr.'	# attributes
381
+					'.$attr . '	# attributes
382 382
 					(?>
383 383
 					  />
384 384
 					|
385
-					  >', $nested_tags_level).	// end of opening tag
386
-					  '.*?'.					// last level nested tag content
385
+					  >', $nested_tags_level) . // end of opening tag
386
+					  '.*?' . // last level nested tag content
387 387
 			str_repeat('
388 388
 					  </\2\s*>	# closing nested tag
389 389
 					)
@@ -419,20 +419,20 @@  discard block
 block discarded – undo
419 419
 			  # Match from `\n<tag>` to `</tag>\n`, handling nested tags
420 420
 			  # in between.
421 421
 
422
-						[ ]{0,'.$less_than_tab.'}
423
-						<('.$block_tags_b_re.')# start tag = $2
424
-						'.$attr.'>			# attributes followed by > and \n
425
-						'.$content.'		# content, support nesting
422
+						[ ]{0,'.$less_than_tab . '}
423
+						<('.$block_tags_b_re . ')# start tag = $2
424
+						'.$attr . '>			# attributes followed by > and \n
425
+						'.$content . '		# content, support nesting
426 426
 						</\2>				# the matching end tag
427 427
 						[ ]*				# trailing spaces/tabs
428 428
 						(?=\n+|\Z)	# followed by a newline or end of document
429 429
 
430 430
 			| # Special version for tags of group a.
431 431
 
432
-						[ ]{0,'.$less_than_tab.'}
433
-						<('.$block_tags_a_re.')# start tag = $3
434
-						'.$attr.'>[ ]*\n	# attributes followed by >
435
-						'.$content2.'		# content, support nesting
432
+						[ ]{0,'.$less_than_tab . '}
433
+						<('.$block_tags_a_re . ')# start tag = $3
434
+						'.$attr . '>[ ]*\n	# attributes followed by >
435
+						'.$content2 . '		# content, support nesting
436 436
 						</\3>				# the matching end tag
437 437
 						[ ]*				# trailing spaces/tabs
438 438
 						(?=\n+|\Z)	# followed by a newline or end of document
@@ -440,16 +440,16 @@  discard block
 block discarded – undo
440 440
 			| # Special case just for <hr />. It was easier to make a special
441 441
 			  # case than to make the other regex more complicated.
442 442
 
443
-						[ ]{0,'.$less_than_tab.'}
443
+						[ ]{0,'.$less_than_tab . '}
444 444
 						<(hr)				# start tag = $2
445
-						'.$attr.'			# attributes
445
+						'.$attr . '			# attributes
446 446
 						/?>					# the matching end tag
447 447
 						[ ]*
448 448
 						(?=\n{2,}|\Z)		# followed by a blank line or end of document
449 449
 
450 450
 			| # Special case for standalone HTML comments:
451 451
 
452
-					[ ]{0,'.$less_than_tab.'}
452
+					[ ]{0,'.$less_than_tab . '}
453 453
 					(?s:
454 454
 						<!-- .*? -->
455 455
 					)
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 
459 459
 			| # PHP and ASP-style processor instructions (<? and <%)
460 460
 
461
-					[ ]{0,'.$less_than_tab.'}
461
+					[ ]{0,'.$less_than_tab . '}
462 462
 					(?s:
463 463
 						<([?%])			# $2
464 464
 						.*?
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 				[ ]*		# Tailing spaces
590 590
 				$			# End of line.
591 591
 			}mx',
592
-			"\n".$this->hashBlock("<hr$this->empty_element_suffix")."\n",
592
+			"\n" . $this->hashBlock("<hr$this->empty_element_suffix") . "\n",
593 593
 			$text
594 594
 		);
595 595
 	}
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 		$text = preg_replace_callback('{
669 669
 			(					# wrap whole match in $1
670 670
 			  \[
671
-				('.$this->nested_brackets_re.')	# link text = $2
671
+				('.$this->nested_brackets_re . ')	# link text = $2
672 672
 			  \]
673 673
 
674 674
 			  [ ]?				# one optional space
@@ -685,14 +685,14 @@  discard block
 block discarded – undo
685 685
 		$text = preg_replace_callback('{
686 686
 			(				# wrap whole match in $1
687 687
 			  \[
688
-				('.$this->nested_brackets_re.')	# link text = $2
688
+				('.$this->nested_brackets_re . ')	# link text = $2
689 689
 			  \]
690 690
 			  \(			# literal paren
691 691
 				[ \n]*
692 692
 				(?:
693 693
 					<(.+?)>	# href = $3
694 694
 				|
695
-					('.$this->nested_url_parenthesis_re.')	# href = $4
695
+					('.$this->nested_url_parenthesis_re . ')	# href = $4
696 696
 				)
697 697
 				[ \n]*
698 698
 				(			# $5
@@ -728,9 +728,9 @@  discard block
 block discarded – undo
728 728
 	 * @return string
729 729
 	 */
730 730
 	protected function _doAnchors_reference_callback($matches) {
731
-		$whole_match =  $matches[1];
732
-		$link_text   =  $matches[2];
733
-		$link_id     =& $matches[3];
731
+		$whole_match = $matches[1];
732
+		$link_text   = $matches[2];
733
+		$link_id     = & $matches[3];
734 734
 
735 735
 		if ($link_id == "") {
736 736
 			// for shortcut links like [this][] or [this].
@@ -746,10 +746,10 @@  discard block
 block discarded – undo
746 746
 			$url = $this->encodeURLAttribute($url);
747 747
 
748 748
 			$result = "<a href=\"$url\"";
749
-			if ( isset( $this->titles[$link_id] ) ) {
749
+			if (isset($this->titles[$link_id])) {
750 750
 				$title = $this->titles[$link_id];
751 751
 				$title = $this->encodeAttribute($title);
752
-				$result .=  " title=\"$title\"";
752
+				$result .= " title=\"$title\"";
753 753
 			}
754 754
 
755 755
 			$link_text = $this->runSpanGamut($link_text);
@@ -767,9 +767,9 @@  discard block
 block discarded – undo
767 767
 	 * @return string
768 768
 	 */
769 769
 	protected function _doAnchors_inline_callback($matches) {
770
-		$link_text		=  $this->runSpanGamut($matches[2]);
771
-		$url			=  $matches[3] === '' ? $matches[4] : $matches[3];
772
-		$title			=& $matches[7];
770
+		$link_text = $this->runSpanGamut($matches[2]);
771
+		$url = $matches[3] === '' ? $matches[4] : $matches[3];
772
+		$title = & $matches[7];
773 773
 
774 774
 		// If the URL was of the form <s p a c e s> it got caught by the HTML
775 775
 		// tag parser and hashed. Need to reverse the process before using
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 		$result = "<a href=\"$url\"";
784 784
 		if ($title) {
785 785
 			$title = $this->encodeAttribute($title);
786
-			$result .=  " title=\"$title\"";
786
+			$result .= " title=\"$title\"";
787 787
 		}
788 788
 
789 789
 		$link_text = $this->runSpanGamut($link_text);
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 		$text = preg_replace_callback('{
803 803
 			(				# wrap whole match in $1
804 804
 			  !\[
805
-				('.$this->nested_brackets_re.')		# alt text = $2
805
+				('.$this->nested_brackets_re . ')		# alt text = $2
806 806
 			  \]
807 807
 
808 808
 			  [ ]?				# one optional space
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 		$text = preg_replace_callback('{
822 822
 			(				# wrap whole match in $1
823 823
 			  !\[
824
-				('.$this->nested_brackets_re.')		# alt text = $2
824
+				('.$this->nested_brackets_re . ')		# alt text = $2
825 825
 			  \]
826 826
 			  \s?			# One optional whitespace character
827 827
 			  \(			# literal paren
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 				(?:
830 830
 					<(\S*)>	# src url = $3
831 831
 				|
832
-					('.$this->nested_url_parenthesis_re.')	# src url = $4
832
+					('.$this->nested_url_parenthesis_re . ')	# src url = $4
833 833
 				)
834 834
 				[ \n]*
835 835
 				(			# $5
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 			if (isset($this->titles[$link_id])) {
868 868
 				$title = $this->titles[$link_id];
869 869
 				$title = $this->encodeAttribute($title);
870
-				$result .=  " title=\"$title\"";
870
+				$result .= " title=\"$title\"";
871 871
 			}
872 872
 			$result .= $this->empty_element_suffix;
873 873
 			$result = $this->hashPart($result);
@@ -885,17 +885,17 @@  discard block
 block discarded – undo
885 885
 	 * @return string
886 886
 	 */
887 887
 	protected function _doImages_inline_callback($matches) {
888
-		$whole_match	= $matches[1];
889
-		$alt_text		= $matches[2];
890
-		$url			= $matches[3] == '' ? $matches[4] : $matches[3];
891
-		$title			=& $matches[7];
888
+		$whole_match = $matches[1];
889
+		$alt_text = $matches[2];
890
+		$url = $matches[3] == '' ? $matches[4] : $matches[3];
891
+		$title = & $matches[7];
892 892
 
893 893
 		$alt_text = $this->encodeAttribute($alt_text);
894 894
 		$url = $this->encodeURLAttribute($url);
895 895
 		$result = "<img src=\"$url\" alt=\"$alt_text\"";
896 896
 		if (isset($title)) {
897 897
 			$title = $this->encodeAttribute($title);
898
-			$result .=  " title=\"$title\""; // $title already quoted
898
+			$result .= " title=\"$title\""; // $title already quoted
899 899
 		}
900 900
 		$result .= $this->empty_element_suffix;
901 901
 
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 		// ID attribute generation
957 957
 		$idAtt = $this->_generateIdFromHeaderValue($matches[1]);
958 958
 
959
-		$block = "<h$level$idAtt>".$this->runSpanGamut($matches[1])."</h$level>";
959
+		$block = "<h$level$idAtt>" . $this->runSpanGamut($matches[1]) . "</h$level>";
960 960
 		return "\n" . $this->hashBlock($block) . "\n\n";
961 961
 	}
962 962
 
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 		$idAtt = $this->_generateIdFromHeaderValue($matches[2]);
971 971
 
972 972
 		$level = strlen($matches[1]);
973
-		$block = "<h$level$idAtt>".$this->runSpanGamut($matches[2])."</h$level>";
973
+		$block = "<h$level$idAtt>" . $this->runSpanGamut($matches[2]) . "</h$level>";
974 974
 		return "\n" . $this->hashBlock($block) . "\n\n";
975 975
 	}
976 976
 
@@ -1018,8 +1018,8 @@  discard block
 block discarded – undo
1018 1018
 			$whole_list_re = '
1019 1019
 				(								# $1 = whole list
1020 1020
 				  (								# $2
1021
-					([ ]{0,'.$less_than_tab.'})	# $3 = number of spaces
1022
-					('.$marker_re.')			# $4 = first list item marker
1021
+					([ ]{0,'.$less_than_tab . '})	# $3 = number of spaces
1022
+					('.$marker_re . ')			# $4 = first list item marker
1023 1023
 					[ ]+
1024 1024
 				  )
1025 1025
 				  (?s:.+?)
@@ -1030,13 +1030,13 @@  discard block
 block discarded – undo
1030 1030
 					  (?=\S)
1031 1031
 					  (?!						# Negative lookahead for another list item marker
1032 1032
 						[ ]*
1033
-						'.$marker_re.'[ ]+
1033
+						'.$marker_re . '[ ]+
1034 1034
 					  )
1035 1035
 					|
1036 1036
 					  (?=						# Lookahead for another kind of list
1037 1037
 					    \n
1038 1038
 						\3						# Must have the same indentation
1039
-						'.$other_marker_re.'[ ]+
1039
+						'.$other_marker_re . '[ ]+
1040 1040
 					  )
1041 1041
 				  )
1042 1042
 				)
@@ -1048,13 +1048,13 @@  discard block
 block discarded – undo
1048 1048
 			if ($this->list_level) {
1049 1049
 				$text = preg_replace_callback('{
1050 1050
 						^
1051
-						'.$whole_list_re.'
1051
+						'.$whole_list_re . '
1052 1052
 					}mx',
1053 1053
 					array($this, '_doLists_callback'), $text);
1054 1054
 			} else {
1055 1055
 				$text = preg_replace_callback('{
1056 1056
 						(?:(?<=\n)\n|\A\n?) # Must eat the newline
1057
-						'.$whole_list_re.'
1057
+						'.$whole_list_re . '
1058 1058
 					}mx',
1059 1059
 					array($this, '_doLists_callback'), $text);
1060 1060
 			}
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 		$list = $matches[1];
1079 1079
 		$list_type = preg_match("/$marker_ul_re/", $matches[4]) ? "ul" : "ol";
1080 1080
 
1081
-		$marker_any_re = ( $list_type == "ul" ? $marker_ul_re : $marker_ol_re );
1081
+		$marker_any_re = ($list_type == "ul" ? $marker_ul_re : $marker_ol_re);
1082 1082
 
1083 1083
 		$list .= "\n";
1084 1084
 		$result = $this->processListItems($list, $marker_any_re);
@@ -1089,18 +1089,18 @@  discard block
 block discarded – undo
1089 1089
 			if ($list_type == 'ol') {
1090 1090
 				$ol_start_array = array();
1091 1091
 				$ol_start_check = preg_match("/$marker_ol_start_re/", $matches[4], $ol_start_array);
1092
-				if ($ol_start_check){
1092
+				if ($ol_start_check) {
1093 1093
 					$ol_start = $ol_start_array[0];
1094 1094
 				}
1095 1095
 			}
1096 1096
 		}
1097 1097
 
1098
-		if ($ol_start > 1 && $list_type == 'ol'){
1098
+		if ($ol_start > 1 && $list_type == 'ol') {
1099 1099
 			$result = $this->hashBlock("<$list_type start=\"$ol_start\">\n" . $result . "</$list_type>");
1100 1100
 		} else {
1101 1101
 			$result = $this->hashBlock("<$list_type>\n" . $result . "</$list_type>");
1102 1102
 		}
1103
-		return "\n". $result ."\n\n";
1103
+		return "\n" . $result . "\n\n";
1104 1104
 	}
1105 1105
 
1106 1106
 	/**
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
 		$list_str = preg_replace_callback('{
1148 1148
 			(\n)?							# leading line = $1
1149 1149
 			(^[ ]*)							# leading whitespace = $2
1150
-			('.$marker_any_re.'				# list marker and space = $3
1150
+			('.$marker_any_re . '				# list marker and space = $3
1151 1151
 				(?:[ ]+|(?=\n))	# space only required if item is not empty
1152 1152
 			)
1153 1153
 			((?s:.*?))						# list item text   = $4
1154 1154
 			(?:(\n+(?=\n))|\n)				# tailing blank line = $5
1155
-			(?= \n* (\z | \2 ('.$marker_any_re.') (?:[ ]+|(?=\n))))
1155
+			(?= \n* (\z | \2 ('.$marker_any_re . ') (?:[ ]+|(?=\n))))
1156 1156
 			}xm',
1157 1157
 			array($this, '_processListItems_callback'), $list_str);
1158 1158
 
@@ -1167,17 +1167,17 @@  discard block
 block discarded – undo
1167 1167
 	 */
1168 1168
 	protected function _processListItems_callback($matches) {
1169 1169
 		$item = $matches[4];
1170
-		$leading_line =& $matches[1];
1171
-		$leading_space =& $matches[2];
1170
+		$leading_line = & $matches[1];
1171
+		$leading_space = & $matches[2];
1172 1172
 		$marker_space = $matches[3];
1173
-		$tailing_blank_line =& $matches[5];
1173
+		$tailing_blank_line = & $matches[5];
1174 1174
 
1175 1175
 		if ($leading_line || $tailing_blank_line ||
1176 1176
 			preg_match('/\n{2,}/', $item))
1177 1177
 		{
1178 1178
 			// Replace marker with the appropriate whitespace indentation
1179 1179
 			$item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item;
1180
-			$item = $this->runBlockGamut($this->outdent($item)."\n");
1180
+			$item = $this->runBlockGamut($this->outdent($item) . "\n");
1181 1181
 		} else {
1182 1182
 			// Recursion for sub-lists:
1183 1183
 			$item = $this->doLists($this->outdent($item));
@@ -1197,11 +1197,11 @@  discard block
 block discarded – undo
1197 1197
 				(?:\n\n|\A\n?)
1198 1198
 				(	            # $1 = the code block -- one or more lines, starting with a space/tab
1199 1199
 				  (?>
1200
-					[ ]{'.$this->tab_width.'}  # Lines must start with a tab or a tab-width of spaces
1200
+					[ ]{'.$this->tab_width . '}  # Lines must start with a tab or a tab-width of spaces
1201 1201
 					.*\n+
1202 1202
 				  )+
1203 1203
 				)
1204
-				((?=^[ ]{0,'.$this->tab_width.'}\S)|\Z)	# Lookahead for non-space at line-start, or end of doc
1204
+				((?=^[ ]{0,'.$this->tab_width . '}\S)|\Z)	# Lookahead for non-space at line-start, or end of doc
1205 1205
 			}xm',
1206 1206
 			array($this, '_doCodeBlocks_callback'), $text);
1207 1207
 
@@ -1329,8 +1329,8 @@  discard block
 block discarded – undo
1329 1329
 			// Each token is then passed to handleSpanToken.
1330 1330
 			$parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
1331 1331
 			$text_stack[0] .= $parts[0];
1332
-			$token =& $parts[1];
1333
-			$text =& $parts[2];
1332
+			$token = & $parts[1];
1333
+			$text = & $parts[2];
1334 1334
 
1335 1335
 			if (empty($token)) {
1336 1336
 				// Reached end of text span: empty stack without emitting.
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 				} else {
1358 1358
 					// Other closing marker: close one em or strong and
1359 1359
 					// change current token state to match the other
1360
-					$token_stack[0] = str_repeat($token[0], 3-$token_len);
1360
+					$token_stack[0] = str_repeat($token[0], 3 - $token_len);
1361 1361
 					$tag = $token_len == 2 ? "strong" : "em";
1362 1362
 					$span = $text_stack[0];
1363 1363
 					$span = $this->runSpanGamut($span);
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 		}
1704 1704
 
1705 1705
 		$chars = preg_split('/(?<!^)(?!$)/', $text);
1706
-		$seed = (int)abs(crc32($text) / strlen($text)); // Deterministic seed.
1706
+		$seed = (int) abs(crc32($text) / strlen($text)); // Deterministic seed.
1707 1707
 
1708 1708
 		foreach ($chars as $key => $char) {
1709 1709
 			$ord = ord($char);
@@ -1716,9 +1716,9 @@  discard block
 block discarded – undo
1716 1716
 				if ($r > 90 && strpos('@"&>', $char) === false) {
1717 1717
 					/* do nothing */
1718 1718
 				} else if ($r < 45) {
1719
-					$chars[$key] = '&#x'.dechex($ord).';';
1719
+					$chars[$key] = '&#x' . dechex($ord) . ';';
1720 1720
 				} else {
1721
-					$chars[$key] = '&#'.$ord.';';
1721
+					$chars[$key] = '&#' . $ord . ';';
1722 1722
 				}
1723 1723
 			}
1724 1724
 		}
@@ -1740,11 +1740,11 @@  discard block
 block discarded – undo
1740 1740
 
1741 1741
 		$span_re = '{
1742 1742
 				(
1743
-					\\\\'.$this->escape_chars_re.'
1743
+					\\\\'.$this->escape_chars_re . '
1744 1744
 				|
1745 1745
 					(?<![`\\\\])
1746 1746
 					`+						# code span marker
1747
-			'.( $this->no_markup ? '' : '
1747
+			'.($this->no_markup ? '' : '
1748 1748
 				|
1749 1749
 					<!--    .*?     -->		# comment
1750 1750
 				|
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
 					<[-a-zA-Z0-9:_]+\s*/> # xml-style empty tag
1761 1761
 				|
1762 1762
 					</[-a-zA-Z0-9:_]+\s*> # closing tag
1763
-			').'
1763
+			') . '
1764 1764
 				)
1765 1765
 				}xs';
1766 1766
 
@@ -1797,10 +1797,10 @@  discard block
 block discarded – undo
1797 1797
 	protected function handleSpanToken($token, &$str) {
1798 1798
 		switch ($token[0]) {
1799 1799
 			case "\\":
1800
-				return $this->hashPart("&#". ord($token[1]). ";");
1800
+				return $this->hashPart("&#" . ord($token[1]) . ";");
1801 1801
 			case "`":
1802 1802
 				// Search for end marker in remaining text.
1803
-				if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm',
1803
+				if (preg_match('/^(.*?[^`])' . preg_quote($token) . '(?!`)(.*)$/sm',
1804 1804
 					$str, $matches))
1805 1805
 				{
1806 1806
 					$str = $matches[2];
Please login to merge, or discard this patch.
Readme.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
 // you like.
6 6
 
7 7
 // Install PSR-4-compatible class autoloader
8
-spl_autoload_register(function($class){
9
-	require str_replace('\\', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
8
+spl_autoload_register(function($class) {
9
+	require str_replace('\\', DIRECTORY_SEPARATOR, ltrim($class, '\\')) . '.php';
10 10
 });
11 11
 // If using Composer, use this instead:
12 12
 //require 'vendor/autoload.php';
Please login to merge, or discard this patch.
Michelf/MarkdownExtra.php 2 patches
Braces   +42 added lines, -36 removed lines patch added patch discarded remove patch
@@ -170,8 +170,9 @@  discard block
 block discarded – undo
170 170
 		$this->footnotes_assembled = null;
171 171
 
172 172
 		foreach ($this->predef_abbr as $abbr_word => $abbr_desc) {
173
-			if ($this->abbr_word_re)
174
-				$this->abbr_word_re .= '|';
173
+			if ($this->abbr_word_re) {
174
+							$this->abbr_word_re .= '|';
175
+			}
175 176
 			$this->abbr_word_re .= preg_quote($abbr_word);
176 177
 			$this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
177 178
 		}
@@ -188,8 +189,9 @@  discard block
 block discarded – undo
188 189
 		$this->abbr_desciptions = array();
189 190
 		$this->abbr_word_re = '';
190 191
 
191
-		if ( ! $this->omit_footnotes )
192
-			$this->footnotes_assembled = null;
192
+		if ( ! $this->omit_footnotes ) {
193
+					$this->footnotes_assembled = null;
194
+		}
193 195
 
194 196
 		parent::teardown();
195 197
 	}
@@ -239,7 +241,9 @@  discard block
 block discarded – undo
239 241
 			if ($element[0] === '.') {
240 242
 				$classes[] = substr($element, 1);
241 243
 			} else if ($element[0] === '#') {
242
-				if ($id === false) $id = substr($element, 1);
244
+				if ($id === false) {
245
+					$id = substr($element, 1);
246
+				}
243 247
 			} else if (strpos($element, '=') > 0) {
244 248
 				$parts = explode('=', $element, 2);
245 249
 				$attributes[] = $parts[0] . '="' . $parts[1] . '"';
@@ -409,7 +413,9 @@  discard block
 block discarded – undo
409 413
 										$enclosing_tag_re = '', $span = false)
410 414
 	{
411 415
 
412
-		if ($text === '') return array('', '');
416
+		if ($text === '') {
417
+			return array('', '');
418
+		}
413 419
 
414 420
 		// Regex to check for the presense of newlines around a block tag.
415 421
 		$newline_before_re = '/(?:^\n?|\n\n)*$/';
@@ -520,8 +526,7 @@  discard block
 block discarded – undo
520 526
 					// End marker found: pass text unchanged until marker.
521 527
 					$parsed .= $tag . $matches[0];
522 528
 					$text = substr($text, strlen($matches[0]));
523
-				}
524
-				else {
529
+				} else {
525 530
 					// No end marker: just skip it.
526 531
 					$parsed .= $tag;
527 532
 				}
@@ -543,8 +548,7 @@  discard block
 block discarded – undo
543 548
 					// End marker found: pass text unchanged until marker.
544 549
 					$parsed .= $tag . $matches[0];
545 550
 					$text = substr($text, strlen($matches[0]));
546
-				}
547
-				else {
551
+				} else {
548 552
 					// Unmatched marker: just skip it.
549 553
 					$parsed .= $tag;
550 554
 				}
@@ -597,8 +601,7 @@  discard block
 block discarded – undo
597 601
 				}
598 602
 
599 603
 				$parsed .= $tag;
600
-			}
601
-			else {
604
+			} else {
602 605
 				$parsed .= $tag;
603 606
 			}
604 607
 			// @phpstan-ignore-next-line
@@ -622,7 +625,9 @@  discard block
 block discarded – undo
622 625
 	 * @return array
623 626
 	 */
624 627
 	protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
625
-		if ($text === '') return array('', '');
628
+		if ($text === '') {
629
+			return array('', '');
630
+		}
626 631
 
627 632
 		// Regex to match `markdown` attribute inside of a tag.
628 633
 		$markdown_attr_re = '
@@ -672,8 +677,9 @@  discard block
 block discarded – undo
672 677
 
673 678
 		// Get the name of the starting tag.
674 679
 		// (This pattern makes $base_tag_name_re safe without quoting.)
675
-		if (preg_match('/^<([\w:$]*)\b/', $text, $matches))
676
-			$base_tag_name_re = $matches[1];
680
+		if (preg_match('/^<([\w:$]*)\b/', $text, $matches)) {
681
+					$base_tag_name_re = $matches[1];
682
+		}
677 683
 
678 684
 		// Loop through every tag until we find the corresponding closing tag.
679 685
 		do {
@@ -702,8 +708,7 @@  discard block
 block discarded – undo
702 708
 			{
703 709
 				// Just add the tag to the block as if it was text.
704 710
 				$block_text .= $tag;
705
-			}
706
-			else {
711
+			} else {
707 712
 				// Increase/decrease nested tag count. Only do so if
708 713
 				// the tag's name match base tag's.
709 714
 				if (preg_match('{^</?' . $base_tag_name_re . '\b}', $tag)) {
@@ -764,8 +769,9 @@  discard block
 block discarded – undo
764 769
 
765 770
 					// Start over with a new block.
766 771
 					$block_text = "";
772
+				} else {
773
+					$block_text .= $tag;
767 774
 				}
768
-				else $block_text .= $tag;
769 775
 			}
770 776
 
771 777
 		} while ($depth > 0);
@@ -886,14 +892,14 @@  discard block
 block discarded – undo
886 892
 				$title = $this->encodeAttribute($title);
887 893
 				$result .=  " title=\"$title\"";
888 894
 			}
889
-			if (isset($this->ref_attr[$link_id]))
890
-				$result .= $this->ref_attr[$link_id];
895
+			if (isset($this->ref_attr[$link_id])) {
896
+							$result .= $this->ref_attr[$link_id];
897
+			}
891 898
 
892 899
 			$link_text = $this->runSpanGamut($link_text);
893 900
 			$result .= ">$link_text</a>";
894 901
 			$result = $this->hashPart($result);
895
-		}
896
-		else {
902
+		} else {
897 903
 			$result = $whole_match;
898 904
 		}
899 905
 		return $result;
@@ -914,8 +920,9 @@  discard block
 block discarded – undo
914 920
 		// if the URL was of the form <s p a c e s> it got caught by the HTML
915 921
 		// tag parser and hashed. Need to reverse the process before using the URL.
916 922
 		$unhashed = $this->unhash($url);
917
-		if ($unhashed !== $url)
918
-			$url = preg_replace('/^<(.*)>$/', '\1', $unhashed);
923
+		if ($unhashed !== $url) {
924
+					$url = preg_replace('/^<(.*)>$/', '\1', $unhashed);
925
+		}
919 926
 
920 927
 		$url = $this->encodeURLAttribute($url);
921 928
 
@@ -1015,8 +1022,7 @@  discard block
 block discarded – undo
1015 1022
 			}
1016 1023
 			$result .= $this->empty_element_suffix;
1017 1024
 			$result = $this->hashPart($result);
1018
-		}
1019
-		else {
1025
+		} else {
1020 1026
 			// If there's no such link ID, leave intact:
1021 1027
 			$result = $whole_match;
1022 1028
 		}
@@ -1233,14 +1239,15 @@  discard block
 block discarded – undo
1233 1239
 		// Reading alignement from header underline.
1234 1240
 		$separators	= preg_split('/ *[|] */', $underline);
1235 1241
 		foreach ($separators as $n => $s) {
1236
-			if (preg_match('/^ *-+: *$/', $s))
1237
-				$attr[$n] = $this->_doTable_makeAlignAttr('right');
1238
-			else if (preg_match('/^ *:-+: *$/', $s))
1239
-				$attr[$n] = $this->_doTable_makeAlignAttr('center');
1240
-			else if (preg_match('/^ *:-+ *$/', $s))
1241
-				$attr[$n] = $this->_doTable_makeAlignAttr('left');
1242
-			else
1243
-				$attr[$n] = '';
1242
+			if (preg_match('/^ *-+: *$/', $s)) {
1243
+							$attr[$n] = $this->_doTable_makeAlignAttr('right');
1244
+			} else if (preg_match('/^ *:-+: *$/', $s)) {
1245
+							$attr[$n] = $this->_doTable_makeAlignAttr('center');
1246
+			} else if (preg_match('/^ *:-+ *$/', $s)) {
1247
+							$attr[$n] = $this->_doTable_makeAlignAttr('left');
1248
+			} else {
1249
+							$attr[$n] = '';
1250
+			}
1244 1251
 		}
1245 1252
 
1246 1253
 		// Parsing span elements, including code spans, character escapes,
@@ -1423,8 +1430,7 @@  discard block
 block discarded – undo
1423 1430
 			$def = str_repeat(' ', strlen($marker_space)) . $def;
1424 1431
 			$def = $this->runBlockGamut($this->outdent($def . "\n\n"));
1425 1432
 			$def = "\n". $def ."\n";
1426
-		}
1427
-		else {
1433
+		} else {
1428 1434
 			$def = rtrim($def);
1429 1435
 			$def = $this->runSpanGamut($this->outdent($def));
1430 1436
 		}
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$this->abbr_desciptions = array();
189 189
 		$this->abbr_word_re = '';
190 190
 
191
-		if ( ! $this->omit_footnotes )
191
+		if (!$this->omit_footnotes)
192 192
 			$this->footnotes_assembled = null;
193 193
 
194 194
 		parent::teardown();
@@ -259,17 +259,17 @@  discard block
 block discarded – undo
259 259
 		// Compose attributes as string
260 260
 		$attr_str = "";
261 261
 		if (!empty($id)) {
262
-			$attr_str .= ' id="'.$this->encodeAttribute($id) .'"';
262
+			$attr_str .= ' id="' . $this->encodeAttribute($id) . '"';
263 263
 			// make specified tags focusable for assistive technologies anchor targets
264 264
 			if ($this->id_focusable_tags_re && preg_match($this->id_focusable_tags_re, $tag_name)) {
265 265
 				$attr_str .= ' tabindex="-1"';
266 266
 			}
267 267
 		}
268 268
 		if (!empty($classes)) {
269
-			$attr_str .= ' class="'. implode(" ", $classes) . '"';
269
+			$attr_str .= ' class="' . implode(" ", $classes) . '"';
270 270
 		}
271 271
 		if (!$this->no_markup && !empty($attributes)) {
272
-			$attr_str .= ' '.implode(" ", $attributes);
272
+			$attr_str .= ' ' . implode(" ", $attributes);
273 273
 		}
274 274
 		return $attr_str;
275 275
 	}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
 		// Link defs are in the form: ^[id]: url "optional title"
287 287
 		$text = preg_replace_callback('{
288
-							^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?:	# id = $1
288
+							^[ ]{0,'.$less_than_tab . '}\[(.+)\][ ]?:	# id = $1
289 289
 							  [ ]*
290 290
 							  \n?				# maybe *one* newline
291 291
 							  [ ]*
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 								[")]
305 305
 								[ ]*
306 306
 							)?	# title is optional
307
-					(?:[ ]* '.$this->id_class_attr_catch_re.' )?  # $5 = extra id & class attr
307
+					(?:[ ]* '.$this->id_class_attr_catch_re . ' )?  # $5 = extra id & class attr
308 308
 							(?:\n+|\Z)
309 309
 			}xm',
310 310
 			array($this, '_stripLinkDefinitions_callback'),
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 		$link_id = strtolower($matches[1]);
322 322
 		$url = $matches[2] == '' ? $matches[3] : $matches[2];
323 323
 		$this->urls[$link_id] = $url;
324
-		$this->titles[$link_id] =& $matches[4];
325
-		$this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy =& $matches[5]);
324
+		$this->titles[$link_id] = & $matches[4];
325
+		$this->ref_attr[$link_id] = $this->doExtraAttributes("", $dummy = & $matches[5]);
326 326
 		return ''; // String that will replace the block
327 327
 	}
328 328
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		}
380 380
 
381 381
 		// Call the HTML-in-Markdown hasher.
382
-		list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text);
382
+		list($text,) = $this->_hashHTMLBlocks_inMarkdown($text);
383 383
 
384 384
 		return $text;
385 385
 	}
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 					<\?.*?\?> | <%.*?%>	# Processing instruction
457 457
 				|
458 458
 					<!\[CDATA\[.*?\]\]>	# CData Block
459
-				' . ( !$span ? ' # If not in span.
459
+				' . (!$span ? ' # If not in span.
460 460
 				|
461 461
 					# Indented code block
462 462
 					(?: ^[ ]*\n | ^ | \n[ ]*\n )
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 					(?: ' . $this->id_class_attr_nocatch_re . ' )? # extra attributes
475 475
 					[ ]*
476 476
 					(?= \n )
477
-				' : '' ) . ' # End (if not is span).
477
+				' : '') . ' # End (if not is span).
478 478
 				|
479 479
 					# Code span marker
480 480
 					# Note, this regex needs to go after backtick fenced
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
 			}xs';
486 486
 
487 487
 
488
-		$depth = 0;		// Current depth inside the tag tree.
489
-		$parsed = "";	// Parsed text that will be returned.
488
+		$depth = 0; // Current depth inside the tag tree.
489
+		$parsed = ""; // Parsed text that will be returned.
490 490
 
491 491
 		// Loop through every tag until we find the closing tag of the parent
492 492
 		// or loop until reaching the end of text if no parent tag specified.
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 			//            Opening Context Block tag (like ins and del)
564 564
 			//               used as a block tag (tag is alone on it's line).
565 565
 			else if (preg_match('{^<(?:' . $this->block_tags_re . ')\b}', $tag) ||
566
-				(	preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) &&
566
+				(preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) &&
567 567
 					preg_match($newline_before_re, $parsed) &&
568
-					preg_match($newline_after_re, $text)	)
568
+					preg_match($newline_after_re, $text))
569 569
 				)
570 570
 			{
571 571
 				// Need to parse tag and following text using the HTML parser.
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 				// Increase/decrease nested tag count.
596 596
 				if ($tag[1] === '/') {
597 597
 					$depth--;
598
-				} else if ($tag[strlen($tag)-2] !== '/') {
598
+				} else if ($tag[strlen($tag) - 2] !== '/') {
599 599
 					$depth++;
600 600
 				}
601 601
 
@@ -673,11 +673,11 @@  discard block
 block discarded – undo
673 673
 				)
674 674
 			}xs';
675 675
 
676
-		$original_text = $text;		// Save original text in case of faliure.
676
+		$original_text = $text; // Save original text in case of faliure.
677 677
 
678
-		$depth		= 0;	// Current depth inside the tag tree.
679
-		$block_text	= "";	// Temporary text holder for current text.
680
-		$parsed		= "";	// Parsed text that will be returned.
678
+		$depth = 0; // Current depth inside the tag tree.
679
+		$block_text = ""; // Temporary text holder for current text.
680
+		$parsed = ""; // Parsed text that will be returned.
681 681
 		$base_tag_name_re = '';
682 682
 
683 683
 		// Get the name of the starting tag.
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 				if (preg_match('{^</?' . $base_tag_name_re . '\b}', $tag)) {
720 720
 					if ($tag[1] === '/') {
721 721
 						$depth--;
722
-					} else if ($tag[strlen($tag)-2] !== '/') {
722
+					} else if ($tag[strlen($tag) - 2] !== '/') {
723 723
 						$depth++;
724 724
 					}
725 725
 				}
@@ -873,9 +873,9 @@  discard block
 block discarded – undo
873 873
 	 * @return string
874 874
 	 */
875 875
 	protected function _doAnchors_reference_callback($matches) {
876
-		$whole_match =  $matches[1];
877
-		$link_text   =  $matches[2];
878
-		$link_id     =& $matches[3];
876
+		$whole_match = $matches[1];
877
+		$link_text   = $matches[2];
878
+		$link_id     = & $matches[3];
879 879
 
880 880
 		if ($link_id == "") {
881 881
 			// for shortcut links like [this][] or [this].
@@ -891,10 +891,10 @@  discard block
 block discarded – undo
891 891
 			$url = $this->encodeURLAttribute($url);
892 892
 
893 893
 			$result = "<a href=\"$url\"";
894
-			if ( isset( $this->titles[$link_id] ) ) {
894
+			if (isset($this->titles[$link_id])) {
895 895
 				$title = $this->titles[$link_id];
896 896
 				$title = $this->encodeAttribute($title);
897
-				$result .=  " title=\"$title\"";
897
+				$result .= " title=\"$title\"";
898 898
 			}
899 899
 			if (isset($this->ref_attr[$link_id]))
900 900
 				$result .= $this->ref_attr[$link_id];
@@ -915,11 +915,11 @@  discard block
 block discarded – undo
915 915
 	 * @return string
916 916
 	 */
917 917
 	protected function _doAnchors_inline_callback($matches) {
918
-		$link_text		=  $this->runSpanGamut($matches[2]);
919
-		$url			=  $matches[3] === '' ? $matches[4] : $matches[3];
920
-		$title_quote		=& $matches[6];
921
-		$title			=& $matches[7];
922
-		$attr  = $this->doExtraAttributes("a", $dummy =& $matches[8]);
918
+		$link_text = $this->runSpanGamut($matches[2]);
919
+		$url			= $matches[3] === '' ? $matches[4] : $matches[3];
920
+		$title_quote = & $matches[6];
921
+		$title = & $matches[7];
922
+		$attr  = $this->doExtraAttributes("a", $dummy = & $matches[8]);
923 923
 
924 924
 		// if the URL was of the form <s p a c e s> it got caught by the HTML
925 925
 		// tag parser and hashed. Need to reverse the process before using the URL.
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 		$result = "<a href=\"$url\"";
933 933
 		if (isset($title) && $title_quote) {
934 934
 			$title = $this->encodeAttribute($title);
935
-			$result .=  " title=\"$title\"";
935
+			$result .= " title=\"$title\"";
936 936
 		}
937 937
 		$result .= $attr;
938 938
 
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 			if (isset($this->titles[$link_id])) {
1019 1019
 				$title = $this->titles[$link_id];
1020 1020
 				$title = $this->encodeAttribute($title);
1021
-				$result .=  " title=\"$title\"";
1021
+				$result .= " title=\"$title\"";
1022 1022
 			}
1023 1023
 			if (isset($this->ref_attr[$link_id])) {
1024 1024
 				$result .= $this->ref_attr[$link_id];
@@ -1040,18 +1040,18 @@  discard block
 block discarded – undo
1040 1040
 	 * @return string
1041 1041
 	 */
1042 1042
 	protected function _doImages_inline_callback($matches) {
1043
-		$alt_text		= $matches[2];
1043
+		$alt_text = $matches[2];
1044 1044
 		$url			= $matches[3] === '' ? $matches[4] : $matches[3];
1045
-		$title_quote		=& $matches[6];
1046
-		$title			=& $matches[7];
1047
-		$attr  = $this->doExtraAttributes("img", $dummy =& $matches[8]);
1045
+		$title_quote = & $matches[6];
1046
+		$title = & $matches[7];
1047
+		$attr  = $this->doExtraAttributes("img", $dummy = & $matches[8]);
1048 1048
 
1049 1049
 		$alt_text = $this->encodeAttribute($alt_text);
1050 1050
 		$url = $this->encodeURLAttribute($url);
1051 1051
 		$result = "<img src=\"$url\" alt=\"$alt_text\"";
1052 1052
 		if (isset($title) && $title_quote) {
1053 1053
 			$title = $this->encodeAttribute($title);
1054
-			$result .=  " title=\"$title\""; // $title already quoted
1054
+			$result .= " title=\"$title\""; // $title already quoted
1055 1055
 		}
1056 1056
 		$result .= $attr;
1057 1057
 		$result .= $this->empty_element_suffix;
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 		//
1090 1090
 		$text = preg_replace_callback('{
1091 1091
 				^(\#{1,6})	# $1 = string of #\'s
1092
-				[ ]'.($this->hashtag_protection ? '+' : '*').'
1092
+				[ ]'.($this->hashtag_protection ? '+' : '*') . '
1093 1093
 				(.+?)		# $2 = Header text
1094 1094
 				[ ]*
1095 1095
 				\#*			# optional closing #\'s (not counted)
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
 		$defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null;
1118 1118
 
1119
-		$attr  = $this->doExtraAttributes("h$level", $dummy =& $matches[2], $defaultId);
1119
+		$attr  = $this->doExtraAttributes("h$level", $dummy = & $matches[2], $defaultId);
1120 1120
 		$block = "<h$level$attr>" . $this->runSpanGamut($matches[1]) . "</h$level>";
1121 1121
 		return "\n" . $this->hashBlock($block) . "\n\n";
1122 1122
 	}
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 		$level = strlen($matches[1]);
1131 1131
 
1132 1132
 		$defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[2]) : null;
1133
-		$attr  = $this->doExtraAttributes("h$level", $dummy =& $matches[3], $defaultId);
1133
+		$attr  = $this->doExtraAttributes("h$level", $dummy = & $matches[3], $defaultId);
1134 1134
 		$block = "<h$level$attr>" . $this->runSpanGamut($matches[2]) . "</h$level>";
1135 1135
 		return "\n" . $this->hashBlock($block) . "\n\n";
1136 1136
 	}
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 						[|] .* \n			# Row content.
1165 1165
 					)*
1166 1166
 				)
1167
-				('.$this->id_class_attr_catch_re.')?	 # $4 = id/class attributes
1167
+				('.$this->id_class_attr_catch_re . ')?	 # $4 = id/class attributes
1168 1168
 				(?=\n|\Z)					# Stop at final double newline.
1169 1169
 			}xm',
1170 1170
 			array($this, '_doTable_leadingPipe_callback'), $text);
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
 						.* [|] .* \n		# Row content
1190 1190
 					)*
1191 1191
 				)
1192
-				('.$this->id_class_attr_catch_re.')?	 # $4 = id/class attributes
1192
+				('.$this->id_class_attr_catch_re . ')?	 # $4 = id/class attributes
1193 1193
 				(?=\n|\Z)					# Stop at final double newline.
1194 1194
 			}xm',
1195 1195
 			array($this, '_DoTable_callback'), $text);
@@ -1203,10 +1203,10 @@  discard block
 block discarded – undo
1203 1203
 	 * @return string
1204 1204
 	 */
1205 1205
 	protected function _doTable_leadingPipe_callback($matches) {
1206
-		$head		= $matches[1];
1207
-		$underline	= $matches[2];
1206
+		$head = $matches[1];
1207
+		$underline = $matches[2];
1208 1208
 		$content	= $matches[3];
1209
-		$id_class	= $matches[4] ?? null;
1209
+		$id_class = $matches[4] ?? null;
1210 1210
 
1211 1211
 		$content	= preg_replace('/^ *[|]/m', '', $content);
1212 1212
 
@@ -1233,16 +1233,16 @@  discard block
 block discarded – undo
1233 1233
 	 * @return string
1234 1234
 	 */
1235 1235
 	protected function _doTable_callback($matches) {
1236
-		$head		= $matches[1];
1237
-		$underline	= $matches[2];
1238
-		$content	= $matches[3];
1239
-		$id_class	= $matches[4] ?? null;
1236
+		$head = $matches[1];
1237
+		$underline = $matches[2];
1238
+		$content = $matches[3];
1239
+		$id_class = $matches[4] ?? null;
1240 1240
 		$attr		= [];
1241 1241
 
1242 1242
 		// Remove any tailing pipes for each line.
1243 1243
 		$head		= preg_replace('/[|] *$/m', '', $head);
1244
-		$underline	= preg_replace('/[|] *$/m', '', $underline);
1245
-		$content	= preg_replace('/[|] *$/m', '', $content);
1244
+		$underline = preg_replace('/[|] *$/m', '', $underline);
1245
+		$content = preg_replace('/[|] *$/m', '', $content);
1246 1246
 
1247 1247
 		// Reading alignement from header underline.
1248 1248
 		$separators	= preg_split('/ *[|] */', $underline);
@@ -1259,10 +1259,10 @@  discard block
 block discarded – undo
1259 1259
 
1260 1260
 		// Parsing span elements, including code spans, character escapes,
1261 1261
 		// and inline HTML tags, so that pipes inside those gets ignored.
1262
-		$head		= $this->parseSpan($head);
1263
-		$headers	= preg_split('/ *[|] */', $head);
1264
-		$col_count	= count($headers);
1265
-		$attr       = array_pad($attr, $col_count, '');
1262
+		$head = $this->parseSpan($head);
1263
+		$headers = preg_split('/ *[|] */', $head);
1264
+		$col_count = count($headers);
1265
+		$attr = array_pad($attr, $col_count, '');
1266 1266
 
1267 1267
 		// Write column headers.
1268 1268
 		$table_attr_str = $this->doExtraAttributes('table', $id_class, null, []);
@@ -1431,13 +1431,13 @@  discard block
 block discarded – undo
1431 1431
 	protected function _processDefListItems_callback_dd($matches) {
1432 1432
 		$leading_line	= $matches[1];
1433 1433
 		$marker_space	= $matches[2];
1434
-		$def			= $matches[3];
1434
+		$def = $matches[3];
1435 1435
 
1436 1436
 		if ($leading_line || preg_match('/\n{2,}/', $def)) {
1437 1437
 			// Replace marker with the appropriate whitespace indentation
1438 1438
 			$def = str_repeat(' ', strlen($marker_space)) . $def;
1439 1439
 			$def = $this->runBlockGamut($this->outdent($def . "\n\n"));
1440
-			$def = "\n". $def ."\n";
1440
+			$def = "\n" . $def . "\n";
1441 1441
 		}
1442 1442
 		else {
1443 1443
 			$def = rtrim($def);
@@ -1497,8 +1497,8 @@  discard block
 block discarded – undo
1497 1497
 	 * @return string
1498 1498
 	 */
1499 1499
 	protected function _doFencedCodeBlocks_callback($matches) {
1500
-		$classname =& $matches[2];
1501
-		$attrs     =& $matches[3];
1500
+		$classname = & $matches[2];
1501
+		$attrs     = & $matches[3];
1502 1502
 		$codeblock = $matches[4];
1503 1503
 
1504 1504
 		if ($this->code_block_content_func) {
@@ -1520,9 +1520,9 @@  discard block
 block discarded – undo
1520 1520
 		$attr_str = $this->doExtraAttributes($this->code_attr_on_pre ? "pre" : "code", $attrs, null, $classes);
1521 1521
 		$pre_attr_str  = $this->code_attr_on_pre ? $attr_str : '';
1522 1522
 		$code_attr_str = $this->code_attr_on_pre ? '' : $attr_str;
1523
-		$codeblock  = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>";
1523
+		$codeblock = "<pre$pre_attr_str><code$code_attr_str>$codeblock</code></pre>";
1524 1524
 
1525
-		return "\n\n".$this->hashBlock($codeblock)."\n\n";
1525
+		return "\n\n" . $this->hashBlock($codeblock) . "\n\n";
1526 1526
 	}
1527 1527
 
1528 1528
 	/**
@@ -1655,9 +1655,9 @@  discard block
 block discarded – undo
1655 1655
 		$text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}',
1656 1656
 			array($this, '_appendFootnotes_callback'), $text);
1657 1657
 
1658
-		if ( ! empty( $this->footnotes_ordered ) ) {
1658
+		if (!empty($this->footnotes_ordered)) {
1659 1659
 			$this->_doFootnotes();
1660
-			if ( ! $this->omit_footnotes ) {
1660
+			if (!$this->omit_footnotes) {
1661 1661
 				$text .= "\n\n";
1662 1662
 				$text .= "<div class=\"footnotes\" role=\"doc-endnotes\">\n";
1663 1663
 				$text .= "<hr" . $this->empty_element_suffix . "\n";
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 		// Create footnote marker only if it has a corresponding footnote *and*
1758 1758
 		// the footnote hasn't been used by another marker.
1759 1759
 		if (isset($this->footnotes[$node_id])) {
1760
-			$num =& $this->footnotes_numbers[$node_id];
1760
+			$num = & $this->footnotes_numbers[$node_id];
1761 1761
 			if (!isset($num)) {
1762 1762
 				// Transfer footnote content to the ordered list and give it its
1763 1763
 				// number
@@ -1786,8 +1786,8 @@  discard block
 block discarded – undo
1786 1786
 			$node_id = $this->encodeAttribute($node_id);
1787 1787
 
1788 1788
 			return
1789
-				"<sup id=\"fnref$ref_count_mark:$node_id\">".
1790
-				"<a href=\"#fn:$node_id\"$attr>$num</a>".
1789
+				"<sup id=\"fnref$ref_count_mark:$node_id\">" .
1790
+				"<a href=\"#fn:$node_id\"$attr>$num</a>" .
1791 1791
 				"</sup>";
1792 1792
 		}
1793 1793
 
Please login to merge, or discard this patch.