MoreLikeThisDecorator::getKind()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * This software package is licensed under `AGPL-3.0-only, proprietary` license[s].
5
 *
6
 * @package maslosoft/manganel
7
 * @license AGPL-3.0-only, proprietary
8
 *
9
 * @copyright Copyright (c) Peter Maselkowski <[email protected]>
10
 * @link https://maslosoft.com/manganel/
11
 */
12
13
namespace Maslosoft\Manganel\Decorators\QueryBuilder;
14
15
use Maslosoft\Manganel\Helpers\TypeNamer;
16
use Maslosoft\Manganel\Interfaces\ManganelAwareInterface;
17
use Maslosoft\Manganel\Interfaces\QueryBuilder\ConditionDecoratorInterface;
18
use Maslosoft\Manganel\Manganel;
19
use Maslosoft\Manganel\SearchCriteria;
20
use Maslosoft\Manganel\Traits\ManganelAwareTrait;
21
22
class MoreLikeThisDecorator implements ConditionDecoratorInterface,
23
	ManganelAwareInterface
24
25
{
26
	use ManganelAwareTrait;
27
28
	const Ns = __NAMESPACE__;
29
30 32
	public function decorate(&$conditions, SearchCriteria $criteria)
31
	{
32 32
		$mlt = $criteria->getMoreLike();
33 32
		if (empty($mlt))
34
		{
35 32
			return;
36
		}
37
38
		$conditions = [
39
			[
40
				'more_like_this' => $mlt->toArray()
41
			]
42
		];
43
	}
44
45
	public function getKind()
46
	{
47
		return self::KindShould;
48
	}
49
50
51
}