コード例 #1
0
ファイル: GitHubBranch.php プロジェクト: brajola/dashboard
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('name' => 'string', 'commit' => 'GitHubCommit'));
 }
コード例 #2
0
ファイル: GitHubUser.php プロジェクト: kinlane/apis.how
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('login' => 'string', 'id' => 'int', 'avatar_url' => 'string', 'gravatar_id' => 'string', 'url' => 'string'));
 }
コード例 #3
0
ファイル: GitHubIssue.php プロジェクト: brajola/dashboard
 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'));
 }
コード例 #4
0
 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'));
 }
コード例 #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'));
 }
コード例 #6
0
ファイル: GitHubHook.php プロジェクト: brajola/dashboard
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'updated_at' => 'string', 'created_at' => 'string', 'name' => 'string', 'active' => 'boolean'));
 }
コード例 #7
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('href' => 'string', 'type' => 'string'));
 }
コード例 #8
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('id' => 'int', 'key' => 'string'));
 }
コード例 #9
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('path' => 'string', 'mode' => 'string', 'type' => 'string', 'size' => 'int', 'sha' => 'string', 'url' => 'string'));
 }
コード例 #10
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('name' => 'string', 'email' => 'string', 'date' => 'string'));
 }
コード例 #11
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('html_url' => 'string', 'diff_url' => 'string', 'patch_url' => 'string'));
 }
コード例 #12
0
 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'));
 }
コード例 #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'));
 }
コード例 #14
0
ファイル: GitHubBlob.php プロジェクト: brajola/dashboard
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('content' => 'string', 'encoding' => 'string', 'sha' => 'string', 'size' => 'int'));
 }
コード例 #15
0
 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;
 }
コード例 #16
0
ファイル: GitHubGitCommit.php プロジェクト: brajola/dashboard
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('sha' => 'string', 'url' => 'string', 'message' => 'string', 'author' => 'GitHubGitCommitAuthor', 'committer' => 'GitHubGitCommitCommitter', 'tree' => 'GitHubGitCommitTree'));
 }
コード例 #17
0
 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'));
 }
コード例 #18
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'name' => 'string', 'client_id' => 'string'));
 }
コード例 #19
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array());
 }
コード例 #20
0
ファイル: GitHubDownload.php プロジェクト: brajola/dashboard
 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'));
 }
コード例 #21
0
 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'));
 }
コード例 #22
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'sha' => 'string'));
 }
コード例 #23
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('stats' => 'GitHubFullCommitStats', 'files' => 'array<GitHubFullCommitFiles>'));
 }
コード例 #24
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('url' => 'string', 'sha' => 'string', 'author' => 'GitHubUser', 'committer' => 'GitHubUser', 'commit' => 'GitHubCommitCommit', 'parents' => 'array<GitHubCommitParents>'));
 }
コード例 #25
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('sha' => 'string', 'url' => 'string', 'tree' => 'array<GitHubTree>'));
 }
コード例 #26
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('title' => 'string', 'url' => 'string', 'latest_comment_url' => 'string', 'type' => 'string'));
 }
コード例 #27
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('label' => 'string', 'ref' => 'string', 'sha' => 'string', 'user' => 'GitHubUser', 'repo' => 'GitHubRepo'));
 }
コード例 #28
0
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('name' => 'string', 'zipball_url' => 'string', 'tarball_url' => 'string', 'commit' => 'string'));
 }
コード例 #29
0
 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'));
 }
コード例 #30
0
ファイル: GitHubRef.php プロジェクト: brajola/dashboard
 protected function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('ref' => 'string', 'url' => 'string', 'object' => 'GitHubRefObject'));
 }