1 | <?php |
||
22 | abstract class Exec implements ReaderInterface |
||
23 | { |
||
24 | /** |
||
25 | * {@inheritDoc} |
||
26 | **/ |
||
27 | public function canRead($directory) |
||
34 | |||
35 | /** |
||
36 | * {@inheritDoc} |
||
37 | **/ |
||
38 | public function read($directory) |
||
44 | |||
45 | /** |
||
46 | * Get the command for a directory |
||
47 | * |
||
48 | * @param string $directory |
||
49 | * @return string |
||
50 | **/ |
||
51 | abstract protected function getCommandForDirectory($directory); |
||
52 | |||
53 | /** |
||
54 | * Can a git command be executed? |
||
55 | * |
||
56 | * @param string $command |
||
57 | * @param string $directory |
||
58 | * @return void |
||
59 | **/ |
||
60 | private function canExec($command, $directory) |
||
80 | |||
81 | /** |
||
82 | * Execute a git command and return first line of output |
||
83 | * |
||
84 | * @param string $command |
||
85 | * @return string |
||
86 | **/ |
||
87 | private function exec($command) |
||
106 | } |
||
107 |
If you suppress an error, we recommend checking for the error condition explicitly: