Completed
Push — master ( 6247dd...e88f06 )
by Peter
07:34
created

MoreLikeThisDecorator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 30
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A decorate() 0 14 2
A getKind() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: peter
5
 * Date: 30.05.18
6
 * Time: 13:34
7
 */
8
9
namespace Maslosoft\Manganel\Decorators\QueryBuilder;
10
11
use Maslosoft\Manganel\Helpers\TypeNamer;
12
use Maslosoft\Manganel\Interfaces\ManganelAwareInterface;
13
use Maslosoft\Manganel\Interfaces\QueryBuilder\ConditionDecoratorInterface;
14
use Maslosoft\Manganel\Manganel;
15
use Maslosoft\Manganel\SearchCriteria;
16
use Maslosoft\Manganel\Traits\ManganelAwareTrait;
17
18
class MoreLikeThisDecorator implements ConditionDecoratorInterface,
19
	ManganelAwareInterface
20
21
{
22
	use ManganelAwareTrait;
23
24
	const Ns = __NAMESPACE__;
25
26 71
	public function decorate(&$conditions, SearchCriteria $criteria)
27
	{
28 71
		$mlt = $criteria->getMoreLike();
29 71
		if (empty($mlt))
30
		{
31 71
			return;
32
		}
33
34
		$conditions = [
35
			[
36 1
				'more_like_this' => $mlt->toArray()
37
			]
38
		];
39 1
	}
40
41 1
	public function getKind()
42
	{
43 1
		return self::KindShould;
44
	}
45
46
47
}