本文整理匯總了PHP中Symfony\Component\Console\Application::addError方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::addError方法的具體用法?PHP Application::addError怎麽用?PHP Application::addError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Application
的用法示例。
在下文中一共展示了Application::addError方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: redirect
/**
* Suppress redirections and print any messages
* stored in session flashdata
*
* @param string $location
* @param boolean $method
* @param int|null $statusCode
* @return void
*/
public function redirect($location, $method = false, $statusCode = null)
{
$this->successMessage = null;
$this->errorMessage = null;
$location = str_replace('&', '&', $location);
if (substr_count($location, '?') > 1) {
$location = substr($location, strpos($location, '?') + 1);
}
parse_str(parse_url($location, PHP_URL_QUERY), $this->variables);
$success = ee()->session->flashdata(':new:message_success');
$failure = ee()->session->flashdata(':new:message_failure');
if ($failure) {
$this->app->addError($failure);
$this->errorMessage = $failure;
}
if ($success) {
$this->successMessage = $success;
}
}
示例2: show_user_error
/**
* {@inheritdoc}
*/
public function show_user_error($type, $errors, $heading = '')
{
$this->resetMessages();
if (!is_array($errors)) {
$errors = array($errors);
}
foreach ($errors as $error) {
$this->app->addError($error);
}
$this->errorMessage = implode(PHP_EOL, $errors);
}