1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2017-2018 |
6
|
|
|
* @package Controller |
7
|
|
|
* @subpackage Frontend |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\Controller\Frontend\Locale\Decorator; |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Base for locale frontend controller decorators |
16
|
|
|
* |
17
|
|
|
* @package Controller |
18
|
|
|
* @subpackage Frontend |
19
|
|
|
*/ |
20
|
|
|
abstract class Base |
21
|
|
|
extends \Aimeos\Controller\Frontend\Base |
22
|
|
|
implements \Aimeos\Controller\Frontend\Common\Decorator\Iface, \Aimeos\Controller\Frontend\Locale\Iface |
23
|
|
|
{ |
24
|
|
|
private $controller; |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Initializes the controller decorator. |
29
|
|
|
* |
30
|
|
|
* @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
31
|
|
|
* @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
32
|
|
|
*/ |
33
|
|
|
public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
34
|
|
|
{ |
35
|
|
|
$iface = \Aimeos\Controller\Frontend\Locale\Iface::class; |
36
|
|
|
$this->controller = \Aimeos\MW\Common\Base::checkClass( $iface, $controller ); |
|
|
|
|
37
|
|
|
|
38
|
|
|
parent::__construct( $context ); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Passes unknown methods to wrapped objects. |
44
|
|
|
* |
45
|
|
|
* @param string $name Name of the method |
46
|
|
|
* @param array $param List of method parameter |
47
|
|
|
* @return mixed Returns the value of the called method |
48
|
|
|
* @throws \Aimeos\Controller\Frontend\Exception If method call failed |
49
|
|
|
*/ |
50
|
|
|
public function __call( $name, array $param ) |
51
|
|
|
{ |
52
|
|
|
return @call_user_func_array( array( $this->controller, $name ), $param ); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Clones objects in controller and resets values |
58
|
|
|
*/ |
59
|
|
|
public function __clone() |
60
|
|
|
{ |
61
|
|
|
$this->controller = clone $this->controller; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Adds generic condition for filtering |
67
|
|
|
* |
68
|
|
|
* @param string $operator Comparison operator, e.g. "==", "!=", "<", "<=", ">=", ">", "=~", "~=" |
69
|
|
|
* @param string $key Search key defined by the subscription manager, e.g. "subscription.status" |
70
|
|
|
* @param array|string $value Value or list of values to compare to |
71
|
|
|
* @return \Aimeos\Controller\Frontend\Subscription\Iface Subscription controller for fluent interface |
72
|
|
|
* @since 2019.04 |
73
|
|
|
*/ |
74
|
|
|
public function compare( $operator, $key, $value ) |
75
|
|
|
{ |
76
|
|
|
$this->controller->compare( $operator, $key, $value ); |
77
|
|
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Returns the subscription for the given subscription ID |
83
|
|
|
* |
84
|
|
|
* @param string $id Unique subscription ID |
85
|
|
|
* @return \Aimeos\MShop\Subscription\Item\Iface Subscription item including the referenced domains items |
86
|
|
|
* @since 2019.04 |
87
|
|
|
*/ |
88
|
|
|
public function get( $id ) |
89
|
|
|
{ |
90
|
|
|
return $this->controller->get( $id ); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Parses the given array and adds the conditions to the list of conditions |
96
|
|
|
* |
97
|
|
|
* @param array $conditions List of conditions, e.g. ['>' => ['subscription.interval' => 'P0Y1M0W0D']] |
98
|
|
|
* @return \Aimeos\Controller\Frontend\Subscription\Iface Subscription controller for fluent interface |
99
|
|
|
* @since 2019.04 |
100
|
|
|
*/ |
101
|
|
|
public function parse( array $conditions ) |
102
|
|
|
{ |
103
|
|
|
$this->controller->parse( $conditions ); |
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Returns the subscriptions filtered by the previously assigned conditions |
110
|
|
|
* |
111
|
|
|
* @param integer &$total Parameter where the total number of found subscriptions will be stored in |
112
|
|
|
* @return \Aimeos\MShop\Subscription\Item\Iface[] Ordered list of subscription items |
113
|
|
|
* @since 2019.04 |
114
|
|
|
*/ |
115
|
|
|
public function search( &$total = null ) |
116
|
|
|
{ |
117
|
|
|
return $this->controller->search( $total ); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Sets the start value and the number of returned subscription items for slicing the list of found subscription items |
123
|
|
|
* |
124
|
|
|
* @param integer $start Start value of the first subscription item in the list |
125
|
|
|
* @param integer $limit Number of returned subscription items |
126
|
|
|
* @return \Aimeos\Controller\Frontend\Subscription\Iface Subscription controller for fluent interface |
127
|
|
|
* @since 2019.04 |
128
|
|
|
*/ |
129
|
|
|
public function slice( $start, $limit ) |
130
|
|
|
{ |
131
|
|
|
$this->controller->slice( $start, $limit ); |
132
|
|
|
return $this; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Sets the sorting of the result list |
138
|
|
|
* |
139
|
|
|
* @param string|null $key Sorting key of the result list like "interval", null for no sorting |
140
|
|
|
* @return \Aimeos\Controller\Frontend\Subscription\Iface Subscription controller for fluent interface |
141
|
|
|
* @since 2019.04 |
142
|
|
|
*/ |
143
|
|
|
public function sort( $key = null ) |
144
|
|
|
{ |
145
|
|
|
$this->controller->sort( $key ); |
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* Returns the frontend controller |
152
|
|
|
* |
153
|
|
|
* @return \Aimeos\Controller\Frontend\Locale\Iface Frontend controller object |
154
|
|
|
*/ |
155
|
|
|
protected function getController() |
156
|
|
|
{ |
157
|
|
|
return $this->controller; |
158
|
|
|
} |
159
|
|
|
} |
160
|
|
|
|
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.