Passed
Push — master ( 09b20d...36fbb7 )
by Aimeos
14:28
created

Base::import()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2024
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 \Aimeos\Admin\JQAdm\Iface $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\ContextIface $context Context object with required objects
32
	 */
33
	public function __construct( \Aimeos\Admin\JQAdm\Iface $client, \Aimeos\MShop\ContextIface $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( [$this->client, $name], $param );
52
	}
53
54
55
	/**
56
	 * Batch update of resources
57
	 *
58
	 * @return string|null HTML output
59
	 */
60
	public function batch() : ?string
61
	{
62
		return $this->client->batch();
63
	}
64
65
66
	/**
67
	 * Copies a resource
68
	 *
69
	 * @return string|null HTML output
70
	 */
71
	public function copy() : ?string
72
	{
73
		return $this->client->copy();
74
	}
75
76
77
	/**
78
	 * Creates a new resource
79
	 *
80
	 * @return string|null HTML output
81
	 */
82
	public function create() : ?string
83
	{
84
		return $this->client->create();
85
	}
86
87
88
	/**
89
	 * Adds the required data
90
	 *
91
	 * @param \Aimeos\Base\View\Iface $view View object
92
	 * @return \Aimeos\Base\View\Iface View object with assigned parameters
93
	 */
94
	public function data( \Aimeos\Base\View\Iface $view ) : \Aimeos\Base\View\Iface
95
	{
96
		return $this->client->data( $view );
97
	}
98
99
100
	/**
101
	 * Deletes a resource
102
	 *
103
	 * @return string|null HTML output
104
	 */
105
	public function delete() : ?string
106
	{
107
		return $this->client->delete();
108
	}
109
110
111
	/**
112
	 * Exports a resource
113
	 *
114
	 * @return string|null HTML output
115
	 */
116
	public function export() : ?string
117
	{
118
		return $this->client->export();
119
	}
120
121
122
	/**
123
	 * Returns a single resource
124
	 *
125
	 * @return string|null HTML output
126
	 */
127
	public function get() : ?string
128
	{
129
		return $this->client->get();
130
	}
131
132
133
	/**
134
	 * Imports a resource
135
	 *
136
	 * @return string|null HTML output
137
	 */
138
	public function import() : ?string
139
	{
140
		return $this->client->import();
141
	}
142
143
144
	/**
145
	 * Saves the data
146
	 *
147
	 * @return string|null HTML output
148
	 */
149
	public function save() : ?string
150
	{
151
		return $this->client->save();
152
	}
153
154
155
	/**
156
	 * Returns a list of resource according to the conditions
157
	 *
158
	 * @return string|null HTML output
159
	 */
160
	public function search() : ?string
161
	{
162
		return $this->client->search();
163
	}
164
165
166
	/**
167
	 * Returns the sub-client given by its name.
168
	 *
169
	 * @param string $type Name of the client type
170
	 * @param string|null $name Name of the sub-client (Default if null)
171
	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
172
	 */
173
	public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface
174
	{
175
		return $this->client->getSubClient( $type, $name );
176
	}
177
178
179
	/**
180
	 * Sets the view object that will generate the admin output.
181
	 *
182
	 * @param \Aimeos\Base\View\Iface $view The view object which generates the admin output
183
	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
184
	 */
185
	public function setView( \Aimeos\Base\View\Iface $view ) : \Aimeos\Admin\JQAdm\Iface
186
	{
187
		parent::setView( $view );
188
189
		$this->client->setView( $view );
190
		return $this;
191
	}
192
193
194
	/**
195
	 * Sets the Aimeos bootstrap object
196
	 *
197
	 * @param \Aimeos\Bootstrap $aimeos The Aimeos bootstrap object
198
	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
199
	 */
200
	public function setAimeos( \Aimeos\Bootstrap $aimeos ) : \Aimeos\Admin\JQAdm\Iface
201
	{
202
		parent::setAimeos( $aimeos );
203
204
		$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

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