1 | <?php |
||
18 | class Process |
||
19 | { |
||
20 | /** |
||
21 | * List of system commands to execute. |
||
22 | * |
||
23 | * @var \phpbu\App\Cli\Cmd[] |
||
24 | */ |
||
25 | private $commands = []; |
||
26 | |||
27 | /** |
||
28 | * Redirect the output |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | private $redirectOutput; |
||
33 | |||
34 | /** |
||
35 | * Output pipeline |
||
36 | * |
||
37 | * @var \phpbu\App\Cli\Cmd[] |
||
38 | 12 | */ |
|
39 | private $pipeline = []; |
||
40 | 12 | ||
41 | 12 | /** |
|
42 | * Redirect the stdOut. |
||
43 | * |
||
44 | * @param string $path |
||
45 | */ |
||
46 | public function redirectOutputTo($path) |
||
50 | 1 | ||
51 | /** |
||
52 | * Should the output be redirected. |
||
53 | * |
||
54 | * @return boolean |
||
55 | */ |
||
56 | public function isOutputRedirected() |
||
60 | 1 | ||
61 | /** |
||
62 | * Redirect getter. |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getRedirectPath() |
||
70 | 99 | ||
71 | 99 | /** |
|
72 | * Pipe the command into given command. |
||
73 | * |
||
74 | * @param \phpbu\App\Cli\Cmd $cmd |
||
75 | * @throws \phpbu\App\Exception |
||
76 | */ |
||
77 | public function pipeOutputTo(Cmd $cmd) |
||
84 | |||
85 | 96 | /** |
|
86 | 96 | * Is there a command pipeline. |
|
87 | * |
||
88 | 96 | * @return bool |
|
89 | */ |
||
90 | public function isPiped() |
||
94 | |||
95 | /** |
||
96 | * Return command pipeline. |
||
97 | 1 | * |
|
98 | * @return string |
||
99 | 1 | */ |
|
100 | 1 | public function getPipeline() |
|
104 | 1 | ||
105 | /** |
||
106 | 1 | * Adds a cli command to the command list. |
|
107 | * |
||
108 | * @param \phpbu\App\Cli\Cmd $cmd |
||
109 | */ |
||
110 | public function addCommand(Cmd $cmd) |
||
114 | |||
115 | /** |
||
116 | * Generates the system command. |
||
117 | * |
||
118 | * @return string |
||
119 | * @throws \phpbu\App\Exception |
||
120 | */ |
||
121 | public function getCommandLine() |
||
133 | |||
134 | /** |
||
135 | * Executes the commands. |
||
136 | * |
||
137 | * @return \phpbu\App\Cli\Result |
||
138 | * @throws \phpbu\App\Exception |
||
139 | */ |
||
140 | public function run() |
||
166 | } |
||
167 |