CustomerAddressBunchProcessor::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 27
ccs 0
cts 13
cp 0
rs 9.8666
cc 1
nc 1
nop 13
crap 2

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
 * PHP version 7
7
 *
8
 * @author    Tim Wagner <[email protected]>
9
 * @copyright 2018 TechDivision GmbH <[email protected]>
10
 * @license   https://opensource.org/licenses/MIT
11
 * @link      https://github.com/techdivision/import-customer-address
12
 * @link      http://www.techdivision.com
13
 */
14
15
namespace TechDivision\Import\Customer\Address\Services;
16
17
use TechDivision\Import\Dbal\Actions\ActionInterface;
18
use TechDivision\Import\Dbal\Connection\ConnectionInterface;
19
use TechDivision\Import\Repositories\EavAttributeRepositoryInterface;
20
use TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface;
21
use TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface;
22
use TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface;
23
use TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface;
24
use TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface;
25
26
/**
27
 * The customer address bunch processor implementation.
28
 *
29
 * @author    Tim Wagner <[email protected]>
30
 * @copyright 2018 TechDivision GmbH <[email protected]>
31
 * @license   https://opensource.org/licenses/MIT
32
 * @link      https://github.com/techdivision/import-customer-address
33
 * @link      http://www.techdivision.com
34
 */
