Headers::transform()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
/**
3
 * Class Headers
4
 *
5
 * @filesource   ${FILE_NAME}
6
 * @created      25.04.2018
7
 * @package      chillerlan\BBCode\Output\Markdown
8
 * @author       smiley <[email protected]>
9
 * @copyright    2018 smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\BBCode\Output\Markdown;
14
15
class Headers extends MarkdownModuleAbstract{
16
17
	/**
18
	 * @var array
19
	 */
20
	protected $tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
21
22
	/**
23
	 * @return string
24
	 */
25
	protected function transform():string{
26
27
		if(empty($this->content)){
28
			return '';
29
		}
30
31
		return str_repeat('#', (int)str_replace('h', '', $this->tag)).' '.$this->content.PHP_EOL;
32
	}
33
34
}
35