Completed
Push — master ( 75ad7f...4e986c )
by Tim
14s
created

CustomerAddressBunchProcessor::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 12
dl 0
loc 26
rs 9.8666
c 0
b 0
f 0

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
/**
4
 * TechDivision\Import\Customer\Address\Services\CustomerAddressBunchProcessor
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 2018 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-customer-address
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Customer\Address\Services;
22
23
use TechDivision\Import\Connection\ConnectionInterface;
24
use TechDivision\Import\Repositories\EavAttributeRepositoryInterface;
25
use TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface;
26
use TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface;
27
use TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface;
28
use TechDivision\Import\Customer\Address\Actions\CustomerAddressActionInterface;
29
use TechDivision\Import\Customer\Address\Actions\CustomerAddressIntActionInterface;
30
use TechDivision\Import\Customer\Address\Actions\CustomerAddressTextActionInterface;
31
use TechDivision\Import\Customer\Address\Actions\CustomerAddressVarcharActionInterface;
32
use TechDivision\Import\Customer\Address\Actions\CustomerAddressDecimalActionInterface;
33
use TechDivision\Import\Customer\Address\Actions\CustomerAddressDatetimeActionInterface;
34
use TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface;
35
36
/**
37
 * The customer address bunch processor implementation.
38
 *
39
 * @author    Tim Wagner <[email protected]>
40
 * @copyright 2018 TechDivision GmbH <[email protected]>
41
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
42
 * @link      https://github.com/techdivision/import-customer-address
43
 * @link      http://www.techdivision.com
44
 */
45
class CustomerAddressBunchProcessor implements CustomerAddressBunchProcessorInterface
46
{
47
48
    /**
49
     * A PDO connection initialized with the values from the Doctrine EntityManager.
50
     *
51
     * @var \TechDivision\Import\Connection\ConnectionInterface
52
     */
53
    protected $connection;
54
55
    /**
56
     * The repository to access EAV attribute option values.
57
     *
58
     * @var \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface
59
     */
60
    protected $eavAttributeOptionValueRepository;
61
62
    /**
63
     * The repository to access customer data.
64
     *
65
     * @var \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface
66
     */
67
    protected $customerRepository;
68
69
    /**
70
     * The repository to access customer address address data.
71
     *
72
     * @var \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface
73
     */
74
    protected $customerAddressRepository;
75
76
    /**
77
     * The repository to access EAV attributes.
78
     *
79
     * @var \TechDivision\Import\Repositories\EavAttributeRepositoryInterface
80
     */
81
    protected $eavAttributeRepository;
82
83
    /**
84
     * The action for customer address CRUD methods.
85
     *
86
     * @var \TechDivision\Import\Customer\Address\Actions\CustomerAddressActionInterface
87
     */
88
    protected $customerAddressAction;
89
90
    /**
91
     * The action for customer address varchar attribute CRUD methods.
92
     *
93
     * @var \TechDivision\Import\Customer\Address\Actions\CustomerAddressVarcharActionInterface
94
     */
95
    protected $customerAddressVarcharAction;
96
97
    /**
98
     * The action for customer address text attribute CRUD methods.
99
     *
100
     * @var \TechDivision\Import\Customer\Address\Actions\CustomerAddressTextActionInterface
101
     */
102
    protected $customerAddressTextAction;
103
104
    /**
105
     * The action for customer address int attribute CRUD methods.
106
     *
107
     * @var \TechDivision\Import\Customer\Address\Actions\CustomerAddressIntActionInterface
108
     */
109
    protected $customerAddressIntAction;
110
111
    /**
112
     * The action for customer address decimal attribute CRUD methods.
113
     *
114
     * @var \TechDivision\Import\Customer\Address\Actions\CustomerAddressDecimalActionInterface
115
     */
116
    protected $customerAddressDecimalAction;
117
118
    /**
119
     * The action for customer address datetime attribute CRUD methods.
120
     *
121
     * @var \TechDivision\Import\Customer\Address\Actions\CustomerAddressDatetimeActionInterface
122
     */
123
    protected $customerAddressDatetimeAction;
124
125
    /**
126
     * The assembler to load the customer address attributes with.
127
     *
128
     * @var \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface
129
     */
130
    protected $customerAddressAttributeAssembler;
131
132
    /**
133
     * Initialize the processor with the necessary assembler and repository instances.
134
     *
135
     * @param \TechDivision\Import\Connection\ConnectionInterface                                         connection                         The connection to use
0 ignored issues
show
Bug introduced by
The type TechDivision\Import\Cust...ess\Services\connection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
136
     * @param \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler The customer address attribute assembler to use
137
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface                $eavAttributeOptionValueRepository The EAV attribute option value repository to use
138
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface                           $eavAttributeRepository            The EAV attribute repository to use
139
     * @param \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface                      $customerRepository                The customer repository to use
140
     * @param \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface       $customerAddressRepository         The customer address repository to use
141
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressActionInterface                $customerAddressAction             The customer address action to use
142
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressDatetimeActionInterface        $customerAddressDatetimeAction     The customer address datetime action to use
143
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressDecimalActionInterface         $customerAddressDecimalAction      The customer address decimal action to use
144
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressIntActionInterface             $customerAddressIntAction          The customer address integer action to use
145
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressTextActionInterface            $customerAddressTextAction         The customer address text action to use
146
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressVarcharActionInterface         $customerAddressVarcharAction      The customer address varchar action to use
147
     */
148
    public function __construct(
149
        ConnectionInterface $connection,
150
        CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler,
151
        EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository,
152
        EavAttributeRepositoryInterface $eavAttributeRepository,
153
        CustomerRepositoryInterface $customerRepository,
154
        CustomerAddressRepositoryInterface $customerAddressRepository,
155
        CustomerAddressActionInterface $customerAddressAction,
156
        CustomerAddressDatetimeActionInterface $customerAddressDatetimeAction,
157
        CustomerAddressDecimalActionInterface $customerAddressDecimalAction,
158
        CustomerAddressIntActionInterface $customerAddressIntAction,
159
        CustomerAddressTextActionInterface $customerAddressTextAction,
160
        CustomerAddressVarcharActionInterface $customerAddressVarcharAction
161
    ) {
162
        $this->setConnection($connection);
163
        $this->setCustomerAddressAttributeAssembler($customerAddressAttributeAssembler);
164
        $this->setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository);
165
        $this->setEavAttributeRepository($eavAttributeRepository);
166
        $this->setCustomerRepository($customerRepository);
167
        $this->setCustomerAddressRepository($customerAddressRepository);
168
        $this->setCustomerAddressAction($customerAddressAction);
169
        $this->setCustomerAddressDatetimeAction($customerAddressDatetimeAction);
170
        $this->setCustomerAddressDecimalAction($customerAddressDecimalAction);
171
        $this->setCustomerAddressIntAction($customerAddressIntAction);
172
        $this->setCustomerAddressTextAction($customerAddressTextAction);
173
        $this->setCustomerAddressVarcharAction($customerAddressVarcharAction);
174
    }