35
class CustomerAddressBunchProcessor implements CustomerAddressBunchProcessorInterface
36
{
37
38
    /**
39
     * A PDO connection initialized with the values from the Doctrine EntityManager.
40
     *
41
     * @var \TechDivision\Import\Dbal\Connection\ConnectionInterface
42
     */
43
    protected $connection;
44
45
    /**
46
     * The repository to access EAV attribute option values.
47
     *
48
     * @var \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface
49
     */
50
    protected $eavAttributeOptionValueRepository;
51
52
    /**
53
     * The repository to access customer data.
54
     *
55
     * @var \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface
56
     */
57
    protected $customerRepository;
58
59
    /**
60
     * The repository to access customer address address data.
61
     *
62
     * @var \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface
63
     */
64
    protected $customerAddressRepository;
65
66
    /**
67
     * The repository to access EAV attributes.
68
     *
69
     * @var \TechDivision\Import\Repositories\EavAttributeRepositoryInterface
70
     */
71
    protected $eavAttributeRepository;
72
73
    /**
74
     * The repository to access EAV attributes.
75
     *
76
     * @var \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface
77
     */
78
    protected $eavEntityTypeRepository;
79
80
    /**
81
     * The action for customer address CRUD methods.
82
     *
83
     * @var \TechDivision\Import\Dbal\Actions\ActionInterface
84
     */
85
    protected $customerAddressAction;
86
87
    /**
88
     * The action for customer address varchar attribute CRUD methods.
89
     *
90
     * @var \TechDivision\Import\Dbal\Actions\ActionInterface
91
     */
92
    protected $customerAddressVarcharAction;
93
94
    /**
95
     * The action for customer address text attribute CRUD methods.
96
     *
97
     * @var \TechDivision\Import\Dbal\Actions\ActionInterface
98
     */
99
    protected $customerAddressTextAction;
100
101
    /**
102
     * The action for customer address int attribute CRUD methods.
103
     *
104
     * @var \TechDivision\Import\Dbal\Actions\ActionInterface
105
     */
106
    protected $customerAddressIntAction;
107
108
    /**
109
     * The action for customer address decimal attribute CRUD methods.
110
     *
111
     * @var \\TechDivision\Import\Dbal\Actions\ActionInterface
0 ignored issues
show
Bug introduced by
The type \TechDivision\Import\Dbal\Actions\ActionInterface 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...
112
     */
113
    protected $customerAddressDecimalAction;
114
115
    /**
116
     * The action for customer address datetime attribute CRUD methods.
117
     *
118
     * @var \TechDivision\Import\Dbal\Actions\ActionInterface
119
     */
120
    protected $customerAddressDatetimeAction;
121
122
    /**
123
     * The assembler to load the customer address attributes with.
124
     *
125
     * @var \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface
126
     */
127
    protected $customerAddressAttributeAssembler;
128
129
    /**
130
     * Initialize the processor with the necessary assembler and repository instances.
131
     *
132
     * @param \TechDivision\Import\Dbal\Connection\ConnectionInterface                                    $connection                        The connection to use
133
     * @param \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler The customer address attribute assembler to use
134
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface                $eavAttributeOptionValueRepository The EAV attribute option value repository to use
135
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface                           $eavAttributeRepository            The EAV attribute repository to use
136
     * @param \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface                      $customerRepository                The customer repository to use
137
     * @param \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface       $customerAddressRepository         The customer address repository to use
138
     * @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface                          $eavEntityTypeRepository           The EAV entity type repository to use
139
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                                           $customerAddressAction             The customer address action to use
140
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                                           $customerAddressDatetimeAction     The customer address datetime action to use
141
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                                           $customerAddressDecimalAction      The customer address decimal action to use
142
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                                           $customerAddressIntAction          The customer address integer action to use
143
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                                           $customerAddressTextAction         The customer address text action to use
144
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                                           $customerAddressVarcharAction      The customer address varchar action to use
145
     */
146
    public function __construct(
147
        ConnectionInterface $connection,
148
        CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler,
149
        EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository,
150
        EavAttributeRepositoryInterface $eavAttributeRepository,
151
        CustomerRepositoryInterface $customerRepository,
152
        CustomerAddressRepositoryInterface $customerAddressRepository,
153
        EavEntityTypeRepositoryInterface $eavEntityTypeRepository,
0 ignored issues
show
Unused Code introduced by
The parameter $eavEntityTypeRepository is not used and could be removed. ( Ignorable by Annotation )

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

153
        /** @scrutinizer ignore-unused */ EavEntityTypeRepositoryInterface $eavEntityTypeRepository,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
154
        ActionInterface $customerAddressAction,
155
        ActionInterface $customerAddressDatetimeAction,
156
        ActionInterface $customerAddressDecimalAction,
157
        ActionInterface $customerAddressIntAction,
158
        ActionInterface $customerAddressTextAction,
159
        ActionInterface $customerAddressVarcharAction
160
    ) {
161
        $this->setConnection($connection);
162
        $this->setCustomerAddressAttributeAssembler($customerAddressAttributeAssembler);
163
        $this->setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository);
164
        $this->setEavAttributeRepository($eavAttributeRepository);
165
        $this->setCustomerRepository($customerRepository);
166
        $this->setCustomerAddressRepository($customerAddressRepository);
167
        $this->setCustomerAddressAction($customerAddressAction);
168
        $this->setCustomerAddressDatetimeAction($customerAddressDatetimeAction);
169
        $this->setCustomerAddressDecimalAction($customerAddressDecimalAction);
170
        $this->setCustomerAddressIntAction($customerAddressIntAction);
171
        $this->setCustomerAddressTextAction($customerAddressTextAction);
172
        $this->setCustomerAddressVarcharAction($customerAddressVarcharAction);
173
    }
174
175
    /**
176
     * Set's the passed connection.
177
     *
178
     * @param \TechDivision\Import\Dbal\Connection\ConnectionInterface $connection The connection to set
179
     *
180
     * @return void
181
     */
182
    public function setConnection(ConnectionInterface $connection)
183
    {
184
        $this->connection = $connection;
185
    }
186
187
    /**
188
     * Return's the connection.
189
     *
190
     * @return \TechDivision\Import\Dbal\Connection\ConnectionInterface The connection instance
191
     */
192
    public function getConnection()
193
    {
194
        return $this->connection;
195
    }
