Completed
Push — master ( c82149...1de3af )
by Peter
04:41
created

SelfKeywordDecorator::decorate()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 2
crap 3
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: peter
5
 * Date: 01.02.18
6
 * Time: 15:28
7
 */
8
9
namespace Maslosoft\Addendum\Plugins\Matcher;
10
11
12
use Maslosoft\Addendum\Interfaces\Matcher\MatcherInterface;
13
use Maslosoft\Addendum\Interfaces\Plugins\Matcher\MatcherDecoratorInterface;
14
use Maslosoft\Addendum\Utilities\ReflectionHelper;
15
16
class SelfKeywordDecorator implements MatcherDecoratorInterface
17
{
18
19 19
	public function decorate(MatcherInterface $matcher, &$value)
20
	{
21 19
		if($value === 'self' || $value === 'static')
22
		{
23 5
			$reflection = ReflectionHelper::getReflectionClass($matcher->getPlugins()->reflection);
24 5
			$value = $reflection->name;
25
		}
26
	}
27
}