| 1 | <?php |
||
| 28 | class GitBinary |
||
| 29 | { |
||
| 30 | /** |
||
| 31 | * the path to the repository |
||
| 32 | * |
||
| 33 | * @var string $path |
||
| 34 | */ |
||
| 35 | private $path; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Class constructor |
||
| 39 | * |
||
| 40 | * @param null $path the physical path to the git binary |
||
| 41 | */ |
||
| 42 | 103 | public function __construct($path = null) |
|
| 43 | { |
||
| 44 | 103 | if (is_null($path)) { |
|
| 45 | // unix only! |
||
| 46 | 102 | $path = exec('which git'); |
|
| 47 | 102 | } |
|
| 48 | 103 | $this->setPath($path); |
|
| 49 | 103 | } |
|
| 50 | |||
| 51 | /** |
||
| 52 | * path getter |
||
| 53 | * returns the path of the binary |
||
| 54 | * |
||
| 55 | * @return mixed |
||
| 56 | */ |
||
| 57 | 99 | public function getPath() |
|
| 61 | |||
| 62 | /** |
||
| 63 | * path setter |
||
| 64 | * |
||
| 65 | * @param string $path the path to the system git binary |
||
| 66 | */ |
||
| 67 | 103 | public function setPath($path) |
|
| 71 | } |
||
| 72 |