196
197
    /**
198
     * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO
199
     * object instance are not committed until you end the transaction by calling CustomerProcessor::commit().
200
     * Calling CustomerProcessor::rollBack() will roll back all changes to the database and return the connection
201
     * to autocommit mode.
202
     *
203
     * @return boolean Returns TRUE on success or FALSE on failure
204
     * @link http://php.net/manual/en/pdo.begintransaction.php
205
     */
206
    public function beginTransaction()
207
    {
208
        return $this->connection->beginTransaction();
209
    }
210
211
    /**
212
     * Commits a transaction, returning the database connection to autocommit mode until the next call to
213
     * CustomerProcessor::beginTransaction() starts a new transaction.
214
     *
215
     * @return boolean Returns TRUE on success or FALSE on failure
216
     * @link http://php.net/manual/en/pdo.commit.php
217
     */
218
    public function commit()
219
    {
220
        return $this->connection->commit();
0 ignored issues
show
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...
Bug introduced by
Are you sure the usage of $this->connection->commit() targeting TechDivision\Import\Dbal...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...
221
    }
222
223
    /**
224
     * Rolls back the current transaction, as initiated by CustomerProcessor::beginTransaction().
225
     *
226
     * If the database was set to autocommit mode, this function will restore autocommit mode after it has
227
     * rolled back the transaction.
228
     *
229
     * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition
230
     * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
231
     * COMMIT will prevent you from rolling back any other changes within the transaction boundary.
232
     *
233
     * @return boolean Returns TRUE on success or FALSE on failure
234
     * @link http://php.net/manual/en/pdo.rollback.php
235
     */
236
    public function rollBack()
237
    {
238
        return $this->connection->rollBack();
239
    }
240
241
    /**
242
     * Set's the repository to load the customers with.
243
     *
244
     * @param \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface $customerRepository The repository instance
245
     *
246
     * @return void
247
     */
248
    public function setCustomerRepository(CustomerRepositoryInterface $customerRepository)
249
    {
250
        $this->customerRepository = $customerRepository;
251
    }
252
253
    /**
254
     * Return's the repository to load the customers with.
255
     *
256
     * @return \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface The repository instance
257
     */
258
    public function getCustomerRepository()
259
    {
260
        return $this->customerRepository;
261
    }
262
263
    /**
264
     * Set's the repository to load the customer addresses with.
265
     *
266
     * @param \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface $customerAddressRepository The repository instance
267
     *
268
     * @return void
269
     */
270
    public function setCustomerAddressRepository(CustomerAddressRepositoryInterface $customerAddressRepository)
271
    {
272
        $this->customerAddressRepository = $customerAddressRepository;
273
    }
274
275
    /**
276
     * Return's the repository to load the customer addresses with.
277
     *
278
     * @return \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface The repository instance
279
     */
280
    public function getCustomerAddressRepository()
281
    {
282
        return $this->customerAddressRepository;
283
    }
284
285
    /**
286
     * Set's the action with the customer address CRUD methods.
287
     *
288
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerAddressAction The action with the customer CRUD methods
289
     *
290
     * @return void
291
     */
292
    public function setCustomerAddressAction(ActionInterface $customerAddressAction)
293
    {
294
        $this->customerAddressAction = $customerAddressAction;
295
    }
296
297
    /**
298
     * Return's the action with the customer address CRUD methods.
299
     *
300
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
301
     */
302
    public function getCustomerAddressAction()
303
    {
304
        return $this->customerAddressAction;
305
    }
306
307
    /**
308
     * Set's the action with the customer address varchar attribute CRUD methods.
309
     *
310
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerAddressVarcharAction The action with the customer varchar attriute CRUD methods
311
     *
312
     * @return void
313
     */
314
    public function setCustomerAddressVarcharAction(ActionInterface $customerAddressVarcharAction)
315
    {
316
        $this->customerAddressVarcharAction = $customerAddressVarcharAction;
317
    }
318
319
    /**
320
     * Return's the action with the customer address varchar attribute CRUD methods.
321
     *
322
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
323
     */
