Code Duplication    Length = 10-10 lines in 4 locations

inline/LinkTrait.php 2 locations

@@ 220-229 (lines=10) @@
217
218
	protected function renderLink($block)
219
	{
220
		if (isset($block['refkey'])) {
221
			if (($ref = $this->lookupReference($block['refkey'])) !== false) {
222
				$block = array_merge($block, $ref);
223
			} else {
224
				if (strncmp($block['orig'], '[', 1) === 0) {
225
					return '[' . $this->renderAbsy($this->parseInline(substr($block['orig'], 1)));
226
				}
227
				return $block['orig'];
228
			}
229
		}
230
		return '<a href="' . htmlspecialchars($block['url'], ENT_COMPAT | ENT_HTML401, 'UTF-8') . '"'
231
			. (empty($block['title']) ? '' : ' title="' . htmlspecialchars($block['title'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, 'UTF-8') . '"')
232
			. '>' . $this->renderAbsy($block['text']) . '</a>';
@@ 237-246 (lines=10) @@
234
235
	protected function renderImage($block)
236
	{
237
		if (isset($block['refkey'])) {
238
			if (($ref = $this->lookupReference($block['refkey'])) !== false) {
239
				$block = array_merge($block, $ref);
240
			} else {
241
				if (strncmp($block['orig'], '![', 2) === 0) {
242
					return '![' . $this->renderAbsy($this->parseInline(substr($block['orig'], 2)));
243
				}
244
				return $block['orig'];
245
			}
246
		}
247
		return '<img src="' . htmlspecialchars($block['url'], ENT_COMPAT | ENT_HTML401, 'UTF-8') . '"'
248
			. ' alt="' . htmlspecialchars($block['text'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, 'UTF-8') . '"'
249
			. (empty($block['title']) ? '' : ' title="' . htmlspecialchars($block['title'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, 'UTF-8') . '"')

MarkdownExtra.php 2 locations

@@ 222-231 (lines=10) @@
219
220
	protected function renderLink($block)
221
	{
222
		if (isset($block['refkey'])) {
223
			if (($ref = $this->lookupReference($block['refkey'])) !== false) {
224
				$block = array_merge($block, $ref);
225
			} else {
226
				if (strncmp($block['orig'], '[', 1) === 0) {
227
					return '[' . $this->renderAbsy($this->parseInline(substr($block['orig'], 1)));
228
				}
229
				return $block['orig'];
230
			}
231
		}
232
		$attributes = $this->renderAttributes($block);
233
		return '<a href="' . htmlspecialchars($block['url'], ENT_COMPAT | ENT_HTML401, 'UTF-8') . '"'
234
			. (empty($block['title']) ? '' : ' title="' . htmlspecialchars($block['title'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, 'UTF-8') . '"')
@@ 240-249 (lines=10) @@
237
238
	protected function renderImage($block)
239
	{
240
		if (isset($block['refkey'])) {
241
			if (($ref = $this->lookupReference($block['refkey'])) !== false) {
242
				$block = array_merge($block, $ref);
243
			} else {
244
				if (strncmp($block['orig'], '![', 2) === 0) {
245
					return '![' . $this->renderAbsy($this->parseInline(substr($block['orig'], 2)));
246
				}
247
				return $block['orig'];
248
			}
249
		}
250
		$attributes = $this->renderAttributes($block);
251
		return '<img src="' . htmlspecialchars($block['url'], ENT_COMPAT | ENT_HTML401, 'UTF-8') . '"'
252
			. ' alt="' . htmlspecialchars($block['text'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, 'UTF-8') . '"'