1 | <?php |
||
32 | class Caller extends AbstractCaller |
||
33 | { |
||
34 | /** |
||
35 | * the repository path |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | private $repositoryPath; |
||
40 | |||
41 | /** |
||
42 | * raw output |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | private $rawOutput; |
||
47 | |||
48 | /** |
||
49 | * Class constructor |
||
50 | * |
||
51 | * @param string|null $gitPath the physical path to the git binary |
||
52 | * @param string $repositoryPath the physical base path for the repository |
||
53 | */ |
||
54 | 107 | public function __construct($gitPath, $repositoryPath) |
|
66 | |||
67 | /** |
||
68 | * Executes a command |
||
69 | * |
||
70 | * @param string $cmd the command to execute |
||
71 | * @param bool $git if the command is git or a generic command |
||
72 | * @param string $cwd the directory where the command must be executed |
||
73 | * @param array $acceptedExitCodes exit codes accepted to consider the command execution successful |
||
74 | * |
||
75 | * @throws \RuntimeException |
||
76 | * @throws \Symfony\Component\Process\Exception\InvalidArgumentException |
||
77 | * @throws \Symfony\Component\Process\Exception\ProcessTimedOutException |
||
78 | * @throws \Symfony\Component\Process\Exception\RuntimeException |
||
79 | * @throws \Symfony\Component\Process\Exception\LogicException |
||
80 | * @return Caller |
||
81 | */ |
||
82 | 102 | public function execute( |
|
125 | |||
126 | /** |
||
127 | * returns the output of the last executed command |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | 7 | public function getOutput(): string |
|
135 | |||
136 | /** |
||
137 | * returns the output of the last executed command as an array of lines |
||
138 | * |
||
139 | * @param bool $stripBlankLines remove the blank lines |
||
140 | * |
||
141 | * @return array |
||
142 | */ |
||
143 | 91 | public function getOutputLines(bool $stripBlankLines = false): array |
|
158 | |||
159 | /** |
||
160 | * Get RawOutput |
||
161 | * |
||
162 | * @return string |
||
163 | */ |
||
164 | 1 | public function getRawOutput(): string |
|
168 | } |
||
169 |