foreach ($scripts as $script) {
$grader = Grader::getInstance();
$grader->setApplicantId($script['applicant_id'])
->setHandler($x)
->doGrading();
}
平地机班(单身班)
public function setHandler($x)
{
$this->validateHandler($x);
}
public function validateHandler($x)
{
$this->handleError("Invalid Handler");
return $this;
}
public function handleError($message)
{
}
我如何编写handleError函数以使其停止当前执行,这意味着永远不会到达validateHandler函数中的return $this,将错误消息打印到屏幕上,但是for循环不会停止运行?