-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathgithubobject.php
More file actions
executable file
·72 lines (63 loc) · 1.28 KB
/
githubobject.php
File metadata and controls
executable file
·72 lines (63 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* @package Joomla.Platform
* @subpackage Client
*
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* HTTP client class.
*
* @package Joomla.Platform
* @subpackage Client
* @since 11.1
*/
class JGithubObject
{
/**
* Github Connector
*
* @var JGithub
* @since 11.3
*/
protected $connector = null;
/**
* Constructor.
*
* @param array $options Array of configuration options for the client.
*
* @return void
*
* @since 11.1
*/
public function __construct($connector, $options = array())
{
$this->connector = $connector;
}
protected function paginate($url, $page = 0, $per_page = 0)
{
//TODO: Make a new base class and move paginate into it
$query_string = array();
if ($page > 0) {
$query_string[] = 'page='.(int)$page;
}
if ($per_page > 0) {
$query_string[] = 'per_page='.(int)$per_page;
}
if (isset($query_string[0])) {
$query = implode('&', $query_string);
} else {
$query = '';
}
if (strlen($query) > 0) {
if (strpos($url, '?') === false) {
$url .= '?'.$query;
} else {
$url .= '&'.$query;
}
}
return $url;
}
}