@@ -13,47 +13,47 @@ |
||
13 | 13 | class Commits extends AbstractGitData |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Get a Commit |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/git/commits/#get-a-commit |
|
20 | - * |
|
21 | - * @param string $sha |
|
22 | - * |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function get(string $sha): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits/:sha', |
|
28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | - } |
|
16 | + /** |
|
17 | + * Get a Commit |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/git/commits/#get-a-commit |
|
20 | + * |
|
21 | + * @param string $sha |
|
22 | + * |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function get(string $sha): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits/:sha', |
|
28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Create a Commit |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/git/commits/#create-a-commit |
|
35 | - * |
|
36 | - * @param string $message |
|
37 | - * @param string $tree |
|
38 | - * @param array|string $parents |
|
39 | - * @param string $name |
|
40 | - * @param string $email |
|
41 | - * @param string $date |
|
42 | - * |
|
43 | - * @return array |
|
44 | - * @throws \Exception |
|
45 | - */ |
|
46 | - public function create(string $message, string $tree, $parents, string $name = null, string $email = null, |
|
47 | - string $date = 'now'): array |
|
48 | - { |
|
49 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits', |
|
50 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
51 | - 'message' => $message, |
|
52 | - 'tree' => $tree, |
|
53 | - 'parents' => $parents, |
|
54 | - 'name' => $name, |
|
55 | - 'email' => $email, |
|
56 | - 'date' => (new DateTime($date))->format(DateTime::ATOM) |
|
57 | - ]); |
|
58 | - } |
|
31 | + /** |
|
32 | + * Create a Commit |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/git/commits/#create-a-commit |
|
35 | + * |
|
36 | + * @param string $message |
|
37 | + * @param string $tree |
|
38 | + * @param array|string $parents |
|
39 | + * @param string $name |
|
40 | + * @param string $email |
|
41 | + * @param string $date |
|
42 | + * |
|
43 | + * @return array |
|
44 | + * @throws \Exception |
|
45 | + */ |
|
46 | + public function create(string $message, string $tree, $parents, string $name = null, string $email = null, |
|
47 | + string $date = 'now'): array |
|
48 | + { |
|
49 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits', |
|
50 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
51 | + 'message' => $message, |
|
52 | + 'tree' => $tree, |
|
53 | + 'parents' => $parents, |
|
54 | + 'name' => $name, |
|
55 | + 'email' => $email, |
|
56 | + 'date' => (new DateTime($date))->format(DateTime::ATOM) |
|
57 | + ]); |
|
58 | + } |
|
59 | 59 | } |
60 | 60 | \ No newline at end of file |
@@ -12,46 +12,46 @@ |
||
12 | 12 | class Tags extends AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get a Tag |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/git/tags/#get-a-tag |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @throws \Exception |
|
24 | - */ |
|
25 | - public function get(string $sha): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/tags/:sha', |
|
28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | - } |
|
15 | + /** |
|
16 | + * Get a Tag |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/git/tags/#get-a-tag |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @throws \Exception |
|
24 | + */ |
|
25 | + public function get(string $sha): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/tags/:sha', |
|
28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Create a Tag Object |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/git/tags/#create-a-tag-object |
|
35 | - * |
|
36 | - * @param string $tag |
|
37 | - * @param string $message |
|
38 | - * @param string $object |
|
39 | - * @param string $type |
|
40 | - * @param array $tagger |
|
41 | - * |
|
42 | - * @return array |
|
43 | - * @throws \Exception |
|
44 | - */ |
|
45 | - public function create(string $tag, string $message, string $object, string $type, array $tagger = []): array |
|
46 | - { |
|
47 | - return $this->getApi()->request($this->getApi() |
|
48 | - ->sprintf('/repos/:owner/:repo/git/tags', $this->getGitData()->getOwner(), |
|
49 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
50 | - 'tag' => $tag, |
|
51 | - 'message' => $message, |
|
52 | - 'object' => $object, |
|
53 | - 'type' => $type, |
|
54 | - 'tagger' => $tagger |
|
55 | - ]); |
|
56 | - } |
|
31 | + /** |
|
32 | + * Create a Tag Object |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/git/tags/#create-a-tag-object |
|
35 | + * |
|
36 | + * @param string $tag |
|
37 | + * @param string $message |
|
38 | + * @param string $object |
|
39 | + * @param string $type |
|
40 | + * @param array $tagger |
|
41 | + * |
|
42 | + * @return array |
|
43 | + * @throws \Exception |
|
44 | + */ |
|
45 | + public function create(string $tag, string $message, string $object, string $type, array $tagger = []): array |
|
46 | + { |
|
47 | + return $this->getApi()->request($this->getApi() |
|
48 | + ->sprintf('/repos/:owner/:repo/git/tags', $this->getGitData()->getOwner(), |
|
49 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
50 | + 'tag' => $tag, |
|
51 | + 'message' => $message, |
|
52 | + 'object' => $object, |
|
53 | + 'type' => $type, |
|
54 | + 'tagger' => $tagger |
|
55 | + ]); |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | \ No newline at end of file |
@@ -12,98 +12,98 @@ |
||
12 | 12 | class References extends AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get a Reference |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/git/refs/#get-a-reference |
|
19 | - * |
|
20 | - * @param string $branch |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @throws \Exception |
|
24 | - */ |
|
25 | - public function get(string $branch): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/heads/:branch', |
|
28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $branch)); |
|
29 | - } |
|
15 | + /** |
|
16 | + * Get a Reference |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/git/refs/#get-a-reference |
|
19 | + * |
|
20 | + * @param string $branch |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @throws \Exception |
|
24 | + */ |
|
25 | + public function get(string $branch): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/heads/:branch', |
|
28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $branch)); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Get all References |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/git/refs/#get-all-references |
|
35 | - * @return array |
|
36 | - * @throws \Exception |
|
37 | - */ |
|
38 | - public function getAll(): array |
|
39 | - { |
|
40 | - return $this->getApi()->request($this->getApi() |
|
41 | - ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
42 | - $this->getGitData()->getRepo())); |
|
43 | - } |
|
31 | + /** |
|
32 | + * Get all References |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/git/refs/#get-all-references |
|
35 | + * @return array |
|
36 | + * @throws \Exception |
|
37 | + */ |
|
38 | + public function getAll(): array |
|
39 | + { |
|
40 | + return $this->getApi()->request($this->getApi() |
|
41 | + ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
42 | + $this->getGitData()->getRepo())); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Create a Reference |
|
47 | - * |
|
48 | - * @link https://developer.github.com/v3/git/refs/#create-a-reference |
|
49 | - * |
|
50 | - * @param string $ref |
|
51 | - * @param string $sha |
|
52 | - * |
|
53 | - * @return array |
|
54 | - * @throws \Exception |
|
55 | - */ |
|
56 | - public function create(string $ref, string $sha): array |
|
57 | - { |
|
58 | - return $this->getApi()->request($this->getApi() |
|
59 | - ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
60 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
61 | - 'ref' => $ref, |
|
62 | - 'sha' => $sha |
|
63 | - ]); |
|
64 | - } |
|
45 | + /** |
|
46 | + * Create a Reference |
|
47 | + * |
|
48 | + * @link https://developer.github.com/v3/git/refs/#create-a-reference |
|
49 | + * |
|
50 | + * @param string $ref |
|
51 | + * @param string $sha |
|
52 | + * |
|
53 | + * @return array |
|
54 | + * @throws \Exception |
|
55 | + */ |
|
56 | + public function create(string $ref, string $sha): array |
|
57 | + { |
|
58 | + return $this->getApi()->request($this->getApi() |
|
59 | + ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
60 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
61 | + 'ref' => $ref, |
|
62 | + 'sha' => $sha |
|
63 | + ]); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Update a Reference |
|
68 | - * |
|
69 | - * @link https://developer.github.com/v3/git/refs/#update-a-reference |
|
70 | - * |
|
71 | - * @param string $ref |
|
72 | - * @param string $sha |
|
73 | - * @param bool $force |
|
74 | - * |
|
75 | - * @return array |
|
76 | - * @throws \Exception |
|
77 | - */ |
|
78 | - public function update(string $ref, string $sha, bool $force = false): array |
|
79 | - { |
|
80 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/:ref', |
|
81 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $ref), Request::METHOD_POST, [ |
|
82 | - 'sha' => $sha, |
|
83 | - 'force' => $force |
|
84 | - ]); |
|
85 | - } |
|
66 | + /** |
|
67 | + * Update a Reference |
|
68 | + * |
|
69 | + * @link https://developer.github.com/v3/git/refs/#update-a-reference |
|
70 | + * |
|
71 | + * @param string $ref |
|
72 | + * @param string $sha |
|
73 | + * @param bool $force |
|
74 | + * |
|
75 | + * @return array |
|
76 | + * @throws \Exception |
|
77 | + */ |
|
78 | + public function update(string $ref, string $sha, bool $force = false): array |
|
79 | + { |
|
80 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/:ref', |
|
81 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $ref), Request::METHOD_POST, [ |
|
82 | + 'sha' => $sha, |
|
83 | + 'force' => $force |
|
84 | + ]); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * Delete a Reference |
|
89 | - * |
|
90 | - * @link https://developer.github.com/v3/git/refs/#delete-a-reference |
|
91 | - * |
|
92 | - * @param string $ref |
|
93 | - * |
|
94 | - * @return bool |
|
95 | - * @throws \Exception |
|
96 | - */ |
|
97 | - public function delete(string $ref): bool |
|
98 | - { |
|
99 | - $this->getApi()->request($this->getApi() |
|
100 | - ->sprintf('/repos/:owner/:repo/git/refs/:ref', $this->getGitData()->getOwner(), |
|
101 | - $this->getGitData()->getRepo(), $ref), Request::METHOD_DELETE); |
|
87 | + /** |
|
88 | + * Delete a Reference |
|
89 | + * |
|
90 | + * @link https://developer.github.com/v3/git/refs/#delete-a-reference |
|
91 | + * |
|
92 | + * @param string $ref |
|
93 | + * |
|
94 | + * @return bool |
|
95 | + * @throws \Exception |
|
96 | + */ |
|
97 | + public function delete(string $ref): bool |
|
98 | + { |
|
99 | + $this->getApi()->request($this->getApi() |
|
100 | + ->sprintf('/repos/:owner/:repo/git/refs/:ref', $this->getGitData()->getOwner(), |
|
101 | + $this->getGitData()->getRepo(), $ref), Request::METHOD_DELETE); |
|
102 | 102 | |
103 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
104 | - return true; |
|
105 | - } |
|
103 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
104 | + return true; |
|
105 | + } |
|
106 | 106 | |
107 | - return false; |
|
108 | - } |
|
107 | + return false; |
|
108 | + } |
|
109 | 109 | } |
110 | 110 | \ No newline at end of file |
@@ -12,56 +12,56 @@ |
||
12 | 12 | class Trees extends AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get a Tree |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/git/trees/#get-a-tree |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @throws \Exception |
|
24 | - */ |
|
25 | - public function get(string $sha): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha', |
|
28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | - } |
|
15 | + /** |
|
16 | + * Get a Tree |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/git/trees/#get-a-tree |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @throws \Exception |
|
24 | + */ |
|
25 | + public function get(string $sha): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha', |
|
28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Get a Tree Recursively |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/git/trees/#get-a-tree-recursively |
|
35 | - * |
|
36 | - * @param string $sha |
|
37 | - * |
|
38 | - * @return array |
|
39 | - * @throws \Exception |
|
40 | - */ |
|
41 | - public function getRecursively(string $sha): array |
|
42 | - { |
|
43 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha?recursive=1', |
|
44 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
45 | - } |
|
31 | + /** |
|
32 | + * Get a Tree Recursively |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/git/trees/#get-a-tree-recursively |
|
35 | + * |
|
36 | + * @param string $sha |
|
37 | + * |
|
38 | + * @return array |
|
39 | + * @throws \Exception |
|
40 | + */ |
|
41 | + public function getRecursively(string $sha): array |
|
42 | + { |
|
43 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha?recursive=1', |
|
44 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Create a Tree |
|
49 | - * |
|
50 | - * @link https://developer.github.com/v3/git/trees/#create-a-tree |
|
51 | - * |
|
52 | - * @param array $tree |
|
53 | - * @param string $base_tree |
|
54 | - * |
|
55 | - * @return array |
|
56 | - * @throws \Exception |
|
57 | - */ |
|
58 | - public function create(array $tree, string $base_tree): array |
|
59 | - { |
|
60 | - return $this->getApi()->request($this->getApi() |
|
61 | - ->sprintf('/repos/:owner/:repo/git/trees', $this->getGitData()->getOwner(), |
|
62 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
63 | - 'tree' => $tree, |
|
64 | - 'base_tree' => $base_tree |
|
65 | - ]); |
|
66 | - } |
|
47 | + /** |
|
48 | + * Create a Tree |
|
49 | + * |
|
50 | + * @link https://developer.github.com/v3/git/trees/#create-a-tree |
|
51 | + * |
|
52 | + * @param array $tree |
|
53 | + * @param string $base_tree |
|
54 | + * |
|
55 | + * @return array |
|
56 | + * @throws \Exception |
|
57 | + */ |
|
58 | + public function create(array $tree, string $base_tree): array |
|
59 | + { |
|
60 | + return $this->getApi()->request($this->getApi() |
|
61 | + ->sprintf('/repos/:owner/:repo/git/trees', $this->getGitData()->getOwner(), |
|
62 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
63 | + 'tree' => $tree, |
|
64 | + 'base_tree' => $base_tree |
|
65 | + ]); |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -12,66 +12,66 @@ |
||
12 | 12 | abstract class AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** Properties */ |
|
16 | - protected $gitData; |
|
17 | - protected $api; |
|
15 | + /** Properties */ |
|
16 | + protected $gitData; |
|
17 | + protected $api; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Constructor |
|
21 | - * |
|
22 | - * @param GitData $gitData |
|
23 | - */ |
|
24 | - public function __construct(GitData $gitData) |
|
25 | - { |
|
26 | - $this->setGitData($gitData); |
|
27 | - $this->setApi($gitData->getApi()); |
|
28 | - } |
|
19 | + /** |
|
20 | + * Constructor |
|
21 | + * |
|
22 | + * @param GitData $gitData |
|
23 | + */ |
|
24 | + public function __construct(GitData $gitData) |
|
25 | + { |
|
26 | + $this->setGitData($gitData); |
|
27 | + $this->setApi($gitData->getApi()); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get gitData |
|
32 | - * |
|
33 | - * @return GitData |
|
34 | - */ |
|
35 | - public function getGitData(): GitData |
|
36 | - { |
|
37 | - return $this->gitData; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Get gitData |
|
32 | + * |
|
33 | + * @return GitData |
|
34 | + */ |
|
35 | + public function getGitData(): GitData |
|
36 | + { |
|
37 | + return $this->gitData; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Set gitData |
|
42 | - * |
|
43 | - * @param GitData $gitData |
|
44 | - * |
|
45 | - * @return AbstractGitData |
|
46 | - */ |
|
47 | - public function setGitData(GitData $gitData): AbstractGitData |
|
48 | - { |
|
49 | - $this->gitData = $gitData; |
|
40 | + /** |
|
41 | + * Set gitData |
|
42 | + * |
|
43 | + * @param GitData $gitData |
|
44 | + * |
|
45 | + * @return AbstractGitData |
|
46 | + */ |
|
47 | + public function setGitData(GitData $gitData): AbstractGitData |
|
48 | + { |
|
49 | + $this->gitData = $gitData; |
|
50 | 50 | |
51 | - return $this; |
|
52 | - } |
|
51 | + return $this; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Get api |
|
56 | - * |
|
57 | - * @return AbstractApi |
|
58 | - */ |
|
59 | - public function getApi(): AbstractApi |
|
60 | - { |
|
61 | - return $this->api; |
|
62 | - } |
|
54 | + /** |
|
55 | + * Get api |
|
56 | + * |
|
57 | + * @return AbstractApi |
|
58 | + */ |
|
59 | + public function getApi(): AbstractApi |
|
60 | + { |
|
61 | + return $this->api; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Set api |
|
66 | - * |
|
67 | - * @param AbstractApi $api |
|
68 | - * |
|
69 | - * @return AbstractGitData |
|
70 | - */ |
|
71 | - public function setApi(AbstractApi $api): AbstractGitData |
|
72 | - { |
|
73 | - $this->api = $api; |
|
64 | + /** |
|
65 | + * Set api |
|
66 | + * |
|
67 | + * @param AbstractApi $api |
|
68 | + * |
|
69 | + * @return AbstractGitData |
|
70 | + */ |
|
71 | + public function setApi(AbstractApi $api): AbstractGitData |
|
72 | + { |
|
73 | + $this->api = $api; |
|
74 | 74 | |
75 | - return $this; |
|
76 | - } |
|
75 | + return $this; |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -12,38 +12,38 @@ |
||
12 | 12 | class Blobs extends AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get a Blob |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/git/blobs/#get-a-blob |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function getBlob(string $sha): array |
|
25 | - { |
|
26 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/blobs/:sha', |
|
27 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
28 | - } |
|
15 | + /** |
|
16 | + * Get a Blob |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/git/blobs/#get-a-blob |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function getBlob(string $sha): array |
|
25 | + { |
|
26 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/blobs/:sha', |
|
27 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Create a Blob |
|
32 | - * |
|
33 | - * @link https://developer.github.com/v3/git/blobs/#create-a-blob |
|
34 | - * |
|
35 | - * @param string $content |
|
36 | - * @param string $encoding |
|
37 | - * |
|
38 | - * @return array |
|
39 | - */ |
|
40 | - public function createBlob(string $content, string $encoding = 'utf-8'): array |
|
41 | - { |
|
42 | - return $this->getApi()->request($this->getApi() |
|
43 | - ->sprintf('/repos/:owner/:repo/git/blobs', $this->getGitData()->getOwner(), |
|
44 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
45 | - 'content' => $content, |
|
46 | - 'encoding' => $encoding |
|
47 | - ]); |
|
48 | - } |
|
30 | + /** |
|
31 | + * Create a Blob |
|
32 | + * |
|
33 | + * @link https://developer.github.com/v3/git/blobs/#create-a-blob |
|
34 | + * |
|
35 | + * @param string $content |
|
36 | + * @param string $encoding |
|
37 | + * |
|
38 | + * @return array |
|
39 | + */ |
|
40 | + public function createBlob(string $content, string $encoding = 'utf-8'): array |
|
41 | + { |
|
42 | + return $this->getApi()->request($this->getApi() |
|
43 | + ->sprintf('/repos/:owner/:repo/git/blobs', $this->getGitData()->getOwner(), |
|
44 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
45 | + 'content' => $content, |
|
46 | + 'encoding' => $encoding |
|
47 | + ]); |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -10,11 +10,11 @@ |
||
10 | 10 | class Miscellaneous extends AbstractReceiver |
11 | 11 | { |
12 | 12 | |
13 | - /** Available sub-Receiver */ |
|
14 | - const EMOJIS = 'Emojis'; |
|
15 | - const GITIGNORE = 'Gitignore'; |
|
16 | - const MARKDOWN = 'Markdown'; |
|
17 | - const META = 'Meta'; |
|
18 | - const RATE_LIMIT = 'RateLimit'; |
|
19 | - const LICENSES = 'Licenses'; |
|
13 | + /** Available sub-Receiver */ |
|
14 | + const EMOJIS = 'Emojis'; |
|
15 | + const GITIGNORE = 'Gitignore'; |
|
16 | + const MARKDOWN = 'Markdown'; |
|
17 | + const META = 'Meta'; |
|
18 | + const RATE_LIMIT = 'RateLimit'; |
|
19 | + const LICENSES = 'Licenses'; |
|
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -13,113 +13,113 @@ |
||
13 | 13 | class Comments extends AbstractIssues |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List comments on an issue |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue |
|
20 | - * |
|
21 | - * @param int $number |
|
22 | - * |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function listIssueComments(int $number): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/comments', |
|
28 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
29 | - } |
|
16 | + /** |
|
17 | + * List comments on an issue |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue |
|
20 | + * |
|
21 | + * @param int $number |
|
22 | + * |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function listIssueComments(int $number): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/comments', |
|
28 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * List comments in a repository |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/issues/comments/#list-comments-in-a-repository |
|
35 | - * |
|
36 | - * @param string $sort |
|
37 | - * @param string $direction |
|
38 | - * @param string $since |
|
39 | - * |
|
40 | - * @return array |
|
41 | - */ |
|
42 | - public function listRepositoryComments(string $sort = AbstractApi::SORT_CREATED, |
|
43 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
44 | - string $since = 'now'): array |
|
45 | - { |
|
46 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments?:args', |
|
47 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), http_build_query([ |
|
48 | - 'sort' => $sort, |
|
49 | - 'direction' => $direction, |
|
50 | - 'since' => $since |
|
51 | - ]))); |
|
52 | - } |
|
31 | + /** |
|
32 | + * List comments in a repository |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/issues/comments/#list-comments-in-a-repository |
|
35 | + * |
|
36 | + * @param string $sort |
|
37 | + * @param string $direction |
|
38 | + * @param string $since |
|
39 | + * |
|
40 | + * @return array |
|
41 | + */ |
|
42 | + public function listRepositoryComments(string $sort = AbstractApi::SORT_CREATED, |
|
43 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
44 | + string $since = 'now'): array |
|
45 | + { |
|
46 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments?:args', |
|
47 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), http_build_query([ |
|
48 | + 'sort' => $sort, |
|
49 | + 'direction' => $direction, |
|
50 | + 'since' => $since |
|
51 | + ]))); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Get a single comment |
|
56 | - * |
|
57 | - * @link https://developer.github.com/v3/issues/comments/#get-a-single-comment |
|
58 | - * |
|
59 | - * @param int $id |
|
60 | - * |
|
61 | - * @return array |
|
62 | - */ |
|
63 | - public function getComment(int $id): array |
|
64 | - { |
|
65 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
66 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id)); |
|
67 | - } |
|
54 | + /** |
|
55 | + * Get a single comment |
|
56 | + * |
|
57 | + * @link https://developer.github.com/v3/issues/comments/#get-a-single-comment |
|
58 | + * |
|
59 | + * @param int $id |
|
60 | + * |
|
61 | + * @return array |
|
62 | + */ |
|
63 | + public function getComment(int $id): array |
|
64 | + { |
|
65 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
66 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id)); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Create a comment |
|
71 | - * |
|
72 | - * @link https://developer.github.com/v3/issues/comments/#create-a-comment |
|
73 | - * |
|
74 | - * @param int $number |
|
75 | - * @param string $body |
|
76 | - * |
|
77 | - * @return array |
|
78 | - */ |
|
79 | - public function createComment(int $number, string $body): array |
|
80 | - { |
|
81 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/comments', |
|
82 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_POST, [ |
|
83 | - 'body' => $body |
|
84 | - ]); |
|
85 | - } |
|
69 | + /** |
|
70 | + * Create a comment |
|
71 | + * |
|
72 | + * @link https://developer.github.com/v3/issues/comments/#create-a-comment |
|
73 | + * |
|
74 | + * @param int $number |
|
75 | + * @param string $body |
|
76 | + * |
|
77 | + * @return array |
|
78 | + */ |
|
79 | + public function createComment(int $number, string $body): array |
|
80 | + { |
|
81 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/comments', |
|
82 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_POST, [ |
|
83 | + 'body' => $body |
|
84 | + ]); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * Edit a comment |
|
89 | - * |
|
90 | - * @link https://developer.github.com/v3/issues/comments/#edit-a-comment |
|
91 | - * |
|
92 | - * @param int $id |
|
93 | - * @param string $body |
|
94 | - * |
|
95 | - * @return array |
|
96 | - */ |
|
97 | - public function editComment(int $id, string $body): array |
|
98 | - { |
|
99 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
100 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
101 | - 'body' => $body |
|
102 | - ]); |
|
103 | - } |
|
87 | + /** |
|
88 | + * Edit a comment |
|
89 | + * |
|
90 | + * @link https://developer.github.com/v3/issues/comments/#edit-a-comment |
|
91 | + * |
|
92 | + * @param int $id |
|
93 | + * @param string $body |
|
94 | + * |
|
95 | + * @return array |
|
96 | + */ |
|
97 | + public function editComment(int $id, string $body): array |
|
98 | + { |
|
99 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
100 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
101 | + 'body' => $body |
|
102 | + ]); |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * Delete a comment |
|
107 | - * |
|
108 | - * @link https://developer.github.com/v3/issues/comments/#delete-a-comment |
|
109 | - * |
|
110 | - * @param int $id |
|
111 | - * |
|
112 | - * @return bool |
|
113 | - */ |
|
114 | - public function deleteComment(int $id): bool |
|
115 | - { |
|
116 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
117 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id), Request::METHOD_DELETE); |
|
105 | + /** |
|
106 | + * Delete a comment |
|
107 | + * |
|
108 | + * @link https://developer.github.com/v3/issues/comments/#delete-a-comment |
|
109 | + * |
|
110 | + * @param int $id |
|
111 | + * |
|
112 | + * @return bool |
|
113 | + */ |
|
114 | + public function deleteComment(int $id): bool |
|
115 | + { |
|
116 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
117 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id), Request::METHOD_DELETE); |
|
118 | 118 | |
119 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
120 | - return true; |
|
121 | - } |
|
119 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
120 | + return true; |
|
121 | + } |
|
122 | 122 | |
123 | - return false; |
|
124 | - } |
|
123 | + return false; |
|
124 | + } |
|
125 | 125 | } |
126 | 126 | \ No newline at end of file |
@@ -10,45 +10,45 @@ |
||
10 | 10 | class Events extends AbstractIssues |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * List events for an issue |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/issues/events/#list-events-for-an-issue |
|
17 | - * |
|
18 | - * @param int $issueNumber |
|
19 | - * |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function listIssueEvents(int $issueNumber): array |
|
23 | - { |
|
24 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:issue_number/events', |
|
25 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $issueNumber)); |
|
26 | - } |
|
13 | + /** |
|
14 | + * List events for an issue |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/issues/events/#list-events-for-an-issue |
|
17 | + * |
|
18 | + * @param int $issueNumber |
|
19 | + * |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function listIssueEvents(int $issueNumber): array |
|
23 | + { |
|
24 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:issue_number/events', |
|
25 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $issueNumber)); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * List events for a repository |
|
30 | - * |
|
31 | - * @link https://developer.github.com/v3/issues/events/#list-events-for-a-repository |
|
32 | - * @return array |
|
33 | - */ |
|
34 | - public function listRepositoryEvents(): array |
|
35 | - { |
|
36 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', |
|
37 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo())); |
|
38 | - } |
|
28 | + /** |
|
29 | + * List events for a repository |
|
30 | + * |
|
31 | + * @link https://developer.github.com/v3/issues/events/#list-events-for-a-repository |
|
32 | + * @return array |
|
33 | + */ |
|
34 | + public function listRepositoryEvents(): array |
|
35 | + { |
|
36 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', |
|
37 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo())); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Get a single event |
|
42 | - * |
|
43 | - * @link https://developer.github.com/v3/issues/events/#get-a-single-event |
|
44 | - * |
|
45 | - * @param int $id |
|
46 | - * |
|
47 | - * @return array |
|
48 | - */ |
|
49 | - public function getEvent(int $id): array |
|
50 | - { |
|
51 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events/:id', |
|
52 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id)); |
|
53 | - } |
|
40 | + /** |
|
41 | + * Get a single event |
|
42 | + * |
|
43 | + * @link https://developer.github.com/v3/issues/events/#get-a-single-event |
|
44 | + * |
|
45 | + * @param int $id |
|
46 | + * |
|
47 | + * @return array |
|
48 | + */ |
|
49 | + public function getEvent(int $id): array |
|
50 | + { |
|
51 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events/:id', |
|
52 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id)); |
|
53 | + } |
|
54 | 54 | } |
55 | 55 | \ No newline at end of file |