1 | <?php |
||
31 | class Caller extends AbstractCaller |
||
32 | { |
||
33 | /** |
||
34 | * the repository path |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | private $repositoryPath; |
||
39 | |||
40 | /** |
||
41 | * raw output |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | private $rawOutput; |
||
46 | |||
47 | /** |
||
48 | * Class constructor |
||
49 | * |
||
50 | * @param string|null $gitPath the physical path to the git binary |
||
51 | * @param string $repositoryPath the physical base path for the repository |
||
52 | */ |
||
53 | 107 | public function __construct($gitPath, $repositoryPath) |
|
67 | |||
68 | /** |
||
69 | * Executes a command |
||
70 | * |
||
71 | * @param string $cmd the command to execute |
||
72 | * @param bool $git if the command is git or a generic command |
||
73 | * @param null $cwd the directory where the command must be executed |
||
74 | * @param array $acceptedExitCodes exit codes accepted to consider the command execution successful |
||
75 | * |
||
76 | * @throws \RuntimeException |
||
77 | * @throws \Symfony\Component\Process\Exception\InvalidArgumentException |
||
78 | * @throws \Symfony\Component\Process\Exception\ProcessTimedOutException |
||
79 | * @throws \Symfony\Component\Process\Exception\RuntimeException |
||
80 | * @throws \Symfony\Component\Process\Exception\LogicException |
||
81 | * @return Caller |
||
82 | */ |
||
83 | 102 | public function execute($cmd, $git = true, $cwd = null, $acceptedExitCodes = array(0)) |
|
112 | |||
113 | /** |
||
114 | * returns the output of the last executed command |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | 7 | public function getOutput() |
|
122 | |||
123 | /** |
||
124 | * returns the output of the last executed command as an array of lines |
||
125 | * |
||
126 | * @param bool $stripBlankLines remove the blank lines |
||
127 | * |
||
128 | * @return array |
||
129 | */ |
||
130 | 91 | public function getOutputLines($stripBlankLines = false) |
|
145 | |||
146 | /** |
||
147 | * Get RawOutput |
||
148 | * |
||
149 | * @return string |
||
150 | */ |
||
151 | 1 | public function getRawOutput() |
|
155 | } |
||
156 |