AnnotationRemover   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A decorate() 0 7 1
1
<?php
2
3
/**
4
 * This software package is licensed under `AGPL, Commercial` license[s].
5
 *
6
 * @package maslosoft/zamm
7
 * @license AGPL, Commercial
8
 *
9
 * @copyright Copyright (c) Peter Maselkowski <[email protected]>
10
 * @link https://maslosoft.com/zamm/
11
 */
12
13
namespace Maslosoft\Zamm\Decorators;
14
15
use Maslosoft\Zamm\Helpers\FenceHolder;
16
use Maslosoft\Zamm\Interfaces\Decorators\RendererDecoratorInterface;
17
18
/**
19
 * This removes annotations. This means everything starting with `@` and capital letter.
20
 *
21
 * This will prevent annotations surrounded by fences (triple `).
22
 *
23
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
24
 */
25
class AnnotationRemover extends RendererDecorator implements RendererDecoratorInterface
26
{
27
28
	public function decorate(&$docComment)
29
	{
30
		$holder = new FenceHolder();
31
		$holder->hide($docComment);
32
		$docComment = preg_replace('~^@[A-Z].+$~m', '', $docComment);
33
		$holder->reveal($docComment);
34
	}
35
36
}
37