4 class Repository_Remote
9 public function __construct($name, $arConfig)
12 $this->arConfig = $arConfig;
16 public function getTitle()
18 if (isset($this->arConfig['title'])) {
19 return $this->arConfig['title'];
21 if ($this->isLocal()) {
22 $local = $this->getLocalRepository();
23 if ($local !== null) {
24 return $local->getTitle();
26 return 'deleted local paste';
29 return 'untitled repository';
32 public function getCloneURL()
34 if ($this->isLocal()) {
35 $local = $this->getLocalRepository();
36 if ($local !== null) {
37 return $local->getCloneURL();
41 return $this->arConfig['url'];
44 public function getWebURL()
46 if (isset($this->arConfig['homepage'])) {
47 return $this->arConfig['homepage'];
50 if ($this->isLocal()) {
51 $local = $this->getLocalRepository();
52 if ($local !== null) {
53 return $local->getLink('display');
61 * Tells you if this remote repository is a paste on the local server
63 * @return boolean True of false
65 public function isLocal()
67 return isset($this->arConfig['url'])
68 && $this->arConfig['url']{0} == '/';
72 * If this remote is a local paste, then we'll get the repository object
75 * @return Repository Repository object or NULL
77 public function getLocalRepository()
79 if (!file_exists($this->arConfig['url'] . '/config')) {
82 $dir = basename($this->arConfig['url']);
83 if (substr($dir, -4) != '.git') {
84 //phorks are bare repositories "123.git"
87 $repo = new Repository();
88 $repo->loadById(substr($dir, 0, -4));