DEV Community

Discussion on: State Pattern example in PHP

Collapse
 
fippu82 profile image
Philippe • Edited

I don't get it. Where did you implement the logic which says that the door must be closed before the move state can be set?

Collapse
 
mnlwldr profile image
manuel

„Open“ doesn’t implement the method „move“ (github.com/mnlwldr/State-Pattern/b...).
That means when you call the method „move“ it throws an exception because in this state, move is not allowed.