Completed
Push — master ( 6a8f4b...4a9289 )
by Peter
09:25
created

ConditionsDecorator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A decorate() 0 8 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\Decorators\QueryBuilder\Traits\ConditionsAware;
12
use Maslosoft\Manganel\Interfaces\QueryBuilder\BodyDecoratorInterface;
13
use Maslosoft\Manganel\Interfaces\QueryBuilder\ConditionsAwareInterface;
14
use Maslosoft\Manganel\SearchCriteria;
15
16
/**
17
 * ConditionsDecorator
18
 *
19
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
20
 */
21
class ConditionsDecorator implements BodyDecoratorInterface, ConditionsAwareInterface
22
{
23
24
	use ConditionsAware;
25
26 7
	public function decorate(&$body, SearchCriteria $criteria)
27
	{
28 7
		$body['query'] = [
29
			'bool' => [
30 7
				'must' => $this->getConditions()
31
			]
32
		];
33 7
	}
34
35
}
36