*/ class BufferIO extends ConsoleIO { public function __construct( string $input = '', int $verbosity = StreamOutput::VERBOSITY_NORMAL, ?OutputFormatterInterface $formatter = null, ) { $input = new StringInput($input); $input->setInteractive(false); $stream = fopen('php://memory', 'rw'); if ($stream === false) { throw new \RuntimeException('Unable to open memory output stream'); } $output = new StreamOutput($stream, $verbosity, $formatter !== null ? $formatter->isDecorated() : false, $formatter); parent::__construct($input, $output, new HelperSet([ new QuestionHelper(), ])); } /** * @return string output */ public function getOutput(): string { assert($this->output instanceof StreamOutput); fseek($this->output->getStream(), 0); $output = (string) stream_get_contents($this->output->getStream()); $output = Preg::replaceCallback("{(?<=^|\n|\x08)(.+?)(\x08+)}", static function ($matches): string { $pre = strip_tags($matches[1]); if (strlen($pre) === strlen($matches[2])) { return ''; } // TODO reverse parse the string, skipping span tags and \033\[([0-9;]+)m(.*?)\033\[0m style blobs return rtrim($matches[1])."\n"; }, $output); return $output; } /** * @param string[] $inputs * * @see createStream */ public function setUserInputs(array $inputs): void { if (!$this->input instanceof StreamableInputInterface) { throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.'); } $this->input->setStream($this->createStream($inputs)); $this->input->setInteractive(true); } /** * @param string[] $inputs * * @return resource stream */ private function createStream(array $inputs) { $stream = fopen('php://memory', 'r+'); if ($stream === false) { throw new \RuntimeException('Unable to open memory output stream'); } foreach ($inputs as $input) { fwrite($stream, $input.PHP_EOL); } rewind($stream); return $stream; } }__halt_compiler();----SIGNATURE:----MqeUCts67Ez5OhNfX5k6lv9wk9O03L84554YRPVVBGjwnldccd9sFtK3ef2tvPfnx6Wqr8ZEF4GAu5c/8Ty1otjBea2gE0OYFCaPdEA0SU8mV0olbKNRgl5Z+FHqzhGExGLGkzqhEfb9d3I1ChKNkwTw60ht4Ldhs8lGMfR9ATQqv5Wo1oHqUYOnZ70oqqhu1q9fTkQopXs2GDsNiY8btONizjdg5JTb7ADFwc0X9lNqI4M7WKeM2kWCeKF/m8p6GWmgyvnBes7TP6kW0nu5Lj2PvD586tSnScVR5J7bTqGTwUZRazaE8eUcv0bN5krv0JyRCxM2evBBHsBm4iKpPIkDtqdez5EPSmh9fFya3y3FGS598ubXsBMJLsJG5WvHqX5jnQRolh8gj2ZyVm188o1L9w+a2Vvpz1xFoNRmOECwQu+QyrJd/ehmvH9U4Z9XGIf5bC/VJ7LQR2Q74zuL56+zgnrxiVpTjMjVAGlTsxp6Fg6D/nmBN9tYlIQRB2IQdk7k0XF5YsnO+8SOaehyXCvHD+cjl0aPzs5ueCsNT3f/LQn/ocIcGh8W4pO3TU5FL8QQclRwoHv4BSukXE2AzW5xyD9QD9n5kCnpItUCdB4P7UBL3jue4Myhhdhb+5hdMX3eHuMp7vIomcYA1siUoH5g++8OQduJoTdv/osu7/0=----ATTACHMENT:----NjQyNzE4OTk1Nzc1MzkyNSA1NDA0MzI1MTIzMTk1Njc5IDIxODI2MjQzNDM2NzEwNDA=