MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
CommandTester.php
Ir para a documentação deste ficheiro.
1<?php
2
4
8
9/*
10 * This file is part of the Symfony framework.
11 *
12 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
13 *
14 * This source file is subject to the MIT license that is bundled
15 * with this source code in the file LICENSE.
16 */
17
22{
23 protected $command;
24 protected $display;
25 protected $input;
26 protected $output;
27
33 public function __construct(Command $command)
34 {
35 $this->command = $command;
36 }
37
50 public function execute(array $input, array $options = array())
51 {
52 $this->input = new ArrayInput($input);
53 if (isset($options['interactive'])) {
54 $this->input->setInteractive($options['interactive']);
55 }
56
57 $this->output = new StreamOutput(fopen('php://memory', 'w', false));
58 if (isset($options['decorated'])) {
59 $this->output->setDecorated($options['decorated']);
60 }
61 if (isset($options['verbosity'])) {
62 $this->output->setVerbosity($options['verbosity']);
63 }
64
65 $ret = $this->command->run($this->input, $this->output);
66
67 rewind($this->output->getStream());
68
69 return $this->display = stream_get_contents($this->output->getStream());
70 }
71
77 public function getDisplay()
78 {
79 return $this->display;
80 }
81
87 public function getInput()
88 {
89 return $this->input;
90 }
91
97 public function getOutput()
98 {
99 return $this->output;
100 }
101}
execute(array $input, array $options=array())