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

MoreLikeThisDecorator::getKind()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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
}