Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.
In your Stateful Class, add the stateMachineConfig() method and call initStateMachine() method at initialization (__contruct() method).
Example
| namespace common\components; | |
| use \yii\web\UrlManager as BaseUrlManager; | |
| class UrlManager extends BaseUrlManager { | |
| protected $choice; | |
| public function init() { | |
| Component::init(); |
Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.
In your Stateful Class, add the stateMachineConfig() method and call initStateMachine() method at initialization (__contruct() method).
Example
| function toDeci(fraction) { | |
| var result,wholeNum=0, frac, deci=0; | |
| if(fraction.search('/') >=0){ | |
| if(fraction.search('-') > 0){ | |
| var wholeNum = fraction.split('-'); | |
| frac = wholeNum[1]; | |
| wholeNum = parseInt(wholeNum,10); | |
| }else if(fraction.search(' ') > 0){ | |
| var wholeNum = fraction.split(' '); | |
| fraction = wholeNum[1]; |