| 1 | <?php |
||
| 9 | class InteractiveProcessManager |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var InteractiveProcess |
||
| 13 | */ |
||
| 14 | private $process; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var UserInteraction |
||
| 18 | */ |
||
| 19 | private $userInteraction; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param UserInteraction $userInteraction |
||
| 23 | */ |
||
| 24 | public function __construct(UserInteraction $userInteraction) |
||
| 25 | { |
||
| 26 | $this->userInteraction = $userInteraction; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Attach a process. |
||
| 31 | * |
||
| 32 | * @param InteractiveProcess $process |
||
| 33 | */ |
||
| 34 | public function setProcess(InteractiveProcess $process) |
||
| 35 | { |
||
| 36 | $this->process = $process; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Disable the process output. |
||
| 41 | */ |
||
| 42 | public function disableOutput() |
||
| 43 | { |
||
| 44 | $this->process->updatePipe(new NullPipe()); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Enable the process output. |
||
| 49 | * |
||
| 50 | * @param bool $retroActive |
||
| 51 | */ |
||
| 52 | public function enableOutput($retroActive = false) |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Run the given process. |
||
| 64 | */ |
||
| 65 | public function run() |
||
| 69 | } |
||
| 70 |