Abstract   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 38
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A _setIdentifier() 0 14 3
1
<?php
2
/**
3
 * integer_net Magento Module
4
 *
5
 * @category   IntegerNet
6
 * @package    IntegerNet_Anonymizer
7
 * @copyright  Copyright (c) 2015 integer_net GmbH (http://www.integer-net.de/)
8
 * @author     Fabian Schmengler <[email protected]>
9
 */
10
abstract class IntegerNet_Anonymizer_Model_Bridge_Entity_Address_Abstract
11
    extends IntegerNet_Anonymizer_Model_Bridge_Entity_Abstract
12
{
13
    protected $_formattersByAttribute = array(
14
        'firstname' => 'firstName',
15
        'lastname' => 'lastName',
16
        'middlename' => 'firstName',
17
        'prefix' => 'title',
18
        'suffix' => 'suffix',
19
        'company' => 'company',
20
        'city' => 'city',
21
        'street' => 'streetAddress',
22
        'telephone' => 'phoneNumber',
23
        'fax' => 'phoneNumber',
24
        'vat_id' => 'randomNumber' // 'vat' provider is not implemented for most counries
25
    );
26
27
    /**
28
     * Sets identifier based on current entity
29
     *
30
     * @return void
31
     */
32
    protected function _setIdentifier()
33
    {
34
        $customerId = $this->_entity->getCustomerId();
35
        if ($customerId) {
36
            $this->_identifier = $customerId;
37
            return;
38
        }
39
        $entityId = $this->_entity->getId();
40
        if ($entityId) {
41
            $this->_identifier = $this->getEntityName() . $entityId;
42
            return;
43
        }
44
        $this->_identifier = null;
45
    }
46
47
}