Completed
Push — master ( 4a9289...6c8c8c )
by Peter
08:35
created

ConditionDecorator::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
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace Maslosoft\Manganel\Decorators\QueryBuilder;
10
11
use Maslosoft\Manganel\Interfaces\QueryBuilder\ConditionDecoratorInterface;
12
use Maslosoft\Manganel\SearchCriteria;
13
14
/**
15
 * ConditionDecorator
16
 *
17
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
18
 */
19
class ConditionDecorator implements ConditionDecoratorInterface
20
{
21
22 10
	public function decorate(&$conditions, SearchCriteria $criteria)
23
	{
24 10
		foreach ($criteria->getConditions() as $name => $value)
25
		{
26 3
			$conditions[] = [
27
				'term' => [
28
					$name => $value
29 3
				]
30 3
			];
31 10
		}
32 10
	}
33
34 3
	public function getKind()
35
	{
36 3
		return self::KindFilter;
37
	}
38
39
}
40