Example #1
0
 public function testObtener()
 {
     $autorization = sprintf("BASIC  + window.btoa(%s + :xxx)", "asdasdasdas");
     $options = array('body' => array(), 'config' => array(), 'headers' => array());
     $project = new Project();
     $project->__set("apiKey", "cat952yellow");
     $project->obtener();
     $response = $project->__get("response");
     error_log(print_r($response['body'], true));
     $this->assertTrue($response['status'] == 'exito');
 }
Example #2
0
 public function __get($property)
 {
     switch ($property) {
         case 'host':
             return 'github';
         case 'tags':
             $response = $this->call('repos/' . $this->user . '/' . $this->repo . '/git/refs/tags');
             $tags = array();
             if (is_array($response)) {
                 foreach ($response as $bt) {
                     $tag = $this->call('repos/' . $this->user . '/' . $this->repo . '/git/tags/' . $bt->object->sha);
                     $tag->basic = $bt;
                     $tag->date = HabariDateTime::date_create($tag->tagger->date);
                     $tag->zipball_url = 'https://github.com/' . $this->user . '/' . $this->repo . '/zipball/' . $tag->tag;
                     $tags[$tag->tag] = $tag;
                 }
             }
             return array_reverse($tags);
             break;
         case 'new_issue_url':
             return 'http://github.com/' . $this->user . '/' . $this->repo . '/issues/new';
         case 'zipball_url':
             return 'http://github.com/' . $this->user . '/' . $this->repo . '/zipball/master';
         case 'repo':
             return $this->repository;
             break;
             // will never be executed
         // will never be executed
         case 'github':
             return $this->html_url;
             return;
         case 'cloneurl':
             return $this->clone_url;
         case 'pushdate':
             return HabariDateTime::date_create($this->pushed_at);
         case 'pushed_at':
         case 'html_url':
         case 'clone_url':
             if (!isset($this->repodetails)) {
                 $details = $this->call('repos/' . $this->user . '/' . $this->repo);
                 $this->repodetails = $details;
                 return $details->{$property};
             } else {
                 return $this->repodetails->{$property};
             }
             break;
         default:
             return parent::__get($property);
     }
 }