175
176
    /**
177
     * Set's the passed connection.
178
     *
179
     * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to set
180
     *
181
     * @return void
182
     */
183
    public function setConnection(ConnectionInterface $connection)
184
    {
185
        $this->connection = $connection;
186
    }
187
188
    /**
189
     * Return's the connection.
190
     *
191
     * @return \TechDivision\Import\Connection\ConnectionInterface The connection instance
192
     */
193
    public function getConnection()
194
    {
195
        return $this->connection;
196
    }
197
198
    /**
199
     * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO
200
     * object instance are not committed until you end the transaction by calling CustomerProcessor::commit().
201
     * Calling CustomerProcessor::rollBack() will roll back all changes to the database and return the connection
202
     * to autocommit mode.
203
     *
204
     * @return boolean Returns TRUE on success or FALSE on failure
205
     * @link http://php.net/manual/en/pdo.begintransaction.php
206
     */
207
    public function beginTransaction()
208
    {
209
        return $this->connection->beginTransaction();
210
    }
211
212
    /**
213
     * Commits a transaction, returning the database connection to autocommit mode until the next call to
214
     * CustomerProcessor::beginTransaction() starts a new transaction.
215
     *
216
     * @return boolean Returns TRUE on success or FALSE on failure
217
     * @link http://php.net/manual/en/pdo.commit.php
218
     */
219
    public function commit()
220
    {
221
        return $this->connection->commit();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->connection->commit() targeting TechDivision\Import\Conn...tionInterface::commit() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Bug Best Practice introduced by
The expression return $this->connection->commit() returns the type void which is incompatible with the documented return type boolean.
Loading history...
222
    }
