Skip to content

Commit

Permalink
Update Machine.php
Browse files Browse the repository at this point in the history
  • Loading branch information
cybersai authored May 5, 2020
1 parent 0d28499 commit d6f8732
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Machine.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ public function run()
throw_if(! class_exists($active), Exception::class, 'Active State Class needs to be set before ussd machine can run. It may be that your session has ended.');

$activeClass = new $active;
$activeClass->setRecord($this->record);

$state = $activeClass->next($this->input);

throw_if(! class_exists($state), Exception::class, 'Continuing State Class needs to be set before ussd machine can run. It may be that your session has ended.');

$stateClass = new $state;

$stateClass->setRecord($this->record);

$this->record->set('__active', $state);
} else {
throw_if(! class_exists($this->initialState), Exception::class, 'Initial State Class needs to be set before ussd machine can run.');
Expand Down Expand Up @@ -85,4 +86,4 @@ private function saveParameters()
$this->saveParameter('network', $this->network);
$this->saveParameter('input', $this->input);
}
}
}

0 comments on commit d6f8732

Please sign in to comment.