Completed
Push — master ( da17ac...286914 )
by George
03:50
created

Repositories   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 47
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getApiResponse() 0 4 1
A getTags() 0 10 1
1
<?php
2
3
namespace Stats\GitHub\Package;
4
5
use Joomla\Github\Package\Repositories as BaseRepositories;
6
use Joomla\Http\Response;
7
8
/**
9
 * Extended GitHub API Repositories class.
10
 *
11
 * @since  1.0
12
 */
13
class Repositories extends BaseRepositories
14
{
15
	/**
16
	 * API Response object
17
	 *
18
	 * @var    Response
19
	 * @since  1.0
20
	 */
21
	private $apiResponse;
22
23
	/**
24
	 * Get the last API response if one is set
25
	 *
26
	 * @return  Response|null
27
	 *
28
	 * @since   1.0
29
	 */
30
	public function getApiResponse()
31
	{
32
		return $this->apiResponse;
33
	}
34
35
	/**
36
	 * Get a list of tags on a repository.
37
	 *
38
	 * Note: This is different from the parent `getListTags` method as it adds support for the API's pagination. This extended method can be removed
39
	 * if the upstream class gains this support.
40
	 *
41
	 * @param   string   $owner  Repository owner.
42
	 * @param   string   $repo   Repository name.
43
	 * @param   integer  $page   The page number from which to get items.
44
	 *
45
	 * @return  object
46
	 *
47
	 * @since   1.0
48
	 */
49
	public function getTags($owner, $repo, $page = 0)
50
	{
51
		// Build the request path.
52
		$path = '/repos/' . $owner . '/' . $repo . '/tags';
53
54
		// Send the request.
55
		$this->apiResponse = $this->client->get($this->fetchUrl($path, $page));
56
57
		return $this->processResponse($this->apiResponse);
58
	}
59
}
60