Source for file statuses.php
Documentation is available at statuses.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 a status.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $sha The SHA1 value for which to set the status.
* @param string $state The state (pending, success, error or failure).
* @param string $targetUrl Optional target URL.
* @param string $description Optional description for the status.
public function create($user, $repo, $sha, $state, $targetUrl =
null, $description =
null)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/statuses/' .
$sha;
if (!in_array($state, array('pending', 'success', 'error', 'failure')))
throw
new InvalidArgumentException('State must be one of pending, success, error or failure.');
// Build the request data.
$data['target_url'] =
$targetUrl;
$data['description'] =
$description;
// 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 list statuses for an SHA.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $sha SHA1 for which to get the statuses.
public function getList($user, $repo, $sha)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/statuses/' .
$sha;
// 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:14:21 +0100 by phpDocumentor 1.4.3