Skip to content

Commit 302f89d

Browse files
HP-1631: created CustomerState
1 parent 0b6a488 commit 302f89d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/customer/Customer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function getState(): ?string
8989

9090
public function isDeleted(): bool
9191
{
92-
return $this->state === 'deleted';
92+
return CustomerState::isDeleted($this);
9393
}
9494

9595
public static function fromArray(array $info)

src/customer/CustomerState.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace hiqdev\php\billing\customer;
4+
5+
enum CustomerState: string
6+
{
7+
case DELETED = 'deleted';
8+
9+
public static function isDeleted(CustomerInterface $customer): bool
10+
{
11+
return self::tryFrom((string)$customer->getState()) === self::DELETED;
12+
}
13+
}

0 commit comments

Comments
 (0)