Completed
Push — mysql_improvements ( 2e95ce...dedbef )
by Michael
03:52
created

Repositories   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

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