Completed
Push — master ( af5cb4...f7d729 )
by Tim
12s
created

persistProductMediaGalleryValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Product\Media\Services\ProductMediaProcessor
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2016 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import-product-media
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Product\Media\Services;
22
23
use TechDivision\Import\Connection\ConnectionInterface;
24
use TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository;
25
use TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository;
26
use TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository;
27
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction;
28
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueVideoAction;
29
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction;
30
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction;
31
32
/**
33
 * A SLSB providing methods to load product data using a PDO connection.
34
 *
35
 * @author    Tim Wagner <[email protected]>
36
 * @copyright 2016 TechDivision GmbH <[email protected]>
37
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
38
 * @link      https://github.com/techdivision/import-product-media
39
 * @link      http://www.techdivision.com
40
 */
41
class ProductMediaProcessor implements ProductMediaProcessorInterface
42
{
43
44
    /**
45
     * A PDO connection initialized with the values from the Doctrine EntityManager.
46
     *
47
     * @var \TechDivision\Import\Connection\ConnectionInterface
48
     */
49
    protected $connection;
50
51
    /**
52
     * The repository to load product media galleries.
53
     *
54
     * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository
55
     */
56
    protected $productMediaGalleryRepository;
57
58
    /**
59
     * The repository to load product media gallery to entities.
60
     *
61
     * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository
62
     */
63
    protected $productMediaGalleryValueToEntityRepository;
64
65
    /**
66
     * The repository to load product media gallery values.
67
     *
68
     * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository
69
     */
70
    protected $productMediaGalleryValueRepository;
71
72
    /**
73
     * The action with the product media gallery CRUD methods.
74
     *
75
     * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction
76
     */
77
    protected $productMediaGalleryAction;
78
79
    /**
80
     * The action with the product media gallery value CRUD methods.
81
     *
82
     * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction
83
     */
84
    protected $productMediaGalleryValueAction;
85
86
    /**
87
     * The action with the product media gallery value to entity CRUD methods.
88
     *
89
     * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction
90
     */
91
    protected $productMediaGalleryValueToEntityAction;
92
93
    /**
94
     * The action with the product media gallery video CRUD methods.
95
     *
96
     * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueVideoAction
97
     */
98
    protected $productMediaGalleryVideoAction;
99
100
    /**
101
     * Initialize the processor with the necessary assembler and repository instances.
102
     *
103
     * @param \TechDivision\Import\Connection\ConnectionInterface                                        $connection                                 The connection to use
104
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository              $productMediaGalleryRepository              The product media gallery repository to use
105
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository         $productMediaGalleryValueRepository         The product media gallery value repository to use
106
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository The product media gallery value to entity repository to use
107
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction                       $productMediaGalleryAction                  The product media gallery action to use
108
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction                  $productMediaGalleryValueAction             The product media gallery value action to use
109
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction          $productMediaGalleryValueToEntityAction     The product media gallery value to entity action to use
110
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueVideoAction             $productMediaGalleryValueVideoAction        The product media gallery value video action to use
111
     */
112
    public function __construct(
113
        ConnectionInterface $connection,
114
        ProductMediaGalleryRepository $productMediaGalleryRepository,
115
        ProductMediaGalleryValueRepository $productMediaGalleryValueRepository,
116
        ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository,
117
        ProductMediaGalleryAction $productMediaGalleryAction,
118
        ProductMediaGalleryValueAction $productMediaGalleryValueAction,
119
        ProductMediaGalleryValueToEntityAction $productMediaGalleryValueToEntityAction,
120
        ProductMediaGalleryValueVideoAction $productMediaGalleryValueVideoAction
121
    ) {
122
        $this->setConnection($connection);
123
        $this->setProductMediaGalleryRepository($productMediaGalleryRepository);
124
        $this->setProductMediaGalleryValueRepository($productMediaGalleryValueRepository);
125
        $this->setProductMediaGalleryValueToEntityRepository($productMediaGalleryValueToEntityRepository);
126
        $this->setProductMediaGalleryAction($productMediaGalleryAction);
127
        $this->setProductMediaGalleryValueAction($productMediaGalleryValueAction);
0 ignored issues
show
Documentation introduced by
$productMediaGalleryValueAction is of type object<TechDivision\Impo...ediaGalleryValueAction>, but the function expects a object<TechDivision\Impo...ductMediaGalleryAction>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
128
        $this->setProductMediaGalleryValueToEntityAction($productMediaGalleryValueToEntityAction);
0 ignored issues
show
Documentation introduced by
$productMediaGalleryValueToEntityAction is of type object<TechDivision\Impo...eryValueToEntityAction>, but the function expects a object<TechDivision\Impo...ductMediaGalleryAction>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
129
        $this->setProductMediaGalleryValueVideoAction($productMediaGalleryValueVideoAction);
0 ignored issues
show
Documentation introduced by
$productMediaGalleryValueVideoAction is of type object<TechDivision\Impo...alleryValueVideoAction>, but the function expects a object<TechDivision\Impo...ductMediaGalleryAction>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
130
    }
131
132
    /**
133
     * Set's the passed connection.
134
     *
135
     * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to set
136
     *
137
     * @return void
138
     */
139
    public function setConnection(ConnectionInterface $connection)
140
    {
141
        $this->connection = $connection;
142
    }
143
144
    /**
145
     * Return's the connection.
146
     *
147
     * @return \TechDivision\Import\Connection\ConnectionInterface The connection instance
148
     */
149
    public function getConnection()
150
    {
151
        return $this->connection;
152
    }
153
154
    /**
155
     * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO
156
     * object instance are not committed until you end the transaction by calling ProductProcessor::commit().
157
     * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection
158
     * to autocommit mode.
159
     *
160
     * @return boolean Returns TRUE on success or FALSE on failure
161
     * @link http://php.net/manual/en/pdo.begintransaction.php
162
     */
163
    public function beginTransaction()
164
    {
165
        return $this->connection->beginTransaction();
166
    }
167
168
    /**
169
     * Commits a transaction, returning the database connection to autocommit mode until the next call to
170
     * ProductProcessor::beginTransaction() starts a new transaction.
171
     *
172
     * @return boolean Returns TRUE on success or FALSE on failure
173
     * @link http://php.net/manual/en/pdo.commit.php
174
     */
175
    public function commit()
176
    {
177
        return $this->connection->commit();
178
    }
179
180
    /**
181
     * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction().
182
     *
183
     * If the database was set to autocommit mode, this function will restore autocommit mode after it has
184
     * rolled back the transaction.
185
     *
186
     * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition
187
     * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
188
     * COMMIT will prevent you from rolling back any other changes within the transaction boundary.
189
     *
190
     * @return boolean Returns TRUE on success or FALSE on failure
191
     * @link http://php.net/manual/en/pdo.rollback.php
192
     */
193
    public function rollBack()
194
    {
195
        return $this->connection->rollBack();
196
    }
197
198
    /**
199
     * Set's the repository to load product media gallery data.
200
     *
201
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository $productMediaGalleryRepository The repository instance
202
     *
203
     * @return void
204
     */
205
    public function setProductMediaGalleryRepository($productMediaGalleryRepository)
206
    {
207
        $this->productMediaGalleryRepository = $productMediaGalleryRepository;
208
    }
209
210
    /**
211
     * Return's the repository to load product media gallery data.
212
     *
213
     * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository The repository instance
214
     */
215
    public function getProductMediaGalleryRepository()
216
    {
217
        return $this->productMediaGalleryRepository;
218
    }
219
220
    /**
221
     * Set's the repository to load product media gallery value to entity data.
222
     *
223
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository The repository instance
224
     *
225
     * @return void
226
     */
227
    public function setProductMediaGalleryValueToEntityRepository($productMediaGalleryValueToEntityRepository)
228
    {
229
        $this->productMediaGalleryValueToEntityRepository = $productMediaGalleryValueToEntityRepository;
230
    }
231
232
    /**
233
     * Return's the repository to load product media gallery value to entity data.
234
     *
235
     * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository The repository instance
236
     */
237
    public function getProductMediaGalleryValueToEntityRepository()
238
    {
239
        return $this->productMediaGalleryValueToEntityRepository;
240
    }
241
242
    /**
243
     * Set's the repository to load product media gallery value data.
244
     *
245
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository $productMediaGalleryValueRepository The repository instance
246
     *
247
     * @return void
248
     */
249
    public function setProductMediaGalleryValueRepository($productMediaGalleryValueRepository)
250
    {
251
        $this->productMediaGalleryValueRepository = $productMediaGalleryValueRepository;
252
    }
253
254
    /**
255
     * Return's the repository to load product media gallery value data.
256
     *
257
     * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository The repository instance
258
     */
259
    public function getProductMediaGalleryValueRepository()
260
    {
261
        return $this->productMediaGalleryValueRepository;
262
    }
263
264
    /**
265
     * Set's the action with the product media gallery CRUD methods.
266
     *
267
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryAction The action with the product media gallery CRUD methods
268
     *
269
     * @return void
270
     */
271
    public function setProductMediaGalleryAction($productMediaGalleryAction)
272
    {
273
        $this->productMediaGalleryAction = $productMediaGalleryAction;
274
    }
275
276
    /**
277
     * Return's the action with the product media gallery CRUD methods.
278
     *
279
     * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction The action with the product media gallery CRUD methods
280
     */
281
    public function getProductMediaGalleryAction()
282
    {
283
        return $this->productMediaGalleryAction;
284
    }
285
286
    /**
287
     * Set's the action with the product media gallery valueCRUD methods.
288
     *
289
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryValueAction The action with the product media gallery value CRUD methods
290
     *
291
     * @return void
292
     */
293
    public function setProductMediaGalleryValueAction($productMediaGalleryValueAction)
294
    {
295
        $this->productMediaGalleryValueAction = $productMediaGalleryValueAction;
0 ignored issues
show
Documentation Bug introduced by
It seems like $productMediaGalleryValueAction of type object<TechDivision\Impo...ductMediaGalleryAction> is incompatible with the declared type object<TechDivision\Impo...ediaGalleryValueAction> of property $productMediaGalleryValueAction.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
296
    }
297
298
    /**
299
     * Return's the action with the product media gallery valueCRUD methods.
300
     *
301
     * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction The action with the product media gallery value CRUD methods
302
     */
303
    public function getProductMediaGalleryValueAction()
304
    {
305
        return $this->productMediaGalleryValueAction;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->productMediaGalleryValueAction; (TechDivision\Import\Prod...MediaGalleryValueAction) is incompatible with the return type declared by the interface TechDivision\Import\Prod...MediaGalleryValueAction of type TechDivision\Import\Prod...oductMediaGalleryAction.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
306
    }
307
308
    /**
309
     * Set's the action with the product media gallery value to entity CRUD methods.
310
     *
311
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryValueToEntityAction The action with the product media gallery value to entity CRUD methods
312
     *
313
     * @return void
314
     */
315
    public function setProductMediaGalleryValueToEntityAction($productMediaGalleryValueToEntityAction)
316
    {
317
        $this->productMediaGalleryValueToEntityAction = $productMediaGalleryValueToEntityAction;
0 ignored issues
show
Documentation Bug introduced by
It seems like $productMediaGalleryValueToEntityAction of type object<TechDivision\Impo...ductMediaGalleryAction> is incompatible with the declared type object<TechDivision\Impo...eryValueToEntityAction> of property $productMediaGalleryValueToEntityAction.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
318
    }
319
320
    /**
321
     * Return's the action with the product media gallery value to entity CRUD methods.
322
     *
323
     * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryAction The action with the product media gallery value to entity CRUD methods
324
     */
325
    public function getProductMediaGalleryValueToEntityAction()
326
    {
327
        return $this->productMediaGalleryValueToEntityAction;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->productMed...eryValueToEntityAction; (TechDivision\Import\Prod...leryValueToEntityAction) is incompatible with the return type declared by the interface TechDivision\Import\Prod...leryValueToEntityAction of type TechDivision\Import\Prod...oductMediaGalleryAction.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
328
    }
329
330
    /**
331
     * Set's the action with the product media gallery value video CRUD methods.
332
     *
333
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryValueVideoAction The action with the product media gallery value video CRUD methods
334
     *
335
     * @return void
336
     */
337
    public function setProductMediaGalleryValueVideoAction($productMediaGalleryValueVideoAction)
338
    {
339
        $this->productMediaGalleryValueVideoAction = $productMediaGalleryValueVideoAction;
0 ignored issues
show
Bug introduced by
The property productMediaGalleryValueVideoAction does not seem to exist. Did you mean productMediaGalleryValueAction?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
340
    }
341
342
    /**
343
     * Return's the action with the product media gallery value video CRUD methods.
344
     *
345
     * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction The action with the product media gallery value video CRUD methods
346
     */
347
    public function getProductMediaGalleryValueVideoAction()
348
    {
349
        return $this->productMediaGalleryValueVideoAction;
0 ignored issues
show
Bug introduced by
The property productMediaGalleryValueVideoAction does not seem to exist. Did you mean productMediaGalleryValueAction?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
350
    }
351
352
    /**
353
     * Load's the product media gallery with the passed attribute ID + value.
354
     *
355
     * @param integer $attributeId The attribute ID of the product media gallery to load
356
     * @param string  $value       The value of the product media gallery to load
357
     *
358
     * @return array The product media gallery
359
     */
360
    public function loadProductMediaGallery($attributeId, $value)
361
    {
362
        return $this->getProductMediaGalleryRepository()->findOneByAttributeIdAndValue($attributeId, $value);
363
    }
364
365
    /**
366
     * Load's the product media gallery with the passed value/entity ID.
367
     *
368
     * @param integer $valueId  The value ID of the product media gallery value to entity to load
369
     * @param integer $entityId The entity ID of the product media gallery value to entity to load
370
     *
371
     * @return array The product media gallery
372
     */
373
    public function loadProductMediaGalleryValueToEntity($valueId, $entityId)
374
    {
375
        return $this->getProductMediaGalleryValueToEntityRepository()->findOneByValueIdAndEntityId($valueId, $entityId);
376
    }
377
378
    /**
379
     * Load's the product media gallery value with the passed value/store/parent ID.
380
     *
381
     * @param integer $valueId  The value ID of the product media gallery value to load
382
     * @param string  $storeId  The store ID of the product media gallery value to load
383
     * @param string  $entityId The entity ID of the parent product of the product media gallery value to load
384
     *
385
     * @return array The product media gallery value
386
     */
387
    public function loadProductMediaGalleryValue($valueId, $storeId, $entityId)
388
    {
389
        return $this->getProductMediaGalleryValueRepository()->findOneByValueIdAndStoreIdAndEntityId($valueId, $storeId, $entityId);
390
    }
391
392
    /**
393
     * Load's the product media gallery entities with the passed SKU.
394
     *
395
     * @param string $sku The SKU to load the media gallery entities for
396
     *
397
     * @return array The product media gallery entities
398
     */
399
    public function getProductMediaGalleriesBySku($sku)
400
    {
401
        return $this->getProductMediaGalleryRepository()->findAllBySku($sku);
402
    }
403
404
    /**
405
     * Persist's the passed product media gallery data and return's the ID.
406
     *
407
     * @param array       $productMediaGallery The product media gallery data to persist
408
     * @param string|null $name                The name of the prepared statement that has to be executed
409
     *
410
     * @return string The ID of the persisted entity
411
     */
412
    public function persistProductMediaGallery($productMediaGallery, $name = null)
413
    {
414
        return $this->getProductMediaGalleryAction()->persist($productMediaGallery, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductMediaGalleryAction::persist() has too many arguments starting with $name.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
415
    }
416
417
    /**
418
     * Persist's the passed product media gallery value data.
419
     *
420
     * @param array       $productMediaGalleryValue The product media gallery value data to persist
421
     * @param string|null $name                     The name of the prepared statement that has to be executed
422
     *
423
     * @return void
424
     */
425
    public function persistProductMediaGalleryValue($productMediaGalleryValue, $name = null)
426
    {
427
        $this->getProductMediaGalleryValueAction()->persist($productMediaGalleryValue, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductMediaGalleryValueAction::persist() has too many arguments starting with $name.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
428
    }
429
430
    /**
431
     * Persist's the passed product media gallery value to entity data.
432
     *
433
     * @param array       $productMediaGalleryValuetoEntity The product media gallery value to entity data to persist
434
     * @param string|null $name                             The name of the prepared statement that has to be executed
435
     *
436
     * @return void
437
     */
438
    public function persistProductMediaGalleryValueToEntity($productMediaGalleryValuetoEntity, $name = null)
439
    {
440
        $this->getProductMediaGalleryValueToEntityAction()->persist($productMediaGalleryValuetoEntity, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductMediaGalleryValueToEntityAction::persist() has too many arguments starting with $name.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
441
    }
442
443
    /**
444
     * Persist's the passed product media gallery value video data.
445
     *
446
     * @param array       $productMediaGalleryValueVideo The product media gallery value video data to persist
447
     * @param string|null $name                          The name of the prepared statement that has to be executed
448
     *
449
     * @return void
450
     */
451
    public function persistProductMediaGalleryValueVideo($productMediaGalleryValueVideo, $name = null)
452
    {
453
        $this->getProductMediaGalleryValueVideoAction()->persist($productMediaGalleryValueVideo, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductMediaGalleryAction::persist() has too many arguments starting with $name.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
454
    }
455
456
    /**
457
     * Delete's the passed product media gallery data.
458
     *
459
     * @param array       $row  The product media gallery data to be deleted
460
     * @param string|null $name The name of the prepared statement that has to be executed
461
     *
462
     * @return string The ID of the persisted entity
463
     */
464
    public function deleteProductMediaGallery(array $row, $name = null)
465
    {
466
        return $this->getProductMediaGalleryAction()->delete($row, $name);
467
    }
468
}
469