forked from blallo/rss-bridge
[GithubIssueBridge] add getURI() and getName()
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
73b4aea084
commit
bf8214e3dd
1 changed files with 23 additions and 4 deletions
|
@ -28,10 +28,29 @@ class GithubIssueBridge extends BridgeAbstract{
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public function getName(){
|
||||||
|
$name=$this->getInput('u').'/'.$this->getInput('p');
|
||||||
|
switch($this->queriedContext){
|
||||||
|
case 'Project Issues':
|
||||||
|
$name=static::NAME.'s '.$name;
|
||||||
|
break;
|
||||||
|
case 'Issue comments':
|
||||||
|
$name=static::NAME.' '.$name.' #'.$this->getInput('i');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getURI(){
|
||||||
|
$uri = static::URI.$this->getInput('u').'/'.$this->getInput('p').'/issues/';
|
||||||
|
if($this->queriedContext==='Issue comments'){
|
||||||
|
$uri.=$this->getInput('i');
|
||||||
|
}
|
||||||
|
return $uri;
|
||||||
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$uri = self::URI.$this->getInput('u').'/'.$this->getInput('p')
|
$html = $this->getSimpleHTMLDOM($this->getURI())
|
||||||
.'/issues/'.$this->getInput('i');
|
|
||||||
$html = $this->getSimpleHTMLDOM($uri)
|
|
||||||
or $this->returnServerError('No results for Github Issue '.$this->getInput('i').' in project '.$this->getInput('u').'/'.$this->getInput('p'));
|
or $this->returnServerError('No results for Github Issue '.$this->getInput('i').' in project '.$this->getInput('u').'/'.$this->getInput('p'));
|
||||||
|
|
||||||
switch($this->queriedContext){
|
switch($this->queriedContext){
|
||||||
|
@ -43,7 +62,7 @@ class GithubIssueBridge extends BridgeAbstract{
|
||||||
|
|
||||||
$comment=$comment->firstChild()->nextSibling();
|
$comment=$comment->firstChild()->nextSibling();
|
||||||
|
|
||||||
$item['uri']=$uri.'#'.$comment->getAttribute('id');
|
$item['uri']=$this->getURI().'#'.$comment->getAttribute('id');
|
||||||
$item['title']=trim($comment->firstChild()->plaintext);
|
$item['title']=trim($comment->firstChild()->plaintext);
|
||||||
$item['timestamp']=strtotime($comment->find('relative-time',0)->getAttribute('datetime'));
|
$item['timestamp']=strtotime($comment->find('relative-time',0)->getAttribute('datetime'));
|
||||||
$item['content']=$comment->find('.comment-body',0)->innertext;
|
$item['content']=$comment->find('.comment-body',0)->innertext;
|
||||||
|
|
Loading…
Reference in a new issue