blob: 3815856a8444d62449e72828adfc3d53fd04fe3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
namespace phorkie;
class Repository_ConnectionInfo
{
protected $arConfig;
protected $repo;
public function __construct(Repository $repo)
{
$this->repo = $repo;
$this->arConfig = parse_ini_file($this->repo->gitDir . '/config', true);
}
public function isFork()
{
return $this->getOrigin() !== null;
}
public function getOrigin()
{
return $this->getRemote('origin');
}
/**
* @return Repository_Remote|null NULL if the remote does not exist, array
* with repository information otherwise
*/
public function getRemote($name)
{
if (!isset($this->arConfig['remote ' . $name])) {
return null;
}
return new Repository_Remote($name, $this->arConfig['remote ' . $name]);
}
}
?>
|