Completed
Push — master ( a97add...702095 )
by Aimeos
02:48
created

Ezpublish::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 2
eloc 7
nc 2
nop 6
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015
6
 * @package MShop
7
 * @subpackage Customer
8
 */
9
10
11
namespace Aimeos\MShop\Customer\Item;
12
13
14
/**
15
 * Ezpublish customer item
16
 *
17
 * @package MShop
18
 * @subpackage Customer
19
 */
20
class Ezpublish extends Standard implements Iface
21
{
22
	private $password = '';
23
	private $helper;
24
25
26
	/**
27
	 * Initializes the customer item object
28
	 *
29
	 * @param \Aimeos\MShop\Common\Item\Address\Iface $address Payment address item object
30
	 * @param array $values List of attributes that belong to the customer item
31
	 * @param \Aimeos\MShop\Common\Lists\Item\Iface[] $listItems List of list items
32
	 * @param \Aimeos\MShop\Common\Item\Iface[] $refItems List of referenced items
33
	 * @param string $salt Password salt (optional)
34
	 * @param \Aimeos\MShop\Common\Item\Helper\Password\Iface|null $helper Password encryption helper object
35
	 */
36
	public function __construct( \Aimeos\MShop\Common\Item\Address\Iface $address, array $values = array(),
37
		array $listItems = array(), array $refItems = array(), $salt = '',
38
		\Aimeos\MShop\Common\Item\Helper\Password\Iface $helper = null )
39
	{
40
		parent::__construct( $address, $values, $listItems, $refItems );
41
42
		if( isset( $values['customer.password'] ) ) {
43
			$this->password = $values['customer.password'];
44
		}
45
46
		$this->helper = $helper;
47
	}
48
49
50
	/**
51
	 * Returns the password of the customer item
52
	 *
53
	 * @return string
54
	 */
55
	public function getPassword()
56
	{
57
		return $this->password;
58
	}
59
60
61
	/**
62
	 * Sets the password of the customer item
63
	 *
64
	 * @param string $value password of the customer item
65
	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls
66
	 */
67
	public function setPassword( $value )
68
	{
69
		if( $value == $this->getPassword() ) { return $this; }
70
71
		if( $this->helper !== null ) {
72
			$value = $this->helper->encode( $value, $this->getCode() );
73
		}
74
75
		$this->password = (string) $value;
76
		$this->setModified();
77
78
		return $this;
79
	}
80
}
81