-
Notifications
You must be signed in to change notification settings - Fork 11
HP-1631: added into Customer entity state #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 7 commits
96029e2
0b6a488
302f89d
d54f6d9
2b04c3a
7c1611c
a8886bc
ca0fe01
6a368f5
ebdf697
9828d4c
b34a233
1e0f18e
41cacd7
22c85c2
37c07ba
dfb7231
c9a4c9b
2981ac3
183a7dc
04a6a3c
7006e78
db98bad
dd9c18c
a172483
18bd6e5
2da650c
11e129f
9b70aed
993a5ec
49f91c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?php declare(strict_types=1); | ||
|
|
||
| namespace hiqdev\php\billing\customer; | ||
|
|
||
| enum CustomerState: string | ||
| { | ||
| case BLOCKED = 'blocked'; | ||
| case DELETED = 'deleted'; | ||
| case NEW = 'new'; | ||
| case OK = 'ok'; | ||
|
|
||
| public static function isDeleted(CustomerInterface $customer): bool | ||
| { | ||
| return self::tryFrom((string)$customer->getState()) === self::DELETED; | ||
| } | ||
| } | ||
|
Comment on lines
+7
to
+67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider converting to an Enum in the future. As suggested in the past review comments, converting this class to an Enum could provide additional benefits such as type safety and improved readability. If possible, consider this refactoring in the future, ensuring that it doesn't introduce errors in other parts of the system, such as |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a more specific exception type for invalid states.
Consider using
InvalidArgumentExceptioninstead of the genericExceptionfor better clarity and error handling.Committable suggestion