Headers   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 8 2
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