324
    public function getCustomerAddressVarcharAction()
325
    {
326
        return $this->customerAddressVarcharAction;
327
    }
328
329
    /**
330
     * Set's the action with the customer address text attribute CRUD methods.
331
     *
332
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerAddressTextAction The action with the customer text attriute CRUD methods
333
     *
334
     * @return void
335
     */
336
    public function setCustomerAddressTextAction(ActionInterface $customerAddressTextAction)
337
    {
338
        $this->customerAddressTextAction = $customerAddressTextAction;
339
    }
340
341
    /**
342
     * Return's the action with the customer address text attribute CRUD methods.
343
     *
344
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
345
     */
346
    public function getCustomerAddressTextAction()
347
    {
348
        return $this->customerAddressTextAction;
349
    }
350
351
    /**
352
     * Set's the action with the customer address int attribute CRUD methods.
353
     *
354
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerAddressIntAction The action with the customer int attriute CRUD methods
355
     *
356
     * @return void
357
     */
358
    public function setCustomerAddressIntAction(ActionInterface $customerAddressIntAction)
359
    {
360
        $this->customerAddressIntAction = $customerAddressIntAction;
361
    }
362
363
    /**
364
     * Return's the action with the customer address int attribute CRUD methods.
365
     *
366
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
367
     */
368
    public function getCustomerAddressIntAction()
369
    {
370
        return $this->customerAddressIntAction;
371
    }
372
373
    /**
374
     * Set's the action with the customer address decimal attribute CRUD methods.
375
     *
376
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerAddressDecimalAction The action with the customer decimal attriute CRUD methods
377
     *
378
     * @return void
379
     */
380
    public function setCustomerAddressDecimalAction(ActionInterface $customerAddressDecimalAction)
381
    {
382
        $this->customerAddressDecimalAction = $customerAddressDecimalAction;
0 ignored issues
show
Documentation Bug introduced by
It seems like $customerAddressDecimalAction of type TechDivision\Import\Dbal\Actions\ActionInterface is incompatible with the declared type \TechDivision\Import\Dbal\Actions\ActionInterface of property $customerAddressDecimalAction.

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...
383
    }
384
385
    /**
386
     * Return's the action with the customer address decimal attribute CRUD methods.
387
     *
388
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
389
     */
390
    public function getCustomerAddressDecimalAction()
391
    {
392
        return $this->customerAddressDecimalAction;
393
    }
394
395
    /**
396
     * Set's the action with the customer address datetime attribute CRUD methods.
397
     *
398
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerAddressDatetimeAction The action with the customer datetime attriute CRUD methods
399
     *
400
     * @return void
401
     */
402
    public function setCustomerAddressDatetimeAction(ActionInterface $customerAddressDatetimeAction)
403
    {
404
        $this->customerAddressDatetimeAction = $customerAddressDatetimeAction;
405
    }
406
407
    /**
408
     * Return's the action with the customer address datetime attribute CRUD methods.
409
     *
410
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
411
     */
412
    public function getCustomerAddressDatetimeAction()
413
    {
414
        return $this->customerAddressDatetimeAction;
415
    }
416
417
    /**
418
     * Set's the repository to access EAV attribute option values.
419
     *
420
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The repository to access EAV attribute option values
421
     *
422
     * @return void
423
     */
424
    public function setEavAttributeOptionValueRepository(EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository)
425
    {
426
        $this->eavAttributeOptionValueRepository = $eavAttributeOptionValueRepository;
427
    }
428
429
    /**
430
     * Return's the repository to access EAV attribute option values.
431
     *
432
     * @return \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface The repository instance
433
     */
434
    public function getEavAttributeOptionValueRepository()
435
    {
436
        return $this->eavAttributeOptionValueRepository;
437
    }
438
439
    /**
440
     * Set's the repository to access EAV attributes.
441
     *
442
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface $eavAttributeRepository The repository to access EAV attributes
443
     *
444
     * @return void
445
     */
