Skip to main content
3 events
when toggle format what by license comment
Dec 7, 2021 at 7:03 comment added Bart van Ingen Schenau @MKJ, another approach is that the login blockage caused by a wrong state of billing (or the company) causes the User to go into a new state where login gets blocked. Then you transfer the if conditions into a more complex statemachine.
Dec 7, 2021 at 2:31 comment added Khuram Thanks for the answer. But if I use this approach then I will have make conditions it will be get complex if I have one more object say billing, with two states paid and unpaid. Then I will have to check like this: if ($company->canUserLogin() && $billing->canUserLogin()) { $user->state->login();} Then don't I am back to place I had started: "Remove conditions with Polymorphism".?
Dec 6, 2021 at 9:45 history answered Bart van Ingen Schenau CC BY-SA 4.0