1 | <?php |
||
18 | abstract class Abstraction |
||
19 | { |
||
20 | /** |
||
21 | * Command name. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $cmd; |
||
26 | |||
27 | /** |
||
28 | * Absolute path to command. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $binary; |
||
33 | |||
34 | /** |
||
35 | * Command to execute |
||
36 | * |
||
37 | * @var \phpbu\App\Cli\Process |
||
38 | */ |
||
39 | protected $process; |
||
40 | |||
41 | /** |
||
42 | * Constructor. |
||
43 | * |
||
44 | * @param string $path |
||
45 | */ |
||
46 | public function __construct($path = null) { |
||
49 | |||
50 | /** |
||
51 | * Process setter, mostly for test purposes. |
||
52 | * |
||
53 | 123 | * @param \phpbu\App\Cli\Process $process |
|
54 | 123 | */ |
|
55 | 123 | public function setProcess(Process $process) |
|
59 | |||
60 | /** |
||
61 | * Returns the Process for this command. |
||
62 | 2 | * |
|
63 | * @return \phpbu\App\Cli\Process |
||
64 | 2 | */ |
|
65 | 2 | public function getProcess() |
|
72 | 111 | ||
73 | /** |
||
74 | 111 | * Subclass Process generator. |
|
75 | 109 | * |
|
76 | 93 | * @return \phpbu\App\Cli\Process |
|
77 | 95 | */ |
|
78 | abstract protected function createProcess(); |
||
79 | |||
80 | /** |
||
81 | * Executes the cli commands. |
||
82 | * |
||
83 | * @return \phpbu\App\Cli\Result |
||
84 | * @throws \phpbu\App\Exception |
||
85 | */ |
||
86 | public function run() |
||
98 | |||
99 | /** |
||
100 | * Return the command line to execute. |
||
101 | * |
||
102 | * @return string |
||
103 | * @throws \phpbu\App\Exception |
||
104 | */ |
||
105 | 5 | public function getCommandLine() |
|
109 | |||
110 | 2 | /** |
|
111 | * Remove file if it exists. |
||
112 | 1 | * |
|
113 | 1 | * @param string $file |
|
114 | */ |
||
115 | 2 | public function unlinkErrorFile($file) |
|
121 | } |
||
122 |