Skip to content

Commit 96029e2

Browse files
HP-1631: added into Customer entity state
1 parent 7940cfa commit 96029e2

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/customer/Customer.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,17 @@ class Customer implements CustomerInterface
3737
*/
3838
protected $sellers = [];
3939

40-
public function __construct($id, $login, CustomerInterface $seller = null)
40+
/**
41+
* @var string|null
42+
*/
43+
protected ?string $state;
44+
45+
public function __construct($id, $login, CustomerInterface $seller = null, ?string $state = null)
4146
{
4247
$this->id = $id;
4348
$this->login = $login;
4449
$this->seller = $seller;
50+
$this->state = $state;
4551
}
4652

4753
public function getId()
@@ -73,6 +79,19 @@ public function getSeller()
7379
return $this->seller;
7480
}
7581

82+
/**
83+
* {@inheritdoc}
84+
*/
85+
public function getState(): ?string
86+
{
87+
return $this->state;
88+
}
89+
90+
public function isDeleted(): bool
91+
{
92+
return $this->state === 'deleted';
93+
}
94+
7695
public static function fromArray(array $info)
7796
{
7897
if (!empty($info['seller_id']) && !empty($info['seller'])) {

src/customer/CustomerInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,12 @@ public function getLogin();
3535
* @return static|null
3636
*/
3737
public function getSeller();
38+
39+
/**
40+
* Get Customer state.
41+
* @return null|string
42+
*/
43+
public function getState(): ?string;
44+
45+
public function isDeleted(): bool;
3846
}

0 commit comments

Comments
 (0)