Completed
Push — development ( bff125...0f5c1f )
by Fabian
07:22
created

NewsletterSubscriber::isAnonymizable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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
class IntegerNet_Anonymizer_Model_Bridge_Entity_NewsletterSubscriber
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
11
    extends IntegerNet_Anonymizer_Model_Bridge_Entity_Abstract
0 ignored issues
show
Coding Style introduced by
The extends keyword must be on the same line as the class name
Loading history...
12
{
13
14
    protected $_attributesUsedForIdentifier = array(
15
        'customer_id'
16
    );
17
    protected $_formattersByAttribute = array(
18
        'subscriber_email' => 'safeEmail',
19
    );
20
21
    function __construct()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
22
    {
23
        parent::__construct();
24
        $this->_entity = Mage::getModel('newsletter/subscriber');
25
    }
26
27
    function isAnonymizable()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
28
    {
29
        return ! $this->excludedEmailDomains->matches($this->_entity->getData('subscriber_email'));
30
    }
31
32
    /**
33
     * Sets identifier based on current entity
34
     *
35
     * @return void
36
     */
37
    protected function _setIdentifier()
38
    {
39
        $this->_identifier = $this->_entity->getCustomerId() ?: $this->_entity->getEmail();
40
    }
41
42
    /**
43
     * Returns name of entity as translatable string
44
     *
45
     * @return string
46
     */
47
    function getEntityName()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
48
    {
49
        return 'Newsletter Subscriber';
50
    }
51
52
53
}