Source for file refs.php
Documentation is available at refs.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* GitHub API References class for the Joomla Platform.
* @package Joomla.Platform
* Method to create an issue.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $ref The name of the fully qualified reference.
* @param string $sha The SHA1 value to set this reference to.
public function create($user, $repo, $ref, $sha)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/git/refs';
// Build the request data.
// Validate the response code.
if ($response->code !=
201)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to update a reference.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $ref The reference to update.
* @param string $sha The SHA1 value to set the reference to.
* @param string $force Whether the update should be forced. Default to false.
public function edit($user, $repo, $ref, $sha, $force =
false)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/git/refs/' .
$ref;
// Craete the data object.
// If a title is set add it to the data object.
// Encode the request data.
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to get a reference.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $ref The reference to get.
public function get($user, $repo, $ref)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/git/refs/' .
$ref;
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to list references for a repository.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $namespace Optional sub-namespace to limit the returned references.
* @param integer $page Page to request
* @param integer $limit Number of results to return per page
public function getList($user, $repo, $namespace =
'', $page =
0, $limit =
0)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/git/refs' .
$namespace;
$response =
$this->client->get($this->fetchUrl($path, $page, $limit));
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
Documentation generated on Tue, 19 Nov 2013 15:11:39 +0100 by phpDocumentor 1.4.3