forked from WhiteHouse/drushsubtree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drushsubtree.commander.class.inc
62 lines (56 loc) · 1.15 KB
/
drushsubtree.commander.class.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* @file
* Provides abstract class for drush subtree commander classes.
*/
/**
* Abstract Commander class.
*/
abstract class Commander {
private $command;
/**
* Get command property.
*
* @return string
* Command to be executed.
*/
public function getCommand() {
return $this->command;
}
/**
* Set command property.
*
* @param string $command
* Command to be executed.
*/
public function setCommand($command) {
$this->command = $command;
}
/**
* Add a shell command after the command stored in $this->command.
*
* @param string $command
* Command to be executed in addition to whatever is already stored in
* $command property.
*/
public function appendCommand($command) {
$this->command .= $command;
}
/**
* Execute command.
*
* @return array
* Comand and exec results.
* - command (string)
* - output (array)
* - exit_code (int)
*/
public function exec() {
exec($this->command, $output, $exit_code);
return array(
'command' => $this->command,
'output' => $output,
'exit_code' => $exit_code,
);
}
}