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
|
|
|
|