446
    public function setEavAttributeRepository(EavAttributeRepositoryInterface $eavAttributeRepository)
447
    {
448
        $this->eavAttributeRepository = $eavAttributeRepository;
449
    }
450
451
    /**
452
     * Return's the repository to access EAV attributes.
453
     *
454
     * @return \TechDivision\Import\Repositories\EavAttributeRepositoryInterface The repository instance
455
     */
456
    public function getEavAttributeRepository()
457
    {
458
        return $this->eavAttributeRepository;
459
    }
460
461
    /**
462
     * Set's the repository to access EAV entity types.
463
     *
464
     * @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface $eavEntityTypeRepository The repository to access EAV entity types
465
     *
466
     * @return void
467
     */
468
    public function setEavEntityTypeRepository(EavEntityTypeRepositoryInterface $eavEntityTypeRepository)
469
    {
470
        $this->eavEntityTypeRepository = $eavEntityTypeRepository;
471
    }
472
473
    /**
474
     * Return's the repository to access EAV entity types.
475
     *
476
     * @return \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface The repository instance
477
     */
478
    public function getEavEntityTypeRepository()
479
    {
480
        return $this->eavAttributeRepository;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->eavAttributeRepository returns the type TechDivision\Import\Repo...buteRepositoryInterface which is incompatible with the documented return type TechDivision\Import\Repo...TypeRepositoryInterface.
Loading history...
481
    }
482
483
    /**
484
     * Set's the assembler to load the customer address attributes with.
485
     *
486
     * @param \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler The assembler instance
487
     *
488
     * @return void
489
     */
490
    public function setCustomerAddressAttributeAssembler(CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler)
491
    {
492
        $this->customerAddressAttributeAssembler = $customerAddressAttributeAssembler;
493
    }
494
495
    /**
496
     * Return's the assembler to load the customer address attributes with.
497
     *
498
     * @return \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface The assembler instance
499
     */
500
    public function getCustomerAddressAttributeAssembler()
501
    {
502
        return $this->customerAddressAttributeAssembler;
503
    }
504
505
    /**
506
     * Return's an array with the available EAV attributes for the passed is user defined flag.
507
     *
508
     * @param integer $isUserDefined The flag itself
509
     *
510
     * @return array The array with the EAV attributes matching the passed flag
511
     */
512
    public function getEavAttributeByIsUserDefined($isUserDefined = 1)
513
    {
514
        return $this->getEavAttributeRepository()->findAllByIsUserDefined($isUserDefined);
515
    }
516
517
    /**
518
     * Intializes the existing attributes for the entity with the passed entity ID.
519
     *
520
     * @param integer $entityId The entity ID of the entity to load the attributes for
521
     *
522
     * @return array The entity attributes
523
     */
524
    public function getCustomerAddressAttributesByEntityId($entityId)
525
    {
526
        return $this->getCustomerAddressAttributeAssembler()->getCustomerAddressAttributesByEntityId($entityId);
527
    }
528
529
    /**
530
     * Load's and return's the EAV attribute option value with the passed entity type ID, code, store ID and value.
531
     *
532
     * @param string  $entityTypeId  The entity type ID of the EAV attribute to load the option value for
533
     * @param string  $attributeCode The code of the EAV attribute option to load
534
     * @param integer $storeId       The store ID of the attribute option to load
535
     * @param string  $value         The value of the attribute option to load
536
     *
537
     * @return array The EAV attribute option value
538
     */
539
    public function loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value)
540
    {
541
        return $this->getEavAttributeOptionValueRepository()->findOneByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value);
542
    }
543
544
    /**
545
     * Return's an EAV entity type with the passed entity type code.
546
     *
547
     * @param string $entityTypeCode The code of the entity type to return
548
     *
549
     * @return array The entity type with the passed entity type code
550
     */
551
    public function loadEavEntityTypeByEntityTypeCode($entityTypeCode)
