function Output::write
Overrides OutputInterface::write
1 call to Output::write()
- Output::writeln in vendor/
symfony/ console/ Output/ Output.php - Writes a message to the output and adds a newline at the end.
File
-
vendor/
symfony/ console/ Output/ Output.php, line 108
Class
- Output
- Base class for output classes.
Namespace
Symfony\Component\Console\OutputCode
public function write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL) : void {
if (!is_iterable($messages)) {
$messages = [
$messages,
];
}
$types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
$type = $types & $options ?: self::OUTPUT_NORMAL;
$verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
$verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
if ($verbosity > $this->getVerbosity()) {
return;
}
foreach ($messages as $message) {
switch ($type) {
case OutputInterface::OUTPUT_NORMAL:
$message = $this->formatter
->format($message);
break;
case OutputInterface::OUTPUT_RAW:
break;
case OutputInterface::OUTPUT_PLAIN:
$message = strip_tags($this->formatter
->format($message));
break;
}
$this->doWrite($message ?? '', $newline);
}
}