/** * Build the machine * * @param MachineBuilder $builder * @return mixed */ public function build(MachineBuilder $builder) { return $builder->create()->state('on', [['flickSwitch' => function ($state) { $state->transition('off'); }]])->state('off', [['flickSwitch' => function ($state) { $state->transition('on'); }]], 1)->transition('on', 'off', true)->get(true); }
/** * Build the machine * * @param MachineBuilder $builder * @return mixed */ public function build(MachineBuilder $builder) { return $builder->create()->state('auto_setup', AutoSetupState::class, State::INITIAL)->state('ready')->transition('auto_setup', 'ready')->get(false); }
/** * Build the machine * * @param MachineBuilder $builder * @return mixed */ public function build(MachineBuilder $builder) { return $builder->create()->state('on', OnState::class)->state('off', OffState::class, State::INITIAL)->transition('on', 'off', true)->get(true); }
/** * Build the machine * * @param MachineBuilder $builder * @return mixed */ public function build(MachineBuilder $builder) { return $builder->create()->state('init', InitialState::class, State::INITIAL)->state('ready', ReadyState::class)->transition('init', 'ready')->get(true); }
/** * Build the machine * * @param MachineBuilder $builder * @return mixed */ public function build(MachineBuilder $builder) { return $builder->create(app()->make(FSM::class))->state('first', FirstState::class)->state('second', SecondState::class)->state('third', ThirdState::class)->state('ready', ReadyState::class)->transition('first', 'second', true)->transition('first', 'third', true)->transition('second', 'third', true)->transition('first', 'ready')->transition('second', 'ready')->transition('third', 'ready')->get(false); }