/** * @see sfTask */ public function logSection($section, $message, $size = null, $style = 'INFO') { if (null === $this->commandApplication || $this->commandApplication->isVerbose()) { parent::logSection($section, $message, $size, $style); } }
/** * @see askAndValidate() */ public static function doAskAndValidate(sfTask $task, $question, sfValidatorBase $validator, array $options = array()) { if (!is_array($question)) { $question = array($question); } $options = array_merge(array('value' => null, 'attempts' => 3, 'style' => 'QUESTION'), $options); while ($options['attempts']--) { $value = is_null($options['value']) ? $task->ask(isset($error) && 'required' != $error->getCode() ? array_merge(array($error->getMessage(), ''), $question) : $question, isset($error) ? 'ERROR' : $options['style']) : $options['value']; try { $value = $validator->clean($value); return $value; } catch (sfValidatorError $error) { $value = null; } } throw $error; }
protected function outputAsXml(sfTask $task) { echo $task->asXml(); }
public function __construct() { // lazy constructor parent::__construct(new sfEventDispatcher(), new sfFormatter()); }
/** * Registers a task object. * * @param sfTask $task An sfTask object */ public function registerTask(sfTask $task) { if (isset($this->tasks[$task->getFullName()])) { throw new sfCommandException(sprintf('The task named "%s" in "%s" task is already registered by the "%s" task.', $task->getFullName(), get_class($task), get_class($this->tasks[$task->getFullName()]))); } $this->tasks[$task->getFullName()] = $task; foreach ($task->getAliases() as $alias) { if (isset($this->tasks[$alias])) { throw new sfCommandException(sprintf('A task named "%s" is already registered.', $alias)); } $this->tasks[$alias] = $task; } }