1 | <?php |
||
24 | class Result |
||
25 | { |
||
26 | /** |
||
27 | * Result of executed command. |
||
28 | * |
||
29 | * @var \SebastianFeldmann\Cli\Command\Result |
||
30 | */ |
||
31 | private $cmdResult; |
||
32 | |||
33 | /** |
||
34 | * Formatted output of executed result. |
||
35 | * |
||
36 | * @var iterable |
||
37 | */ |
||
38 | private $formatted; |
||
39 | |||
40 | /** |
||
41 | * Result constructor. |
||
42 | * |
||
43 | * @param \SebastianFeldmann\Cli\Command\Result $cmdResult |
||
44 | 11 | * @param iterable $formatted |
|
45 | */ |
||
46 | 11 | public function __construct(CommandResult $cmdResult, iterable $formatted = []) |
|
51 | |||
52 | /** |
||
53 | * Get the raw command result. |
||
54 | * |
||
55 | 1 | * @return \SebastianFeldmann\Cli\Command\Result |
|
56 | */ |
||
57 | 1 | public function getCommandResult(): CommandResult |
|
61 | |||
62 | /** |
||
63 | * Return true if command execution was successful. |
||
64 | * |
||
65 | 1 | * @return bool |
|
66 | */ |
||
67 | 1 | public function isSuccessful(): bool |
|
71 | |||
72 | /** |
||
73 | * Return the command exit code. |
||
74 | * |
||
75 | 1 | * @return int |
|
76 | */ |
||
77 | 1 | public function getCode(): int |
|
81 | |||
82 | /** |
||
83 | * Return the executed cli command. |
||
84 | * |
||
85 | 1 | * @return string |
|
86 | */ |
||
87 | 1 | public function getCmd(): string |
|
91 | |||
92 | /** |
||
93 | * Return commands output to stdOut. |
||
94 | * |
||
95 | 1 | * @return string |
|
96 | */ |
||
97 | 1 | public function getStdOut(): string |
|
101 | |||
102 | /** |
||
103 | * Return commands error output to stdErr. |
||
104 | * |
||
105 | 1 | * @return string |
|
106 | */ |
||
107 | 1 | public function getStdErr(): string |
|
111 | |||
112 | /** |
||
113 | * Is the output redirected to a file. |
||
114 | * |
||
115 | 2 | * @return bool |
|
116 | */ |
||
117 | 2 | public function isOutputRedirected(): bool |
|
121 | |||
122 | /** |
||
123 | * Return path to the file where the output is redirected to. |
||
124 | * |
||
125 | 2 | * @return string |
|
126 | */ |
||
127 | 2 | public function getRedirectPath(): string |
|
131 | |||
132 | /** |
||
133 | * Return cmd output as array. |
||
134 | * |
||
135 | 2 | * @return array |
|
136 | */ |
||
137 | 2 | public function getBufferedOutput(): array |
|
141 | |||
142 | /** |
||
143 | * Return formatted output. |
||
144 | * |
||
145 | 1 | * @return iterable |
|
146 | */ |
||
147 | 1 | public function getFormattedOutput(): iterable |
|
151 | } |
||
152 |