本文整理汇总了PHP中Terminus::warning方法的典型用法代码示例。如果您正苦于以下问题:PHP Terminus::warning方法的具体用法?PHP Terminus::warning怎么用?PHP Terminus::warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terminus
的用法示例。
在下文中一共展示了Terminus::warning方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
function error($error)
{
if (!$error) {
return;
}
if (is_string($error) && isset($this->upgrader->strings[$error])) {
$error = $this->upgrader->strings[$error];
}
// TODO: show all errors, not just the first one
\Terminus::warning($error);
}
示例2: success_or_failure
protected function success_or_failure($r)
{
list($type, $msg) = $r;
if ('success' == $type) {
\Terminus::success($msg);
$status = 0;
} else {
\Terminus::warning($msg);
$status = 1;
}
return $status;
}
示例3: get_many
/**
* @param array The raw CLI arguments
* @return array The list of found items
*/
public function get_many($args)
{
$items = array();
foreach ($args as $arg) {
$item = $this->get($arg);
if ($item) {
$items[] = $item;
} else {
\Terminus::warning(sprintf($this->msg, $arg));
}
}
return $items;
}
示例4: validate_args
/**
* @return array list of invalid $assoc_args keys to unset
*/
private function validate_args($args, $assoc_args, $extra_args)
{
$synopsis = $this->get_synopsis();
if (!$synopsis) {
return array();
}
$validator = new \Terminus\SynopsisValidator($synopsis);
$cmd_path = implode(' ', get_path($this));
foreach ($validator->get_unknown() as $token) {
\Terminus::warning(sprintf("The `%s` command has an invalid synopsis part: %s", $cmd_path, $token));
}
if (!$validator->enough_positionals($args)) {
$this->show_usage();
exit(1);
}
if ($this->name != 'help') {
$invalid = $validator->invalid_positionals($args);
if ($invalid) {
\Terminus::error("Invalid positional value: {$invalid}");
}
}
$unknown_positionals = $validator->unknown_positionals($args);
if (!empty($unknown_positionals)) {
\Terminus::error('Too many positional arguments: ' . implode(' ', $unknown_positionals));
}
list($errors, $to_unset) = $validator->validate_assoc(array_merge(\Terminus::get_config(), $extra_args, $assoc_args));
foreach ($validator->unknown_assoc($assoc_args) as $key) {
$errors['fatal'][] = "unknown --{$key} parameter";
}
if (!empty($errors['fatal'])) {
$out = 'Parameter errors:';
foreach ($errors['fatal'] as $error) {
$out .= "\n " . $error;
}
\Terminus::error($out);
}
array_map('\\Terminus::warning', $errors['warning']);
return $to_unset;
}