Completed
Push — master ( cecf55...cf79c6 )
by Josh
10:46
created

Unformatted::renderRichText()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
* @package   s9e\TextFormatter
5
* @copyright Copyright (c) 2010-2017 The s9e Authors
6
* @license   http://www.opensource.org/licenses/mit-license.php The MIT License
7
*/
8
namespace s9e\TextFormatter\Renderers;
9
10
use s9e\TextFormatter\Renderer;
11
12
/**
13
* This renderer returns a plain text version of rich text. It is meant to be used as a last resort
14
* when every other renderer is unavailable
15
*/
16
class Unformatted extends Renderer
17
{
18
	/**
19
	* {@inheritdoc}
20
	*/
21 4
	protected function renderRichText($xml)
22
	{
23 4
		return str_replace("\n", "<br>\n", htmlspecialchars(strip_tags($xml), ENT_COMPAT, 'UTF-8', false));
24
	}
25
}