223
224
    /**
225
     * Rolls back the current transaction, as initiated by CustomerProcessor::beginTransaction().
226
     *
227
     * If the database was set to autocommit mode, this function will restore autocommit mode after it has
228
     * rolled back the transaction.
229
     *
230
     * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition
231
     * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
232
     * COMMIT will prevent you from rolling back any other changes within the transaction boundary.
233
     *
234
     * @return boolean Returns TRUE on success or FALSE on failure
235
     * @link http://php.net/manual/en/pdo.rollback.php
236
     */
237
    public function rollBack()
238
    {
239
        return $this->connection->rollBack();
240
    }
241
242
    /**
243
     * Set's the repository to load the customers with.
244
     *
245
     * @param \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface $customerRepository The repository instance
246
     *
247
     * @return void
248
     */
249
    public function setCustomerRepository(CustomerRepositoryInterface $customerRepository)
250
    {
251
        $this->customerRepository = $customerRepository;
252
    }
253
254
    /**
255
     * Return's the repository to load the customers with.
256
     *
257
     * @return \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface The repository instance
258
     */
259
    public function getCustomerRepository()
260
    {
261
        return $this->customerRepository;
262
    }
263
264
    /**
265
     * Set's the repository to load the customer addresses with.
266
     *
267
     * @param \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface $customerAddressRepository The repository instance
268
     *
269
     * @return void
270
     */
271
    public function setCustomerAddressRepository(CustomerAddressRepositoryInterface $customerAddressRepository)
272
    {
273
        $this->customerAddressRepository = $customerAddressRepository;
274
    }
275
276
    /**
277
     * Return's the repository to load the customer addresses with.
278
     *
279
     * @return \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface The repository instance
280
     */
281
    public function getCustomerAddressRepository()
282
    {
283
        return $this->customerAddressRepository;
284
    }
285
286
    /**
287
     * Set's the action with the customer address CRUD methods.
288
     *
289
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressActionInterface $customerAddressAction The action with the customer CRUD methods
290
     *
291
     * @return void
292
     */
293
    public function setCustomerAddressAction(CustomerAddressActionInterface $customerAddressAction)
294
    {
295
        $this->customerAddressAction = $customerAddressAction;
296
    }
297
298
    /**
299
     * Return's the action with the customer address CRUD methods.
300
     *
301
     * @return \TechDivision\Import\Customer\Address\Actions\CustomerAddressActionInterface The action instance
302
     */
303
    public function getCustomerAddressAction()
304
    {
305
        return $this->customerAddressAction;
306
    }
307
308
    /**
309
     * Set's the action with the customer address varchar attribute CRUD methods.
310
     *
311
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressVarcharActionInterface $customerAddressVarcharAction The action with the customer varchar attriute CRUD methods
312
     *
313
     * @return void
314
     */
315
    public function setCustomerAddressVarcharAction(CustomerAddressVarcharActionInterface $customerAddressVarcharAction)
316
    {
317
        $this->customerAddressVarcharAction = $customerAddressVarcharAction;
318
    }
319
320
    /**
321
     * Return's the action with the customer address varchar attribute CRUD methods.
322
     *
323
     * @return \TechDivision\Import\Customer\Address\Actions\CustomerAddressVarcharActionInterface The action instance
324
     */
325
    public function getCustomerAddressVarcharAction()
326
    {
327
        return $this->customerAddressVarcharAction;
328
    }
329
330
    /**
331
     * Set's the action with the customer address text attribute CRUD methods.
332
     *
333
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressTextActionInterface $customerAddressTextAction The action with the customer text attriute CRUD methods
334
     *
335
     * @return void
336
     */
337
    public function setCustomerAddressTextAction(CustomerAddressTextActionInterface $customerAddressTextAction)
338
    {
339
        $this->customerAddressTextAction = $customerAddressTextAction;
340
    }
341
342
    /**
343
     * Return's the action with the customer address text attribute CRUD methods.
344
     *
345
     * @return \TechDivision\Import\Customer\Address\Actions\CustomerAddressTextActionInterface The action instance
346
     */
347
    public function getCustomerAddressTextAction()
348
    {
349
        return $this->customerAddressTextAction;
350
    }
351
352
    /**
353
     * Set's the action with the customer address int attribute CRUD methods.
354
     *
355
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressIntActionInterface $customerAddressIntAction The action with the customer int attriute CRUD methods
356
     *
357
     * @return void
358
     */
359
    public function setCustomerAddressIntAction(CustomerAddressIntActionInterface $customerAddressIntAction)
