Closed christophervalles closed 10 years ago
It looks like your latest change no longer throws exceptions when invalid states are encountered. I liked the idea of throwing exceptions for those cases. I suggest:
_assertState($state)
method that uses the now public hasState($state)
method to check if the state is valid. If it's not, it throws an exception.hasState($state)
to instead just use _assertState($state)
up front to validate the state. Because a failure will raise an exception, there's no need to test a return value.What do you think?
Dead/stale PR
Hi,
My name is Christopher, I work in London from a Japanese videogame company and I improved the FSM package for one of our internal tools.
Basically I updated the code for PHP5, removed the dependency between the FSM_GraphViz and FSM using Reflexion so now FSM_GraphViz do not have to extend FSM and FSM can have proper attribute visibility.
Also, I added states management and validation so now when you add transitions the machine validates that the states exists and you're not creating transitions from/to unknown states.
Finally, I added the ability to export to png/dot/custom file and to be able to load a state machine from the custom file and recreate everything.
I fully tested the FSM package using PHPunit and updated the documentation manually.
Hope this improves the package and get accepted!
King regards