1 | <?php |
||
17 | class Result |
||
18 | { |
||
19 | /** |
||
20 | * Result of executed command. |
||
21 | * |
||
22 | * @var \SebastianFeldmann\Cli\Command\Result |
||
23 | */ |
||
24 | private $cmdResult; |
||
25 | |||
26 | /** |
||
27 | * Command print safe. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | private $printableCmd; |
||
32 | |||
33 | /** |
||
34 | * Result constructor. |
||
35 | * |
||
36 | * @param \SebastianFeldmann\Cli\Command\Result $cmdResult |
||
37 | * @param string $cmdPrintable |
||
38 | */ |
||
39 | 49 | public function __construct(CommandResult $cmdResult, string $cmdPrintable = '') |
|
44 | |||
45 | /** |
||
46 | * Get the raw command result. |
||
47 | * |
||
48 | * @return \SebastianFeldmann\Cli\Command\Result |
||
49 | */ |
||
50 | 1 | public function getCommandResult() : CommandResult |
|
54 | |||
55 | /** |
||
56 | * Return true if command execution was successful. |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | 38 | public function isSuccessful() : bool |
|
64 | |||
65 | /** |
||
66 | * Returns the raw cli return code. |
||
67 | * |
||
68 | * @return int |
||
69 | */ |
||
70 | 5 | public function getReturnCode() : int |
|
74 | |||
75 | /** |
||
76 | * Return the executed cli command. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 10 | public function getCmd() : string |
|
84 | |||
85 | /** |
||
86 | * Return the executed cli command. |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | 16 | public function getCmdPrintable() : string |
|
94 | |||
95 | /** |
||
96 | * Return commands output to stdOut. |
||
97 | * |
||
98 | * @return string |
||
99 | */ |
||
100 | 6 | public function getStdOut() : string |
|
104 | |||
105 | /** |
||
106 | * Return commands error output to stdErr. |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | 15 | public function getStdErr() : string |
|
114 | |||
115 | /** |
||
116 | * Is the output redirected to a file. |
||
117 | * |
||
118 | * @return bool |
||
119 | */ |
||
120 | 2 | public function isOutputRedirected() : bool |
|
124 | |||
125 | /** |
||
126 | * Return path to the file where the output is redirected to. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | 2 | public function getRedirectPath() : string |
|
134 | |||
135 | /** |
||
136 | * Return cmd output as array. |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | 1 | public function getBufferedOutput() : array |
|
144 | } |
||
145 |