18 abstract class BaseCommand extends \Symfony\Component\Console\Command\Command {
46 $helper = $this->getHelper(
'question');
48 $question =
trim($question);
49 $question =
rtrim($question,
':');
51 $question .=
" [{$default}]";
56 $q =
new Question($question,
$default);
60 $q->setHiddenFallback(
false);
68 $q->setMaxAttempts(2);
71 return $helper->ask($this->input, $this->output, $q);
82 VarDumper::dump(
$data);
94 $formatter =
new FormatterHelper();
97 case LogLevel::EMERGENCY:
98 case LogLevel::CRITICAL:
100 case LogLevel::ERROR:
104 case LogLevel::WARNING:
147 return $this->input->getOption(
$name);
158 return $this->input->getArgument(
$name);
170 if (empty($answer)) {
184 foreach ($registers as $prop => $values) {
185 if (!empty($values)) {
186 foreach ($values as $msg) {
187 $prop ==
'error' ? $this->
error($msg) : $this->
notice($msg);
Exception thrown if an error which can only be found on runtime occurs.
ask($question, $default=null, $hidden=false, $required=true)
Ask a question.
if(!$user||!$user->canDelete()) $name
Adds interaction to a console command.
error($message)
Print an error.
notice($message)
Print a notce.
if(!$entity instanceof\ElggUser) $data
trait Loggable
Enables adding a logger.
dumpRegisters()
Dump and output system and error messages.
write($messages, $level=LogLevel::INFO)
Write messages to output buffer.
assertNotEmpty($answer)
Question validator for required user response.
_elgg_services()
Get the global service provider.
argument($name)
Returns argument value.
dump($data)
Dump a variable.
option($name)
Returns option value.