552
    {
553
        return $this->getEavEntityTypeRepository()->findOneByEntityTypeCode($entityTypeCode);
554
    }
555
556
    /**
557
     * Return's the customer with the passed entity ID.
558
     *
559
     * @param integer $id The entity ID of the customer to return
560
     *
561
     * @return array|null The customer
562
     */
563
    public function loadCustomerAddress($id)
564
    {
565
        return $this->getCustomerAddressRepository()->load($id);
566
    }
567
568
569
    /**
570
     * Return's the customer with the passed increment ID.
571
     *
572
     * @param string|integer $incrementId The increment ID of the customer to return
573
     * @param string|integer $customerId  The entity_id of the customer
574
     *
575
     * @return array|null The customer
576
     */
577
    public function loadCustomerAddressByIncrementId($incrementId, $customerId)
578
    {
579
        return $this->getCustomerAddressRepository()->loadByIncrementIdAndCustomerEntityId($incrementId, $customerId);
580
    }
581
582
    /**
583
     * Return's the customer with the passed email and website ID.
584
     *
585
     * @param string $email     The email of the customer to return
586
     * @param string $websiteId The website ID of the customer to return
587
     *
588
     * @return array|null The customer
589
     */
590
    public function loadCustomerByEmailAndWebsiteId($email, $websiteId)
591
    {
592
        return $this->getCustomerRepository()->findOneByEmailAndWebsiteId($email, $websiteId);
593
    }
594
595
    /**
596
     * Persist's the passed customer address data and return's the ID.
597
     *
598
     * @param array       $customerAddress The customer data to persist
599
     * @param string|null $name            The name of the prepared statement that has to be executed
600
     *
601
     * @return string The ID of the persisted entity
602
     */
603
    public function persistCustomerAddress($customerAddress, $name = null)
604
    {
605
        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\Dbal...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...
Unused Code introduced by
The call to TechDivision\Import\Dbal...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

605
        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...
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...
606
    }
607
608
    /**
609
     * Persist's the passed customer address varchar attribute.
610
     *
611
     * @param array       $attribute The attribute to persist
612
     * @param string|null $name      The name of the prepared statement that has to be executed
613
     *
614
     * @return void
615
     */
616
    public function persistCustomerAddressVarcharAttribute($attribute, $name = null)
617
    {
618
        $this->getCustomerAddressVarcharAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...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

618
        $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...
619
    }
620
621
    /**
622
     * Persist's the passed customer address integer attribute.
623
     *
624
     * @param array       $attribute The attribute to persist
625
     * @param string|null $name      The name of the prepared statement that has to be executed
626
     *
627
     * @return void
628
     */
629
    public function persistCustomerAddressIntAttribute($attribute, $name = null)
630
    {
631
        $this->getCustomerAddressIntAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...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

631
        $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...
632
    }
633
634
    /**
635
     * Persist's the passed customer address decimal attribute.
636
     *
637
     * @param array       $attribute The attribute to persist
638
     * @param string|null $name      The name of the prepared statement that has to be executed
639
     *
640
     * @return void
641
     */
642
    public function persistCustomerAddressDecimalAttribute($attribute, $name = null)
643
    {
644
        $this->getCustomerAddressDecimalAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...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

644
        $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...
645
    }
646
647
    /**
648
     * Persist's the passed customer address datetime attribute.
649
     *
650
     * @param array       $attribute The attribute to persist
651
     * @param string|null $name      The name of the prepared statement that has to be executed
652
     *
653
     * @return void
654
     */
655
    public function persistCustomerAddressDatetimeAttribute($attribute, $name = null)
656
    {
657
        $this->getCustomerAddressDatetimeAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...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

657
        $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...
658
    }
659
660
    /**
661
     * Persist's the passed customer address text attribute.
662
     *
663
     * @param array       $attribute The attribute to persist
664
     * @param string|null $name      The name of the prepared statement that has to be executed
665
     *
666
     * @return void
667
     */
