本文整理汇总了PHP中Symfony\Component\Console\Output\StreamOutput::getStream方法的典型用法代码示例。如果您正苦于以下问题:PHP StreamOutput::getStream方法的具体用法?PHP StreamOutput::getStream怎么用?PHP StreamOutput::getStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Output\StreamOutput
的用法示例。
在下文中一共展示了StreamOutput::getStream方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFormattedEscapedOutput
public function testFormattedEscapedOutput()
{
$output = new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, true, null);
$output->writeln('<info>' . OutputFormatter::escape('<error>some error</error>') . '</info>');
rewind($output->getStream());
$this->assertSame("[32m<error>some error</error>[39m" . PHP_EOL, stream_get_contents($output->getStream()));
}
示例2: testDoWrite
public function testDoWrite()
{
$output = new StreamOutput($this->stream);
$output->writeln('foo');
rewind($output->getStream());
$this->assertEquals('foo' . PHP_EOL, stream_get_contents($output->getStream()), '->doWrite() writes to the stream');
}
示例3: getDisplay
/**
* @param boolean
*
* @return string
*/
public function getDisplay($normalize = false)
{
rewind($this->output->getStream());
$display = stream_get_contents($this->output->getStream());
if ($normalize) {
$display = str_replace(PHP_EOL, "\n", $display);
}
return $display;
}
示例4: getRawCommandOutput
/**
* @return string
*
* @throws \Exception
*/
private function getRawCommandOutput()
{
if (!$this->output) {
throw new \Exception('No command output!');
}
rewind($this->output->getStream());
return stream_get_contents($this->output->getStream());
}
示例5: readOutput
/**
* Returns the contents of the output stream.
*
* @param StreamOutput $output The output manager.
*
* @return string The contents of the stream.
*/
public function readOutput(StreamOutput $output)
{
$contents = '';
$stream = $output->getStream();
rewind($stream);
do {
$contents .= fgets($stream);
} while (!feof($stream));
return $contents;
}
示例6: getOutputBuffer
/**
* helper method to get output as string out of a StreamOutput
*
* @param $output
*
* @return string all output
*/
protected function getOutputBuffer(StreamOutput $output)
{
$handle = $output->getStream();
rewind($handle);
$display = stream_get_contents($handle);
// Symfony2's StreamOutput has a hidden dependency on PHP_EOL which needs to be removed by
// normalizing it to the standard newline for text here.
$display = strtr($display, array(PHP_EOL => "\n"));
return $display;
}
示例7: readOutput
/**
* Reads the contents of an output stream.
*
* @param StreamOutput $output The stream output manager.
*
* @return string The contents of the stream.
*/
protected function readOutput(StreamOutput $output)
{
$stream = $output->getStream();
$contents = '';
rewind($stream);
do {
$contents .= fgets($stream);
} while (!feof($stream));
fclose($stream);
return $contents;
}
示例8: __construct
/**
* Constructor.
*
* @param StreamOutput $output
*/
public function __construct(StreamOutput $output)
{
parent::__construct($output->getStream());
}
示例9: __construct
/**
* Constructor.
*
* @param StreamOutput $output
* @param string $cmd
* Pager process command (default: 'less -R -S -F -X')
*/
public function __construct(StreamOutput $output, $cmd = 'less -R -S -F -X')
{
$this->stream = $output->getStream();
$this->cmd = $cmd;
}
示例10: getDisplay
/**
* Gets the display from the stream output.
*
* @return string
*/
protected function getDisplay(StreamOutput $output)
{
rewind($output->getStream());
return stream_get_contents($output->getStream());
}
示例11: assertOutputContains
private function assertOutputContains($expected, StreamOutput $output)
{
rewind($output->getStream());
$stream = stream_get_contents($output->getStream());
$this->assertContains($expected, $stream);
}
示例12: isTtyTerminal
/**
* See if stream output is a tty terminal.
*
* @return bool
*/
private function isTtyTerminal(StreamOutput $output)
{
$tty = function_exists('posix_isatty') && @posix_isatty($output->getStream());
if ($tty) {
putenv("PERIDOT_TTY=1");
}
return $tty;
}
示例13: getOutputStreamContent
public function getOutputStreamContent(StreamOutput $streamOutput)
{
$stream = $streamOutput->getStream();
rewind($stream);
return stream_get_contents($stream);
}
示例14: functionalAsserts
/**
* @param StreamOutput $output
*/
private function functionalAsserts(StreamOutput $output)
{
$baseDir = realpath(__DIR__ . '/..');
rewind($output->getStream());
$content = stream_get_contents($output->getStream());
$this->assertContains('Running the fsTest job > Filesystem Block Tests', $content);
$this->assertContains('Creating tmp/', $content);
$this->assertFileExists($baseDir . '/tmp');
$this->assertContains('Creating tmp/test/deep', $content);
$this->assertFileExists($baseDir . '/tmp/test');
$this->assertFileExists($baseDir . '/tmp/test/deep');
$this->assertContains('Touching tmp/test.tmp', $content);
$this->assertFileExists($baseDir . '/tmp/test.tmp');
$this->assertContains('Touching tmp/test/deep/test.tmp', $content);
$this->assertFileExists($baseDir . '/tmp/test/deep/test.tmp');
$this->assertContains('Running the lint job > Lints the files of the project', $content);
$this->assertContains('Lint Task Finished', $content);
$this->assertContains('Build Success!', $content);
}
示例15: getOutputContent
protected function getOutputContent(StreamOutput $output)
{
rewind($output->getStream());
return str_replace(PHP_EOL, "\n", stream_get_contents($output->getStream()));
}