Code Duplication    Length = 27-28 lines in 2 locations

Sources/Subs-Editor.php 2 locations

@@ 1155-1182 (lines=28) @@
1152
				continue;
1153
1154
			// Special case: inside [code] blocks any code is left untouched.
1155
			elseif ($tag === 'code')
1156
			{
1157
				// We're inside a code block and closing it.
1158
				if ($inCode && $isClosingTag)
1159
				{
1160
					$inCode = false;
1161
1162
					// Reopen tags that were closed before the code block.
1163
					if (!empty($inlineElements))
1164
						$parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']';
1165
				}
1166
1167
				// We're outside a coding and nobbc block and opening it.
1168
				elseif (!$inCode && !$inNoBbc && $isOpeningTag)
1169
				{
1170
					// If there are still inline elements left open, close them now.
1171
					if (!empty($inlineElements))
1172
					{
1173
						$parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']';
1174
						//$inlineElements = array();
1175
					}
1176
1177
					$inCode = true;
1178
				}
1179
1180
				// Nothing further to do.
1181
				continue;
1182
			}
1183
1184
			// Special case: inside [nobbc] blocks any BBC is left untouched.
1185
			elseif ($tag === 'nobbc')
@@ 1185-1211 (lines=27) @@
1182
			}
1183
1184
			// Special case: inside [nobbc] blocks any BBC is left untouched.
1185
			elseif ($tag === 'nobbc')
1186
			{
1187
				// We're inside a nobbc block and closing it.
1188
				if ($inNoBbc && $isClosingTag)
1189
				{
1190
					$inNoBbc = false;
1191
1192
					// Some inline elements might've been closed that need reopening.
1193
					if (!empty($inlineElements))
1194
						$parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']';
1195
				}
1196
1197
				// We're outside a nobbc and coding block and opening it.
1198
				elseif (!$inNoBbc && !$inCode && $isOpeningTag)
1199
				{
1200
					// Can't have inline elements still opened.
1201
					if (!empty($inlineElements))
1202
					{
1203
						$parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']';
1204
						//$inlineElements = array();
1205
					}
1206
1207
					$inNoBbc = true;
1208
				}
1209
1210
				continue;
1211
			}
1212
1213
			// So, we're inside one of the special blocks: ignore any tag.
1214
			elseif ($inCode || $inNoBbc)