668
    public function persistCustomerAddressTextAttribute($attribute, $name = null)
669
    {
670
        $this->getCustomerAddressTextAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...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

670
        $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...
671
    }
672
673
    /**
674
     * Delete's the entity with the passed attributes.
675
     *
676
     * @param array       $row  The attributes of the entity to delete
677
     * @param string|null $name The name of the prepared statement that has to be executed
678
     *
679
     * @return void
680
     */
681
    public function deleteCustomerAddress($row, $name = null)
682
    {
683
        $this->getCustomerAddressAction()->delete($row, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...tionInterface::delete() 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

683
        $this->getCustomerAddressAction()->/** @scrutinizer ignore-call */ delete($row, $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...
684
    }
685
686
    /**
687
     * Delete's the customer address datetime attribute with the passed attributes.
688
     *
689
     * @param array       $row  The attributes of the entity to delete
690
     * @param string|null $name The name of the prepared statement that has to be executed
691
     *
692
     * @return void
693
     */
694
    public function deleteCustomerAddressDatetimeAttribute($row, $name = null)
695
    {
696
        $this->getCustomerAddressDatetimeAction()->delete($row, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...tionInterface::delete() 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

696
        $this->getCustomerAddressDatetimeAction()->/** @scrutinizer ignore-call */ delete($row, $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...
697
    }
698
699
    /**
700
     * Delete's the customer address decimal attribute with the passed attributes.
701
     *
702
     * @param array       $row  The attributes of the entity to delete
703
     * @param string|null $name The name of the prepared statement that has to be executed
704
     *
705
     * @return void
706
     */
707
    public function deleteCustomerAddressDecimalAttribute($row, $name = null)
708
    {
709
        $this->getCustomerAddressDecimalAction()->delete($row, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...tionInterface::delete() 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

709
        $this->getCustomerAddressDecimalAction()->/** @scrutinizer ignore-call */ delete($row, $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...
710
    }
711
712
    /**
713
     * Delete's the customer address integer attribute with the passed attributes.
714
     *
715
     * @param array       $row  The attributes of the entity to delete
716
     * @param string|null $name The name of the prepared statement that has to be executed
717
     *
718
     * @return void
719
     */
720
    public function deleteCustomerAddressIntAttribute($row, $name = null)
721
    {
722
        $this->getCustomerAddressIntAction()->delete($row, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...tionInterface::delete() 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

722
        $this->getCustomerAddressIntAction()->/** @scrutinizer ignore-call */ delete($row, $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...
723
    }
724
725
    /**
726
     * Delete's the customer address text attribute with the passed attributes.
727
     *
728
     * @param array       $row  The attributes of the entity to delete
729
     * @param string|null $name The name of the prepared statement that has to be executed
730
     *
731
     * @return void
732
     */
733
    public function deleteCustomerAddressTextAttribute($row, $name = null)
734
    {
735
        $this->getCustomerAddressTextAction()->delete($row, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...tionInterface::delete() 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

735
        $this->getCustomerAddressTextAction()->/** @scrutinizer ignore-call */ delete($row, $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...
736
    }
737
738
    /**
739
     * Delete's the customer address varchar attribute with the passed attributes.
740
     *
741
     * @param array       $row  The attributes of the entity to delete
742
     * @param string|null $name The name of the prepared statement that has to be executed
743
     *
744
     * @return void
745
     */
746
    public function deleteCustomerAddressVarcharAttribute($row, $name = null)
747
    {
748
        $this->getCustomerAddressVarcharAction()->delete($row, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Dbal...tionInterface::delete() 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

748
        $this->getCustomerAddressVarcharAction()->/** @scrutinizer ignore-call */ delete($row, $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...
749
    }
750
751
    /**
752
     * Clean-Up the repositories to free memory.
753
     *
754
     * @return void
755
     */
756
    public function cleanUp()
757
    {
758
        // flush the cache
759
    }
760
}
761