Example #1
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('name' => 'string', 'commit' => 'GitHubCommit'));
 }
Example #2
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('login' => 'string', 'id' => 'int', 'avatar_url' => 'string', 'gravatar_id' => 'string', 'url' => 'string'));
 }
Example #3
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'html_url' => 'string', 'number' => 'int', 'state' => 'string', 'title' => 'string', 'body' => 'string', 'user' => 'GitHubUser', 'assignee' => 'GitHubUser', 'milestone' => 'GitHubMilestone', 'comments' => 'int', 'closed_at' => 'string', 'created_at' => 'string', 'updated_at' => 'string', 'pull_request' => 'GitHubIssuePullRequest'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('merge_commit_sha' => 'string', 'merged' => 'boolean', 'mergeable' => 'boolean', 'merged_by' => 'GitHubUser', 'comments' => 'int', 'commits' => 'int', 'additions' => 'int', 'deletions' => 'int'));
 }
Example #5
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('id' => 'int', 'owner' => 'GitHubUser', 'name' => 'string', 'full_name' => 'string', 'description' => 'string', 'private' => 'boolean', 'fork' => 'boolean', 'url' => 'string', 'html_url' => 'string'));
 }
Example #6
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'updated_at' => 'string', 'created_at' => 'string', 'name' => 'string', 'active' => 'boolean'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('href' => 'string', 'type' => 'string'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('id' => 'int', 'key' => 'string'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('path' => 'string', 'mode' => 'string', 'type' => 'string', 'size' => 'int', 'sha' => 'string', 'url' => 'string'));
 }
Example #10
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('name' => 'string', 'email' => 'string', 'date' => 'string'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('html_url' => 'string', 'diff_url' => 'string', 'patch_url' => 'string'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('id' => 'int', 'url' => 'string', 'html_url' => 'string', 'diff_url' => 'string', 'patch_url' => 'string', 'issue_url' => 'string', 'commits_url' => 'string', 'review_comments_url' => 'string', 'review_comment_url' => 'string', 'comments_url' => 'string', 'statuses_url' => 'string', 'number' => 'int', 'state' => 'string', 'title' => 'string', 'body' => 'string', 'created_at' => 'string', 'updated_at' => 'string', 'closed_at' => 'string', 'merged_at' => 'string', 'user' => 'GitHubUser', '_links' => 'GitHubPullLinks', 'head' => 'GitHubPullBranch', 'base' => 'GitHubPullBranch'));
 }
Example #13
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('id' => 'int', 'url' => 'string', 'html_url' => 'string', 'body' => 'string', 'user' => 'GitHubUser', 'created_at' => 'string', 'updated_at' => 'string'));
 }
Example #14
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('content' => 'string', 'encoding' => 'string', 'sha' => 'string', 'size' => 'int'));
 }
 public function parseResponse($url, $response, $returnType, $expectedHttpCode, $isArray = false)
 {
     // parse response
     $header = false;
     $content = array();
     $status = 200;
     foreach (explode("\r\n", $response) as $line) {
         if (strpos($line, 'HTTP/1.1') === 0) {
             $lineParts = explode(' ', $line);
             $status = intval($lineParts[1]);
             $header = true;
         } else {
             if ($line == '') {
                 $header = false;
             } else {
                 if ($header) {
                     $line = explode(': ', $line);
                     switch ($line[0]) {
                         case 'Status':
                             $status = intval(substr($line[1], 0, 3));
                             break;
                         case 'X-RateLimit-Limit':
                             $this->rateLimit = intval($line[1]);
                             break;
                         case 'X-RateLimit-Remaining':
                             $this->rateLimitRemaining = intval($line[1]);
                             break;
                         case 'X-RateLimit-Reset':
                             $this->rateLimitReset = intval($line[1]);
                             break;
                         case 'Link':
                             $matches = null;
                             if (preg_match_all('/<https:\\/\\/api\\.github\\.com\\/[^?]+\\?([^>]+)>; rel="([^"]+)"/', $line[1], $matches)) {
                                 foreach ($matches[2] as $index => $page) {
                                     $this->pageData[$page] = array();
                                     $requestParts = explode('&', $matches[1][$index]);
                                     foreach ($requestParts as $requestPart) {
                                         list($field, $value) = explode('=', $requestPart, 2);
                                         $this->pageData[$page][$field] = $value;
                                     }
                                 }
                             }
                             break;
                     }
                 } else {
                     $content[] = $line;
                 }
             }
         }
     }
     if (is_array($expectedHttpCode) && !in_array($status, $expectedHttpCode) || !is_array($expectedHttpCode) && $status !== $expectedHttpCode) {
         throw new GitHubClientException("Expected status [" . (is_array($expectedHttpCode) ? implode(', ', $expectedHttpCode) : $expectedHttpCode) . "], actual status [{$status}], URL [{$url}]", GitHubClientException::INVALID_HTTP_CODE);
     }
     if ($returnType == 'string') {
         return implode("\n", $content);
     }
     if ($returnType) {
         $response = json_decode(implode("\n", $content));
         if (is_array($response)) {
             return GitHubObject::fromArray($response, $returnType);
         } elseif (is_object($response)) {
             return new $returnType($response);
         }
     }
     return null;
 }
Example #16
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('sha' => 'string', 'url' => 'string', 'message' => 'string', 'author' => 'GitHubGitCommitAuthor', 'committer' => 'GitHubGitCommitCommitter', 'tree' => 'GitHubGitCommitTree'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'id' => 'int', 'name' => 'string', 'label' => 'string', 'state' => 'string', 'content_type' => 'string', 'size' => 'int', 'download_count' => 'int', 'created_at' => 'string', 'updated_at' => 'string', 'uploader' => 'GitHubUser'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'name' => 'string', 'client_id' => 'string'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array());
 }
Example #20
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'html_url' => 'string', 'id' => 'int', 'name' => 'string', 'description' => 'string', 'size' => 'int', 'download_count' => 'int', 'content_type' => 'string'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'html_url' => 'string', 'permalink_url' => 'string', 'diff_url' => 'string', 'patch_url' => 'string', 'base_commit' => 'GitHubCommit', 'status' => 'string', 'ahead_by' => 'int', 'behind_by' => 'int', 'total_commits' => 'int'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'sha' => 'string'));
 }
Example #23
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('stats' => 'GitHubFullCommitStats', 'files' => 'array<GitHubFullCommitFiles>'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'sha' => 'string', 'author' => 'GitHubUser', 'committer' => 'GitHubUser', 'commit' => 'GitHubCommitCommit', 'parents' => 'array<GitHubCommitParents>'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('sha' => 'string', 'url' => 'string', 'tree' => 'array<GitHubTree>'));
 }
Example #26
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('title' => 'string', 'url' => 'string', 'latest_comment_url' => 'string', 'type' => 'string'));
 }
Example #27
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('label' => 'string', 'ref' => 'string', 'sha' => 'string', 'user' => 'GitHubUser', 'repo' => 'GitHubRepo'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('name' => 'string', 'zipball_url' => 'string', 'tarball_url' => 'string', 'commit' => 'string'));
 }
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('id' => 'int', 'key' => 'string', 'url' => 'string', 'title' => 'string', 'verified' => 'boolean', 'created_at' => 'string', 'read_only' => 'boolean'));
 }
Example #30
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('ref' => 'string', 'url' => 'string', 'object' => 'GitHubRefObject'));
 }