360
    {
361
        $this->customerAddressIntAction = $customerAddressIntAction;
362
    }
363
364
    /**
365
     * Return's the action with the customer address int attribute CRUD methods.
366
     *
367
     * @return \TechDivision\Import\Customer\Address\Actions\CustomerAddressIntActionInterface The action instance
368
     */
369
    public function getCustomerAddressIntAction()
370
    {
371
        return $this->customerAddressIntAction;
372
    }
373
374
    /**
375
     * Set's the action with the customer address decimal attribute CRUD methods.
376
     *
377
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressDecimalActionInterface $customerAddressDecimalAction The action with the customer decimal attriute CRUD methods
378
     *
379
     * @return void
380
     */
381
    public function setCustomerAddressDecimalAction(CustomerAddressDecimalActionInterface $customerAddressDecimalAction)
382
    {
383
        $this->customerAddressDecimalAction = $customerAddressDecimalAction;
384
    }
385
386
    /**
387
     * Return's the action with the customer address decimal attribute CRUD methods.
388
     *
389
     * @return \TechDivision\Import\Customer\Address\Actions\CustomerAddressDecimalActionInterface The action instance
390
     */
391
    public function getCustomerAddressDecimalAction()
392
    {
393
        return $this->customerAddressDecimalAction;
394
    }
395
396
    /**
397
     * Set's the action with the customer address datetime attribute CRUD methods.
398
     *
399
     * @param \TechDivision\Import\Customer\Address\Actions\CustomerAddressDatetimeActionInterface $customerAddressDatetimeAction The action with the customer datetime attriute CRUD methods
400
     *
401
     * @return void
402
     */
403
    public function setCustomerAddressDatetimeAction(CustomerAddressDatetimeActionInterface $customerAddressDatetimeAction)
404
    {
405
        $this->customerAddressDatetimeAction = $customerAddressDatetimeAction;
406
    }
407
408
    /**
409
     * Return's the action with the customer address datetime attribute CRUD methods.
410
     *
411
     * @return \TechDivision\Import\Customer\Address\Actions\CustomerAddressDatetimeActionInterface The action instance
412
     */
413
    public function getCustomerAddressDatetimeAction()
414
    {
415
        return $this->customerAddressDatetimeAction;
416
    }
417
418
    /**
419
     * Set's the repository to access EAV attribute option values.
420
     *
421
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The repository to access EAV attribute option values
422
     *
423
     * @return void
424
     */
425
    public function setEavAttributeOptionValueRepository(EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository)
426
    {
427
        $this->eavAttributeOptionValueRepository = $eavAttributeOptionValueRepository;
428
    }
429
430
    /**
431
     * Return's the repository to access EAV attribute option values.
432
     *
433
     * @return \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface The repository instance
434
     */
435
    public function getEavAttributeOptionValueRepository()
436
    {
437
        return $this->eavAttributeOptionValueRepository;
438
    }
439
440
    /**
441
     * Set's the repository to access EAV attributes.
442
     *
443
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface $eavAttributeRepository The repository to access EAV attributes
444
     *
445
     * @return void
446
     */
447
    public function setEavAttributeRepository(EavAttributeRepositoryInterface $eavAttributeRepository)
448
    {
449
        $this->eavAttributeRepository = $eavAttributeRepository;
450
    }
451
452
    /**
453
     * Return's the repository to access EAV attributes.
454
     *
455
     * @return \TechDivision\Import\Repositories\EavAttributeRepositoryInterface The repository instance
456
     */
457
    public function getEavAttributeRepository()
458
    {
459
        return $this->eavAttributeRepository;
460
    }
461
462
    /**
463
     * Set's the assembler to load the customer address attributes with.
464
     *
465
     * @param \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler The assembler instance
466
     *
467
     * @return void
468
     */
469
    public function setCustomerAddressAttributeAssembler(CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler)
470
    {
471
        $this->customerAddressAttributeAssembler = $customerAddressAttributeAssembler;
472
    }
473
474
    /**
475
     * Return's the assembler to load the customer address attributes with.
476
     *
477
     * @return \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface The assembler instance
478
     */
479
    public function getCustomerAddressAttributeAssembler()
480
    {
481
        return $this->customerAddressAttributeAssembler;
482
    }
483
484
    /**
485
     * Return's an array with the available EAV attributes for the passed is user defined flag.
486
     *
487
     * @param integer $isUserDefined The flag itself
488
     *
489
     * @return array The array with the EAV attributes matching the passed flag
490
     */
