*/ class StreamOutput extends Output { private $stream; /** * @param resource $stream A stream resource * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) * * @throws InvalidArgumentException When first argument is not a real stream */ public function __construct( $stream, int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null, ) { if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) { throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.'); } $this->stream = $stream; if (null === $decorated) { $decorated = $this->hasColorSupport(); } parent::__construct($verbosity, $decorated, $formatter); } /** * Gets the stream attached to this StreamOutput instance. * * @return resource */ public function getStream() { return $this->stream; } /** * {@inheritdoc} */ protected function doWrite(string $message, bool $newline) { if ($newline) { $message .= \PHP_EOL; } @fwrite($this->stream, $message); fflush($this->stream); } /** * Returns true if the stream supports colorization. * * Colorization is disabled if not supported by the stream: * * This is tricky on Windows, because Cygwin, Msys2 etc emulate pseudo * terminals via named pipes, so we can only check the environment. * * Reference: Composer\XdebugHandler\Process::supportsColor * https://github.com/composer/xdebug-handler * * @return bool true if the stream supports colorization, false otherwise */ protected function hasColorSupport() { // Follow https://no-color.org/ if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) { return false; } if ('Hyper' === getenv('TERM_PROGRAM')) { return true; } if (\DIRECTORY_SEPARATOR === '\\') { return (\function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($this->stream)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } return stream_isatty($this->stream); } } __halt_compiler();----SIGNATURE:----HQI93AR0VdcCjZUTLSsRFxU+kKZFlEdWwmGhe9FuywCcGLI18ig/rHbfazWp0abhshPwMEe6cCreVJsaAOTVQVMOwPBg5xcPE+mEXv49T1GNcs4sb0vKU2Yzh6NdqhJX4fTeGB+Q25E3HLE0QajjuTbGi+z6CgfKsvgB8xbVrx+PxEWrfQgztpa5tVZMeriSTlhmvXFwMZ01A2BgaolKTPo271uKxethHGzSOpKXkSBNhx1gU7vCcbo02I427jxwIL9rJulm+5oqVl29+7a4hNLeY9N28KgGWWQtNjXcm3hYV6QZBG18eistYH9gAi8G8OixpB7ml460OhnLXgs2Wa2Awx5BAHsLgUDQAqCXbZYrRREqUuKHcXhXlVKHAyJPl44erM0hd7OSJ/Ebn8wcqzMzoVKWQtIh2AAN3flPRrLhHcwUyj8hmwpMd6q0f76lS6IBL++1M/UB2GQwbhvfqPTi0fdSdZq/qKSNVnHMbNFpXXR0TxfTmG9pSW+NLcbqBl+3604iyN8Mbg/qa5IN8KjfdgpMhENXZjikN1bBcc/DF/Suje4RBLBrPn/LfYPea/uFTxhAdSV4T/F6OGUhIJANCZINcj9QFI/9NIiufB4vByfhym/tXeNSoBo/rYHq1pnYLHGSu5yshPwpJSez56ErVhuDCepzCGY6/gjq0lg=----ATTACHMENT:----NDQ3NzY4OTYwNDg3NTg0MSAzNjkzNDg0MDM5MzA2ODM5IDUyMDE5NDIwMzczMjQxMDQ=