Chris@0: getExitCode(); Chris@0: } Chris@0: Chris@0: $hooks = [ Chris@0: HookManager::STATUS_DETERMINER, Chris@0: ]; Chris@0: // If the result does not implement ExitCodeInterface, Chris@0: // then we'll see if there is a determiner that can Chris@0: // extract a status code from the result. Chris@0: $determiners = $this->getHooks($hooks); Chris@0: foreach ($determiners as $determiner) { Chris@0: $status = $this->callDeterminer($determiner, $result); Chris@0: if (isset($status)) { Chris@0: return $status; Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: protected function callDeterminer($determiner, $result) Chris@0: { Chris@0: if ($determiner instanceof StatusDeterminerInterface) { Chris@0: return $determiner->determineStatusCode($result); Chris@0: } Chris@0: if (is_callable($determiner)) { Chris@0: return $determiner($result); Chris@0: } Chris@0: } Chris@0: }