491
    public function getEavAttributeByIsUserDefined($isUserDefined = 1)
492
    {
493
        return $this->getEavAttributeRepository()->findAllByIsUserDefined($isUserDefined);
494
    }
495
496
    /**
497
     * Intializes the existing attributes for the entity with the passed entity ID.
498
     *
499
     * @param integer $entityId The entity ID of the entity to load the attributes for
500
     *
501
     * @return array The entity attributes
502
     */
503
    public function getCustomerAddressAttributesByEntityId($entityId)
504
    {
505
        return $this->getCustomerAddressAttributeAssembler()->getCustomerAddressAttributesByEntityId($entityId);
506
    }
507
508
    /**
509
     * Load's and return's the EAV attribute option value with the passed code, store ID and value.
510
     *
511
     * @param string  $attributeCode The code of the EAV attribute option to load
512
     * @param integer $storeId       The store ID of the attribute option to load
513
     * @param string  $value         The value of the attribute option to load
514
     *
515
     * @return array The EAV attribute option value
516
     */
517
    public function loadEavAttributeOptionValueByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value)
518
    {
519
        return $this->getEavAttributeOptionValueRepository()->findOneByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value);
520
    }
521
522
    /**
523
     * Return's the customer with the passed entity ID.
524
     *
525
     * @param integer $id The entity ID of the customer to return
526
     *
527
     * @return array|null The customer
528
     */
529
    public function loadCustomerAddress($id)
530
    {
531
        return $this->getCustomerAddressRepository()->load($id);
532
    }
533
534
    /**
535
     * Return's the customer with the passed email and website ID.
536
     *
537
     * @param string $email     The email of the customer to return
538
     * @param string $websiteId The website ID of the customer to return
539
     *
540
     * @return array|null The customer
541
     */
542
    public function loadCustomerByEmailAndWebsiteId($email, $websiteId)
543
    {
544
        return $this->getCustomerRepository()->findOneByEmailAndWebsiteId($email, $websiteId);
545
    }
546
547
    /**
548
     * Persist's the passed customer address data and return's the ID.
549
     *
550
     * @param array       $customerAddress The customer data to persist
551
     * @param string|null $name            The name of the prepared statement that has to be executed
552
     *
553
     * @return string The ID of the persisted entity
554
     */
555
    public function persistCustomerAddress($customerAddress, $name = null)
556
    {
557
        return $this->getCustomerAddressAction()->persist($customerAddress, $name);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->getCustomerAddres...customerAddress, $name) targeting TechDivision\Import\Acti...ionInterface::persist() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Bug Best Practice introduced by
The expression return $this->getCustome...customerAddress, $name) returns the type void which is incompatible with the documented return type string.
Loading history...
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

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

557
        return $this->getCustomerAddressAction()->/** @scrutinizer ignore-call */ persist($customerAddress, $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. Please note the @ignore annotation hint above.

Loading history...
558
    }
559
560
    /**
561
     * Persist's the passed customer address varchar attribute.
562
     *
563
     * @param array       $attribute The attribute to persist
564
     * @param string|null $name      The name of the prepared statement that has to be executed
565
     *
566
     * @return void
567
     */
568
    public function persistCustomerAddressVarcharAttribute($attribute, $name = null)
