Passed
Push — master ( df26ff...31fd68 )
by Aimeos
02:28
created

Traits::addExpression()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2021
6
 * @package Controller
7
 * @subpackage Frontend
8
 */
9
10
11
namespace Aimeos\Controller\Frontend\Common\Decorator;
12
13
14
/**
15
 * Decorator trait class for controllers
16
 *
17
 * @package Controller
18
 * @subpackage Frontend
19
 */
20
trait Traits
21
{
22
	/**
23
	 * Adds the given compare, combine or sort expression to the list of expressions
24
	 *
25
	 * @param \Aimeos\MW\Criteria\Expression\Iface $expr Compare, combine or sort expression
26
	 * @return \Aimeos\Controller\Frontend\Iface Controller object for chaining method calls
27
	 */
28
	public function addExpression( \Aimeos\MW\Criteria\Expression\Iface $expr ) : Iface
29
	{
30
		$this->getController()->addExpression( $expr );
31
		return $this;
32
	}
33
34
35
	/**
36
	 * Returns the compare and combine expressions added by addExpression()
37
	 *
38
	 * @return array List of compare and combine expressions
39
	 */
40
	public function getConditions() : array
41
	{
42
		$this->getController()->getConditions();
43
	}
44
45
46
	/**
47
	 * Returns the compare and combine expressions added by addExpression()
48
	 *
49
	 * @return array List of sort expressions
50
	 */
51
	public function getSortations() : array
52
	{
53
		$this->getController()->getSortations();
54
	}
55
56
57
	/**
58
	 * Returns the frontend controller
59
	 *
60
	 * @return \Aimeos\Controller\Frontend\Iface Frontend controller object
61
	 */
62
	abstract protected function getController() : \Aimeos\Controller\Frontend\Iface;
63
}
64