MoreLikeThisDecorator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 50%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A decorate() 0 14 2
A getKind() 0 4 1
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
}