1 | <?php |
||
13 | class Cmd { |
||
14 | /** |
||
15 | * Shell command |
||
16 | * |
||
17 | * @var String |
||
18 | */ |
||
19 | public $cmd = ''; |
||
20 | |||
21 | /** |
||
22 | * Process pipes |
||
23 | * |
||
24 | * @var Array |
||
25 | */ |
||
26 | public $pipes = null; |
||
27 | |||
28 | /** |
||
29 | * Proc itself |
||
30 | * |
||
31 | * @var Process |
||
32 | */ |
||
33 | public $resource = null; |
||
34 | |||
35 | /** |
||
36 | * Timestamp when command was fired |
||
37 | * |
||
38 | * @var int |
||
39 | */ |
||
40 | private $strt_tm = 0; |
||
41 | |||
42 | /** |
||
43 | * Command exit code |
||
44 | * |
||
45 | * @var int |
||
46 | */ |
||
47 | private $exitcode = null; |
||
48 | |||
49 | /** |
||
50 | * Descriptors to use in new process |
||
51 | * |
||
52 | * @var Array |
||
53 | */ |
||
54 | private $descriptors = array( |
||
55 | 0 => array( 'pipe', 'r' ), |
||
56 | 1 => array( 'pipe', 'w' ), |
||
57 | 2 => array( 'pipe', 'w' ), |
||
58 | ); |
||
59 | |||
60 | /** |
||
61 | * Opens a process with the provided shell command |
||
62 | * |
||
63 | * @param {String} $cmd shell command to run. |
||
|
|||
64 | */ |
||
65 | public function __construct( $cmd = '' ) { |
||
72 | |||
73 | /** |
||
74 | * Class entry point |
||
75 | * |
||
76 | * @param {String} $cmd shell command to run. |
||
77 | * @param {bool} $interactive wether or not to output interactively. |
||
78 | */ |
||
79 | public static function run( $cmd, $interactive = true ) { |
||
103 | |||
104 | /** |
||
105 | * Checks if the process is still running. Also populates an $exitcode once the process is done running |
||
106 | */ |
||
107 | public function is_running() { |
||
120 | |||
121 | /** |
||
122 | * Exit code accessor |
||
123 | */ |
||
124 | public function get_exitcode() { |
||
127 | |||
128 | /** |
||
129 | * Return elapsed time |
||
130 | */ |
||
131 | public function get_elapsed() { |
||
134 | } |
||
135 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.