1 | <?php |
||
22 | class Shell |
||
23 | { |
||
24 | |||
25 | /** |
||
26 | * The Cmd object |
||
27 | * |
||
28 | * @var \mikehaertl\shellcommand\Command |
||
29 | */ |
||
30 | protected $cmd = null; |
||
31 | |||
32 | /** |
||
33 | * The command we want to execute |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $command = null; |
||
38 | |||
39 | /** |
||
40 | * Returns the Cmd object |
||
41 | * |
||
42 | * @param string $refresh |
||
43 | */ |
||
44 | protected function getCmd($refresh = false) |
||
52 | |||
53 | /** |
||
54 | * Executes the command |
||
55 | * |
||
56 | * @return boolean |
||
57 | */ |
||
58 | public function execute() |
||
64 | |||
65 | /** |
||
66 | * The command output (stdout). |
||
67 | * Empty if none |
||
68 | * |
||
69 | * @return mixed |
||
70 | */ |
||
71 | public function getOutput() |
||
75 | |||
76 | /** |
||
77 | * The error message, either stderr or internal message. |
||
78 | * Empty if none. |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getError() |
||
86 | |||
87 | /** |
||
88 | * Sets the command to execute |
||
89 | * |
||
90 | * @param string $command |
||
91 | * @return \mithra62\Shell |
||
92 | */ |
||
93 | public function setCommand($command) |
||
98 | |||
99 | /** |
||
100 | * Returns the command to execute |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getCommand() |
||
108 | } |
||
109 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: