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

MagicConstantDecorator::decorate()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3.0261

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 6
cts 7
cp 0.8571
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 2
crap 3.0261
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: peter
5
 * Date: 01.02.18
6
 * Time: 15:58
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
15
class MagicConstantDecorator implements MatcherDecoratorInterface
16
{
17
18 6
	public function decorate(MatcherInterface $matcher, &$value)
19
	{
20 6
		if(strpos($value, '::class') !== false)
21
		{
22 2
			$parts = explode('::', $value);
23 2
			if(count($parts) !== 2)
24
			{
25
				return;
26
			}
27
28 2
			$value = $parts[0];
29
		}
30
	}
31
}