| 1 | <?php |
||
| 15 | class Result |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * Command that got executed. |
||
| 19 | * |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | private $cmd; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Result code |
||
| 26 | * |
||
| 27 | * @var integer |
||
| 28 | */ |
||
| 29 | private $code; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Output buffer. |
||
| 33 | * |
||
| 34 | * @var array |
||
| 35 | */ |
||
| 36 | private $buffer; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * StdOut |
||
| 40 | * |
||
| 41 | * @var string |
||
| 42 | */ |
||
| 43 | private $stdOut; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * StdErr |
||
| 47 | * |
||
| 48 | * @var string |
||
| 49 | */ |
||
| 50 | private $stdErr; |
||
| 51 | |||
| 52 | 8 | /** |
|
| 53 | * Constructor |
||
| 54 | 8 | * |
|
| 55 | 8 | * @param string $cmd |
|
| 56 | 8 | * @param integer $code |
|
| 57 | 8 | * @param string $stdOut |
|
| 58 | * @param string $stdErr |
||
| 59 | */ |
||
| 60 | public function __construct($cmd, $code, $stdOut = '', $stdErr = '') |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Cmd getter. |
||
| 70 | * |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | public function getCmd() |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Code getter. |
||
| 80 | * |
||
| 81 | * @return integer |
||
| 82 | 2 | */ |
|
| 83 | public function getCode() |
||
| 87 | |||
| 88 | /** |
||
| 89 | * Command executed successful. |
||
| 90 | */ |
||
| 91 | public function wasSuccessful() |
||
| 95 | |||
| 96 | /** |
||
| 97 | * StdOutput getter. |
||
| 98 | * |
||
| 99 | * @return mixed array |
||
| 100 | */ |
||
| 101 | public function getStdOut() |
||
| 105 | 2 | ||
| 106 | 2 | /** |
|
| 107 | 2 | * StdError getter. |
|
| 108 | * |
||
| 109 | * @return mixed array |
||
| 110 | */ |
||
| 111 | public function getStdErr() |
||
| 115 | 2 | ||
| 116 | /** |
||
| 117 | 2 | * Return the output ins string format. |
|
| 118 | * |
||
| 119 | * @return string |
||
| 120 | */ |
||
| 121 | public function getStdOutAsArray() |
||
| 128 | |||
| 129 | /** |
||
| 130 | * Converts the output buffer array into a string. |
||
| 131 | * |
||
| 132 | * @return string |
||
| 133 | */ |
||
| 134 | private function textToBuffer() |
||
| 138 | |||
| 139 | /** |
||
| 140 | * Magic to string method. |
||
| 141 | * |
||
| 142 | * @return string |
||
| 143 | */ |
||
| 144 | public function __toString() |
||
| 148 | } |
||
| 149 |