Completed
Push — master ( 10f95b...bf15d4 )
by Michael
09:02
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 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 47
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

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