569
    {
570
        $this->getCustomerAddressVarcharAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

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

570
        $this->getCustomerAddressVarcharAction()->/** @scrutinizer ignore-call */ persist($attribute, $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. Please note the @ignore annotation hint above.

Loading history...
571
    }
572
573
    /**
574
     * Persist's the passed customer address integer attribute.
575
     *
576
     * @param array       $attribute The attribute to persist
577
     * @param string|null $name      The name of the prepared statement that has to be executed
578
     *
579
     * @return void
580
     */
581
    public function persistCustomerAddressIntAttribute($attribute, $name = null)
582
    {
583
        $this->getCustomerAddressIntAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

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

583
        $this->getCustomerAddressIntAction()->/** @scrutinizer ignore-call */ persist($attribute, $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. Please note the @ignore annotation hint above.

Loading history...
584
    }
585
586
    /**
587
     * Persist's the passed customer address decimal attribute.
588
     *
589
     * @param array       $attribute The attribute to persist
590
     * @param string|null $name      The name of the prepared statement that has to be executed
591
     *
592
     * @return void
593
     */
594
    public function persistCustomerAddressDecimalAttribute($attribute, $name = null)
595
    {
596
        $this->getCustomerAddressDecimalAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

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

596
        $this->getCustomerAddressDecimalAction()->/** @scrutinizer ignore-call */ persist($attribute, $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. Please note the @ignore annotation hint above.

Loading history...
597
    }
598
599
    /**
600
     * Persist's the passed customer address datetime attribute.
601
     *
602
     * @param array       $attribute The attribute to persist
603
     * @param string|null $name      The name of the prepared statement that has to be executed
604
     *
605
     * @return void
606
     */
607
    public function persistCustomerAddressDatetimeAttribute($attribute, $name = null)
608
    {
609
        $this->getCustomerAddressDatetimeAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

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

609
        $this->getCustomerAddressDatetimeAction()->/** @scrutinizer ignore-call */ persist($attribute, $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. Please note the @ignore annotation hint above.

Loading history...
610
    }
611
612
    /**
613
     * Persist's the passed customer address text attribute.
614
     *
615
     * @param array       $attribute The attribute to persist
616
     * @param string|null $name      The name of the prepared statement that has to be executed
617
     *
618
     * @return void
619
     */
620
    public function persistCustomerAddressTextAttribute($attribute, $name = null)
621
    {
622
        $this->getCustomerAddressTextAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

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

622
        $this->getCustomerAddressTextAction()->/** @scrutinizer ignore-call */ persist($attribute, $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. Please note the @ignore annotation hint above.

Loading history...
623
    }
624
625
    /**
626
     * Delete's the entity with the passed attributes.
627
     *
628
     * @param array       $row  The attributes of the entity to delete
629
     * @param string|null $name The name of the prepared statement that has to be executed
630
     *
631
     * @return void
632
     */
633
    public function deleteCustomerAddress($row, $name = null)
634
    {
635
        $this->getCustomerAddressAction()->delete($row, $name);
636
    }
637
638
    /**
639
     * Delete's the customer address datetime attribute with the passed attributes.
640
     *
641
     * @param array       $row  The attributes of the entity to delete
642
     * @param string|null $name The name of the prepared statement that has to be executed
643
     *
644
     * @return void
645
     */
646
    public function deleteCustomerAddressDatetimeAttribute($row, $name = null)
647
    {
648
        $this->getCustomerAddressDatetimeAction()->delete($row, $name);
649
    }
650
651
    /**
652
     * Delete's the customer address decimal attribute with the passed attributes.
653
     *
654
     * @param array       $row  The attributes of the entity to delete
655
     * @param string|null $name The name of the prepared statement that has to be executed
656
     *
657
     * @return void
658
     */
659
    public function deleteCustomerAddressDecimalAttribute($row, $name = null)
660
    {
661
        $this->getCustomerAddressDecimalAction()->delete($row, $name);
662
    }
663
664
    /**
665
     * Delete's the customer address integer attribute with the passed attributes.
666
     *
667
     * @param array       $row  The attributes of the entity to delete
668
     * @param string|null $name The name of the prepared statement that has to be executed
669
     *
670
     * @return void
671
     */
672
    public function deleteCustomerAddressIntAttribute($row, $name = null)
673
    {
674
        $this->getCustomerAddressIntAction()->delete($row, $name);
675
    }
676
677
    /**
678
     * Delete's the customer address text attribute with the passed attributes.
679
     *
680
     * @param array       $row  The attributes of the entity to delete
681
     * @param string|null $name The name of the prepared statement that has to be executed
682
     *
683
     * @return void
684
     */
685
    public function deleteCustomerAddressTextAttribute($row, $name = null)
686
    {
687
        $this->getCustomerAddressTextAction()->delete($row, $name);
688
    }
689
690
    /**
691
     * Delete's the customer address varchar attribute with the passed attributes.
692
     *
693
     * @param array       $row  The attributes of the entity to delete
694
     * @param string|null $name The name of the prepared statement that has to be executed
695
     *
696
     * @return void
697
     */
698
    public function deleteCustomerAddressVarcharAttribute($row, $name = null)
699
    {
700
        $this->getCustomerAddressVarcharAction()->delete($row, $name);
701
    }
702
703
    /**
704
     * Clean-Up the repositories to free memory.
705
     *
706
     * @return void
707
     */
708
    public function cleanUp()
709
    {
710
        // flush the cache
711
    }
712
}
713