pear / FSM

PHP Finite State Machine
http://pear.php.net/package/fsm
MIT License
34 stars 13 forks source link

Improvements on the FSM Package #2

Closed christophervalles closed 10 years ago

christophervalles commented 11 years ago

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

jparise commented 11 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:

What do you think?

CloCkWeRX commented 10 years ago

Dead/stale PR