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) |
|
68 | |||
69 | /** |
||
70 | * Executes a command |
||
71 | * |
||
72 | * @param string $cmd the command to execute |
||
73 | * @param bool $git if the command is git or a generic command |
||
74 | * @param null $cwd the directory where the command must be executed |
||
75 | * @param array $acceptedExitCodes exit codes accepted to consider the command execution successful |
||
76 | * |
||
77 | * @throws \RuntimeException |
||
78 | * @throws \Symfony\Component\Process\Exception\InvalidArgumentException |
||
79 | * @throws \Symfony\Component\Process\Exception\ProcessTimedOutException |
||
80 | * @throws \Symfony\Component\Process\Exception\RuntimeException |
||
81 | * @throws \Symfony\Component\Process\Exception\LogicException |
||
82 | * @return Caller |
||
83 | */ |
||
84 | 102 | public function execute($cmd, $git = true, $cwd = null, $acceptedExitCodes = array(0)): \GitElephant\Command\Caller\CallerInterface |
|
116 | |||
117 | /** |
||
118 | * returns the output of the last executed command |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | 7 | public function getOutput(): string |
|
126 | |||
127 | /** |
||
128 | * returns the output of the last executed command as an array of lines |
||
129 | * |
||
130 | * @param bool $stripBlankLines remove the blank lines |
||
131 | * |
||
132 | * @return array |
||
133 | */ |
||
134 | 91 | public function getOutputLines($stripBlankLines = false): array |
|
149 | |||
150 | /** |
||
151 | * Get RawOutput |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | 1 | public function getRawOutput(): string |
|
159 | } |
||
160 |