本文整理汇总了PHP中Symfony\Component\Console\Output\StreamOutput::setDecorated方法的典型用法代码示例。如果您正苦于以下问题:PHP StreamOutput::setDecorated方法的具体用法?PHP StreamOutput::setDecorated怎么用?PHP StreamOutput::setDecorated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Output\StreamOutput
的用法示例。
在下文中一共展示了StreamOutput::setDecorated方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Executes the application.
*
* Available options:
*
* * interactive: Sets the input interactive flag
* * decorated: Sets the output decorated flag
* * verbosity: Sets the output verbosity flag
* * capture_stderr_separately: Make output of stdOut and stdErr separately available
*
* @param array $input An array of arguments and options
* @param array $options An array of options
*
* @return int The command exit code
*/
public function run(array $input, $options = array())
{
$this->input = new ArrayInput($input);
if (isset($options['interactive'])) {
$this->input->setInteractive($options['interactive']);
}
$this->captureStreamsIndependently = array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
if (!$this->captureStreamsIndependently) {
$this->output = new StreamOutput(fopen('php://memory', 'w', false));
if (isset($options['decorated'])) {
$this->output->setDecorated($options['decorated']);
}
if (isset($options['verbosity'])) {
$this->output->setVerbosity($options['verbosity']);
}
} else {
$this->output = new ConsoleOutput(isset($options['verbosity']) ? $options['verbosity'] : ConsoleOutput::VERBOSITY_NORMAL, isset($options['decorated']) ? $options['decorated'] : null);
$errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
$errorOutput->setFormatter($this->output->getFormatter());
$errorOutput->setVerbosity($this->output->getVerbosity());
$errorOutput->setDecorated($this->output->isDecorated());
$reflectedOutput = new \ReflectionObject($this->output);
$strErrProperty = $reflectedOutput->getProperty('stderr');
$strErrProperty->setAccessible(true);
$strErrProperty->setValue($this->output, $errorOutput);
$reflectedParent = $reflectedOutput->getParentClass();
$streamProperty = $reflectedParent->getProperty('stream');
$streamProperty->setAccessible(true);
$streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
}
return $this->statusCode = $this->application->run($this->input, $this->output);
}
示例2: run
public function run($input, array $options = array())
{
if (isset($options['interactive']) && $options['interactive']) {
$this->input = new InteractiveStringInput($input);
} else {
$this->input = new StringInput($input);
$this->input->setInteractive(false);
}
$this->output = new StreamOutput(fopen('php://memory', 'w', false), OutputInterface::VERBOSITY_DEBUG, false);
$this->output->setDecorated(false);
$inputStream = $this->getInputStream();
rewind($inputStream);
$this->setInputStream($inputStream);
$this->application->setAutoExit(false);
$this->disableStty();
$this->statusCode = $this->application->run($this->input, $this->output);
return $this->statusCode;
}
示例3: run
/**
* @param string $input
* @param array $options
*
* @return integer
*/
public function run($input, array $options = array())
{
if (isset($options['interactive']) && $options['interactive']) {
$this->input = new InteractiveStringInput($input);
} else {
$this->input = new StringInput($input);
$this->input->setInteractive(false);
}
$this->output = new StreamOutput(fopen('php://memory', 'w', false));
if (isset($options['decorated'])) {
$this->output->setDecorated($options['decorated']);
}
if (isset($options['verbosity'])) {
$this->output->setVerbosity($options['verbosity']);
}
$inputStream = $this->getInputStream();
rewind($inputStream);
$this->application->getHelperSet()->get('dialog')->setInputStream($inputStream);
return $this->application->run($this->input, $this->output);
}
示例4: setDecorated
/**
* {@inheritdoc}
*/
public function setDecorated($decorated)
{
parent::setDecorated($decorated);
$this->stderr->setDecorated($decorated);
}
示例5: createOutputInterface
protected function createOutputInterface()
{
$output = new StreamOutput(fopen('php://memory', 'r+', false));
$output->setDecorated(false);
return $output;
}
示例6: testGetMigrationsWithClassThatDoesntExtendAbstractMigration
public function testGetMigrationsWithClassThatDoesntExtendAbstractMigration()
{
$this->setExpectedException('InvalidArgumentException', 'The class "InvalidSuperClass" in file "' . $this->getCorrectedPath(__DIR__ . '/_files/invalidsuperclass/20120111235330_invalid_super_class.php') . '" must extend \\Phinx\\Migration\\AbstractMigration');
$config = new Config(array('paths' => array('migrations' => $this->getCorrectedPath(__DIR__ . '/_files/invalidsuperclass'))));
$output = new StreamOutput(fopen('php://memory', 'a', false));
$output->setDecorated(false);
$manager = new Manager($config, $output);
$manager->getMigrations();
}