Passed
Push — master ( bb5a4f...9ad936 )
by Aimeos
13:22 queued 10:01
created

Base::getView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2021
6
 * @package Admin
7
 * @subpackage JQAdm
8
 */
9
10
11
namespace Aimeos\Admin\JQAdm\Common\Decorator;
12
13
14
/**
15
 * Provides common methods for JQAdm client decorators.
16
 *
17
 * @package Admin
18
 * @subpackage JQAdm
19
 */
20
abstract class Base
21
	extends \Aimeos\Admin\JQAdm\Base
22
	implements \Aimeos\Admin\JQAdm\Common\Decorator\Iface
23
{
24
	private $client;
25
26
27
	/**
28
	 * Initializes a new client decorator object.
29
	 *
30
	 * @param \Aimeos\Admin\JQAdm\Iface $client Admin object
31
	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
32
	 */
33
	public function __construct( \Aimeos\Admin\JQAdm\Iface $client, \Aimeos\MShop\Context\Item\Iface $context )
34
	{
35
		parent::__construct( $context );
36
37
		$this->client = $client;
38
	}
39
40
41
	/**
42
	 * Passes unknown methods to wrapped objects.
43
	 *
44
	 * @param string $name Name of the method
45
	 * @param array $param List of method parameter
46
	 * @return mixed Returns the value of the called method
47
	 * @throws \Aimeos\Admin\JQAdm\Exception If method call failed
48
	 */
49
	public function __call( string $name, array $param )
50
	{
51
		return @call_user_func_array( array( $this->client, $name ), $param );
52
	}
53
54
55
	/**
56
	 * Copies a resource
57
	 *
58
	 * @return string|null HTML output
59
	 */
60
	public function copy() : ?string
61
	{
62
		return $this->client->copy();
63
	}
64
65
66
	/**
67
	 * Creates a new resource
68
	 *
69
	 * @return string|null HTML output
70
	 */
71
	public function create() : ?string
72
	{
73
		return $this->client->create();
74
	}
75
76
77
	/**
78
	 * Deletes a resource
79
	 *
80
	 * @return string|null HTML output
81
	 */
82
	public function delete() : ?string
83
	{
84
		return $this->client->delete();
85
	}
86
87
88
	/**
89
	 * Exports a resource
90
	 *
91
	 * @return string|null HTML output
92
	 */
93
	public function export() : ?string
94
	{
95
		return $this->client->export();
96
	}
97
98
99
	/**
100
	 * Returns a single resource
101
	 *
102
	 * @return string|null HTML output
103
	 */
104
	public function get() : ?string
105
	{
106
		return $this->client->get();
107
	}
108
109
110
	/**
111
	 * Imports a resource
112
	 *
113
	 * @return string|null HTML output
114
	 */
115
	public function import() : ?string
116
	{
117
		return $this->client->import();
118
	}
119
120
121
	/**
122
	 * Saves the data
123
	 *
124
	 * @return string|null HTML output
125
	 */
126
	public function save() : ?string
127
	{
128
		return $this->client->save();
129
	}
130
131
132
	/**
133
	 * Returns a list of resource according to the conditions
134
	 *
135
	 * @return string|null HTML output
136
	 */
137
	public function search() : ?string
138
	{
139
		return $this->client->search();
140
	}
141
142
143
	/**
144
	 * Returns the sub-client given by its name.
145
	 *
146
	 * @param string $type Name of the client type
147
	 * @param string|null $name Name of the sub-client (Default if null)
148
	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
149
	 */
150
	public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface
151
	{
152
		return $this->client->getSubClient( $type, $name );
153
	}
154
155
156
	/**
157
	 * Returns the view object that will generate the admin output.
158
	 *
159
	 * @return \Aimeos\MW\View\Iface $view The view object which generates the admin output
160
	 */
161
	public function view() : \Aimeos\MW\View\Iface
162
	{
163
		return $this->client->view();
164
	}
165
166
167
	/**
168
	 * Sets the view object that will generate the admin output.
169
	 *
170
	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
171
	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
172
	 */
173
	public function setView( \Aimeos\MW\View\Iface $view ) : \Aimeos\Admin\JQAdm\Iface
174
	{
175
		parent::setView( $view );
176
177
		$this->client->setView( $view );
178
		return $this;
179
	}
180
181
182
	/**
183
	 * Returns the Aimeos bootstrap object
184
	 *
185
	 * @return \Aimeos\Bootstrap The Aimeos bootstrap object
186
	 */
187
	public function getAimeos() : \Aimeos\Bootstrap
188
	{
189
		return $this->client->getAimeos();
0 ignored issues
show
Bug introduced by
The method getAimeos() does not exist on Aimeos\Admin\JQAdm\Iface. It seems like you code against a sub-type of said class. However, the method does not exist in Aimeos\Admin\JQAdm\Common\Admin\Factory\Iface or Aimeos\Admin\JQAdm\Common\Decorator\Iface. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

189
		return $this->client->/** @scrutinizer ignore-call */ getAimeos();
Loading history...
190
	}
191
192
193
	/**
194
	 * Sets the Aimeos bootstrap object
195
	 *
196
	 * @param \Aimeos\Bootstrap $aimeos The Aimeos bootstrap object
197
	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
198
	 */
199
	public function setAimeos( \Aimeos\Bootstrap $aimeos ) : \Aimeos\Admin\JQAdm\Iface
200
	{
201
		parent::setAimeos( $aimeos );
202
203
		$this->client->setAimeos( $aimeos );
0 ignored issues
show
Bug introduced by
The method setAimeos() does not exist on Aimeos\Admin\JQAdm\Iface. It seems like you code against a sub-type of said class. However, the method does not exist in Aimeos\Admin\JQAdm\Common\Admin\Factory\Iface or Aimeos\Admin\JQAdm\Common\Decorator\Iface. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

203
		$this->client->/** @scrutinizer ignore-call */ 
204
                 setAimeos( $aimeos );
Loading history...
204
		return $this;
205
	}
206
207
208
	/**
209
	 * Returns the inner client object
210
	 *
211
	 * @return \Aimeos\Admin\JQAdm\Iface admin client
212
	 */
213
	protected function getClient() : \Aimeos\Admin\JQAdm\Iface
214
	{
215
		return $this->client;
216
	}
217
218
219
	/**
220
	 * Returns the list of sub-client names configured for the client.
221
	 *
222
	 * @return array List of admin client names
223
	 */
224
	protected function getSubClientNames() : array
225
	{
226
		return [];
227
	}
228
}
229