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 | * Setup binary. |
||
43 | * |
||
44 | * @param string $cmd |
||
45 | * @param string $path |
||
46 | */ |
||
47 | protected function setup($cmd, $path = null) { |
||
51 | |||
52 | /** |
||
53 | 123 | * Process setter, mostly for test purposes. |
|
54 | 123 | * |
|
55 | 123 | * @param \phpbu\App\Cli\Process $process |
|
56 | */ |
||
57 | public function setProcess(Process $process) |
||
61 | |||
62 | 2 | /** |
|
63 | * Returns the Process for this command. |
||
64 | 2 | * |
|
65 | 2 | * @return \phpbu\App\Cli\Process |
|
66 | */ |
||
67 | public function getProcess() |
||
74 | 111 | ||
75 | 109 | /** |
|
76 | 93 | * Subclass Process generator. |
|
77 | 95 | * |
|
78 | * @return \phpbu\App\Cli\Process |
||
79 | */ |
||
80 | abstract protected function createProcess(); |
||
81 | |||
82 | /** |
||
83 | * Executes the cli commands. |
||
84 | * |
||
85 | * @return \phpbu\App\Cli\Result |
||
86 | * @throws \phpbu\App\Exception |
||
87 | */ |
||
88 | public function run() |
||
100 | |||
101 | /** |
||
102 | * Return the command line to execute. |
||
103 | * |
||
104 | * @return string |
||
105 | 5 | * @throws \phpbu\App\Exception |
|
106 | */ |
||
107 | 5 | public function getCommandLine() |
|
111 | |||
112 | 1 | /** |
|
113 | 1 | * Return the command with masked passwords or keys. |
|
114 | * |
||
115 | 2 | * @return string |
|
116 | */ |
||
117 | public function getCommandLinePrintable() |
||
121 | |||
122 | /** |
||
123 | * Remove file if it exists. |
||
124 | 106 | * |
|
125 | * @param string $file |
||
126 | 106 | */ |
|
127 | public function unlinkErrorFile($file) |
||
133 | } |
||
134 |