Traits   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 43
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addExpression() 0 4 1
A getConditions() 0 3 1
A getSortations() 0 3 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2021-2025
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\Base\Criteria\Expression\Iface|null $expr Compare, combine or sort expression
26
	 * @return \Aimeos\Controller\Frontend\Iface Controller object for chaining method calls
27
	 */
28
	public function addExpression( ?\Aimeos\Base\Criteria\Expression\Iface $expr = null ) : \Aimeos\Controller\Frontend\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