public static function checkConfiguration(StateMachine $machine)
{
//TODO: also check the rules and commands
$exceptions = array();
$output = array();
//check state callables
foreach ($machine->getStates() as $state) {
$exceptions[] = self::getExceptionForCheckingCallable($state->getExitCallable(), State::CALLABLE_ENTRY, $state);
$exceptions[] = self::getExceptionForCheckingCallable($state->getEntryCallable(), State::CALLABLE_ENTRY, $state);
}
//check transition callables
foreach ($machine->getTransitions() as $transition) {
$exceptions[] = self::getExceptionForCheckingCallable($transition->getGuardCallable(), Transition::CALLABLE_GUARD, $transition);
$exceptions[] = self::getExceptionForCheckingCallable($transition->getTransitionCallable(), Transition::CALLABLE_TRANSITION, $transition);
}
//get the exceptions
foreach ($exceptions as $e) {
if (is_a($e, '\\Exception')) {
$output[] = $e;
}
}
return $output;
}