public static checkCallable ( callable $callable, string $type, string $info, |
||
$callable | callable | |
$type | string | a type description of the callable eg: State::CALLABLE_ENTRY |
$info | string | extra info for exception message purposes |
$context | optional: the context the callable is called in | |
Результат | boolean |
/** * calls the $callable as part of the transition * @param callable $callable * @param Context $context * @throws Exception in case of an invalid callable */ protected function callCallable($callable, Context $context, $type = 'n/a') { //in case it is a guard callable we need to return true/false if ($callable != self::CALLABLE_NULL) { Utils::checkCallable($callable, $type, "transition: " . $this, $context); return (bool) call_user_func($callable, $context->getEntity()); } return true; }
/** * calls a $callable if it exists, with the arguments $context->getEntity() * @param callable $callable * @param Context $context * @param string $type the type of callable (self::CALLABLE_ENTRY | self::CALLABLE_EXIT) */ protected function callCallable($callable, Context $context, $type = 'n/a') { if ($callable != self::CALLABLE_NULL) { Utils::checkCallable($callable, $type, $this, $context); call_user_func($callable, $context->getEntity()); } }