mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-27 10:39:48 +09:00
Update composer dependencies
This commit is contained in:
@@ -98,7 +98,7 @@ abstract class AbstractApi implements ApiInterface
|
||||
if (null !== $this->perPage && !isset($parameters['per_page'])) {
|
||||
$parameters['per_page'] = $this->perPage;
|
||||
}
|
||||
if (array_key_exists('ref', $parameters) && is_null($parameters['ref'])) {
|
||||
if (array_key_exists('ref', $parameters) && null === $parameters['ref']) {
|
||||
unset($parameters['ref']);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ abstract class AbstractApi implements ApiInterface
|
||||
*/
|
||||
protected function head($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
if (array_key_exists('ref', $parameters) && is_null($parameters['ref'])) {
|
||||
if (array_key_exists('ref', $parameters) && null === $parameters['ref']) {
|
||||
unset($parameters['ref']);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Github\Api;
|
||||
*/
|
||||
trait AcceptHeaderTrait
|
||||
{
|
||||
protected $acceptHeaderValue = null;
|
||||
protected $acceptHeaderValue;
|
||||
|
||||
protected function get($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class Authorizations extends AbstractApi
|
||||
/**
|
||||
* Show a single authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param string $clientId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -51,8 +51,8 @@ class Authorizations extends AbstractApi
|
||||
/**
|
||||
* Update an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param array $params
|
||||
* @param string $clientId
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ class Authorizations extends AbstractApi
|
||||
/**
|
||||
* Remove an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param string $clientId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -76,8 +76,8 @@ class Authorizations extends AbstractApi
|
||||
/**
|
||||
* Check an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param $token
|
||||
* @param string $clientId
|
||||
* @param string $token
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -89,8 +89,8 @@ class Authorizations extends AbstractApi
|
||||
/**
|
||||
* Reset an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param $token
|
||||
* @param string $clientId
|
||||
* @param string $token
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -102,8 +102,8 @@ class Authorizations extends AbstractApi
|
||||
/**
|
||||
* Remove an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param $token
|
||||
* @param string $clientId
|
||||
* @param string $token
|
||||
*/
|
||||
public function revoke($clientId, $token)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ class Authorizations extends AbstractApi
|
||||
/**
|
||||
* Revoke all authorizations.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param string $clientId
|
||||
*/
|
||||
public function revokeAll($clientId)
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ class Emails extends AbstractApi
|
||||
if (is_string($emails)) {
|
||||
$emails = [$emails];
|
||||
} elseif (0 === count($emails)) {
|
||||
throw new InvalidArgumentException();
|
||||
throw new InvalidArgumentException('The user emails parameter should be a single email or an array of emails');
|
||||
}
|
||||
|
||||
return $this->post('/user/emails', $emails);
|
||||
@@ -74,7 +74,7 @@ class Emails extends AbstractApi
|
||||
if (is_string($emails)) {
|
||||
$emails = [$emails];
|
||||
} elseif (0 === count($emails)) {
|
||||
throw new InvalidArgumentException();
|
||||
throw new InvalidArgumentException('The user emails parameter should be a single email or an array of emails');
|
||||
}
|
||||
|
||||
return $this->delete('/user/emails', $emails);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Github\Api\CurrentUser;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/activity/starring/
|
||||
@@ -11,6 +12,26 @@ use Github\Api\AbstractApi;
|
||||
*/
|
||||
class Starring extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @see https://developer.github.com/v3/activity/starring/#list-stargazers
|
||||
*
|
||||
* @param string $bodyType
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if ('star' === $bodyType) {
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.star+json', $this->client->getApiVersion());
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List repositories starred by the authenticated user.
|
||||
*
|
||||
|
||||
@@ -28,7 +28,7 @@ class Gists extends AbstractApi
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if (!in_array($bodyType, ['base64'])) {
|
||||
if ('base64' !== $bodyType) {
|
||||
$bodyType = 'raw';
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ class Events extends AbstractApi
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/events/#get-a-single-event
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $event
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $event
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@@ -120,10 +120,10 @@ class Labels extends AbstractApi
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $issue
|
||||
* @param string $labels
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $issue
|
||||
* @param string|array $labels
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
@@ -134,7 +134,7 @@ class Labels extends AbstractApi
|
||||
if (is_string($labels)) {
|
||||
$labels = [$labels];
|
||||
} elseif (0 === count($labels)) {
|
||||
throw new InvalidArgumentException();
|
||||
throw new InvalidArgumentException('The labels parameter should be a single label or an array of labels');
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $labels);
|
||||
@@ -167,7 +167,7 @@ class Labels extends AbstractApi
|
||||
* @param string $issue
|
||||
* @param string $label
|
||||
*
|
||||
* @return null
|
||||
* @return array|string
|
||||
*/
|
||||
public function remove($username, $repository, $issue, $label)
|
||||
{
|
||||
@@ -183,7 +183,7 @@ class Labels extends AbstractApi
|
||||
* @param string $repository
|
||||
* @param string $issue
|
||||
*
|
||||
* @return null
|
||||
* @return array|string
|
||||
*/
|
||||
public function clear($username, $repository, $issue)
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ class Milestones extends AbstractApi
|
||||
* @param string $repository
|
||||
* @param int $id
|
||||
*
|
||||
* @return null
|
||||
* @return array|string
|
||||
*/
|
||||
public function remove($username, $repository, $id)
|
||||
{
|
||||
|
||||
34
vendor/knplabs/github-api/lib/Github/Api/Miscellaneous/Licenses.php
vendored
Normal file
34
vendor/knplabs/github-api/lib/Github/Api/Miscellaneous/Licenses.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Miscellaneous;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
class Licenses extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Lists all the licenses available on GitHub.
|
||||
*
|
||||
* @link https://developer.github.com/v3/licenses/
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->get('/licenses');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an individual license by its license key.
|
||||
*
|
||||
* @link https://developer.github.com/v3/licenses/#get-an-individual-license
|
||||
*
|
||||
* @param string $license
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($license)
|
||||
{
|
||||
return $this->get('/licenses/'.rawurlencode($license));
|
||||
}
|
||||
}
|
||||
@@ -91,9 +91,9 @@ class Organization extends AbstractApi
|
||||
/**
|
||||
* @link http://developer.github.com/v3/issues/#list-issues
|
||||
*
|
||||
* @param $organization
|
||||
* @param array $params
|
||||
* @param int $page
|
||||
* @param string $organization
|
||||
* @param array $params
|
||||
* @param int $page
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@@ -87,7 +87,7 @@ class Hooks extends AbstractApi
|
||||
* @param string $organization
|
||||
* @param int $id
|
||||
*
|
||||
* @return null
|
||||
* @return array|string
|
||||
*/
|
||||
public function ping($organization, $id)
|
||||
{
|
||||
@@ -102,7 +102,7 @@ class Hooks extends AbstractApi
|
||||
* @param string $organization
|
||||
* @param int $id
|
||||
*
|
||||
* @return null
|
||||
* @return array|string
|
||||
*/
|
||||
public function remove($organization, $id)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ class PullRequest extends AbstractApi
|
||||
*/
|
||||
public function configure($bodyType = null, $apiVersion = null)
|
||||
{
|
||||
if (!in_array($apiVersion, [])) {
|
||||
if (null === $apiVersion) {
|
||||
$apiVersion = $this->client->getApiVersion();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ class Comments extends AbstractApi
|
||||
* @link https://developer.github.com/v3/pulls/comments/#custom-media-types
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
* @param string|null @apiVersion
|
||||
* @param string|null $apiVersion
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null, $apiVersion = null)
|
||||
{
|
||||
if (!in_array($apiVersion, ['squirrel-girl-preview'])) {
|
||||
if ($apiVersion !== 'squirrel-girl-preview') {
|
||||
$apiVersion = $this->client->getApiVersion();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Api\RateLimit\RateLimitResource;
|
||||
|
||||
/**
|
||||
* Get rate limits.
|
||||
*
|
||||
@@ -12,36 +14,93 @@ namespace Github\Api;
|
||||
class RateLimit extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get rate limits.
|
||||
* @var RateLimitResource[]
|
||||
*/
|
||||
protected $resources = [];
|
||||
|
||||
/**
|
||||
* Get rate limits data in an array.
|
||||
*
|
||||
* @deprecated since 2.11.0 Use `->getResources()` instead
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRateLimits()
|
||||
{
|
||||
return $this->get('/rate_limit');
|
||||
return $this->fetchLimits();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the rate limit resource objects.
|
||||
*
|
||||
* @return RateLimitResource[]
|
||||
*/
|
||||
public function getResources()
|
||||
{
|
||||
$this->fetchLimits();
|
||||
|
||||
return $this->resources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rate limit resource object by the given name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return RateLimitResource|false
|
||||
*/
|
||||
public function getResource($name)
|
||||
{
|
||||
// Fetch once per instance
|
||||
if (empty($this->resources)) {
|
||||
$this->fetchLimits();
|
||||
}
|
||||
|
||||
if (!isset($this->resources[$name])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->resources[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data directly from the GitHub API endpoint.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchLimits()
|
||||
{
|
||||
$result = $this->get('/rate_limit') ?: [];
|
||||
|
||||
// Assemble Limit instances
|
||||
foreach ($result['resources'] as $resourceName => $resource) {
|
||||
$this->resources[$resourceName] = new RateLimitResource($resourceName, $resource);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get core rate limit.
|
||||
*
|
||||
* @deprecated since 2.11.0 Use `->getResource('core')->getLimit()` instead
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCoreLimit()
|
||||
{
|
||||
$response = $this->getRateLimits();
|
||||
|
||||
return $response['resources']['core']['limit'];
|
||||
return $this->getResource('core')->getLimit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get search rate limit.
|
||||
*
|
||||
* @deprecated since 2.11.0 Use `->getResource('core')->getLimit()` instead
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSearchLimit()
|
||||
{
|
||||
$response = $this->getRateLimits();
|
||||
|
||||
return $response['resources']['search']['limit'];
|
||||
return $this->getResource('search')->getLimit();
|
||||
}
|
||||
}
|
||||
|
||||
73
vendor/knplabs/github-api/lib/Github/Api/RateLimit/RateLimitResource.php
vendored
Normal file
73
vendor/knplabs/github-api/lib/Github/Api/RateLimit/RateLimitResource.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\RateLimit;
|
||||
|
||||
/**
|
||||
* Represents the data block for a GitHub rate limit response, grouped by a name.
|
||||
*/
|
||||
class RateLimitResource
|
||||
{
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
/** @var int */
|
||||
private $limit;
|
||||
|
||||
/** @var int */
|
||||
private $reset;
|
||||
|
||||
/** @var int */
|
||||
private $remaining;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct($name, array $data)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->limit = $data['limit'];
|
||||
$this->remaining = $data['remaining'];
|
||||
$this->reset = $data['reset'];
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the Limit, e.g. "core", "graphql", "search".
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The rate limit amount.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLimit()
|
||||
{
|
||||
return $this->limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of requests remaining in time period before hitting the rate limit.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRemaining()
|
||||
{
|
||||
return $this->remaining;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp for when the rate limit will be reset.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getReset()
|
||||
{
|
||||
return $this->reset;
|
||||
}
|
||||
}
|
||||
@@ -187,6 +187,7 @@ class Repo extends AbstractApi
|
||||
* @param bool $hasDownloads `true` to enable downloads for this repository, `false` to disable them
|
||||
* @param int $teamId The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization.
|
||||
* @param bool $autoInit `true` to create an initial commit with empty README, `false` for no initial commit
|
||||
* @param bool $hasProjects `true` to enable projects for this repository or false to disable them.
|
||||
*
|
||||
* @return array returns repository data
|
||||
*/
|
||||
@@ -200,7 +201,8 @@ class Repo extends AbstractApi
|
||||
$hasWiki = false,
|
||||
$hasDownloads = false,
|
||||
$teamId = null,
|
||||
$autoInit = false
|
||||
$autoInit = false,
|
||||
$hasProjects = true
|
||||
) {
|
||||
$path = null !== $organization ? '/orgs/'.$organization.'/repos' : '/user/repos';
|
||||
|
||||
@@ -213,6 +215,7 @@ class Repo extends AbstractApi
|
||||
'has_wiki' => $hasWiki,
|
||||
'has_downloads' => $hasDownloads,
|
||||
'auto_init' => $autoInit,
|
||||
'has_projects' => $hasProjects,
|
||||
];
|
||||
|
||||
if ($organization && $teamId) {
|
||||
|
||||
@@ -14,9 +14,9 @@ class Collaborators extends AbstractApi
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#list-collaborators
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param array $params
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
@@ -28,9 +28,9 @@ class Collaborators extends AbstractApi
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#check-if-a-user-is-a-collaborator
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $collaborator
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $collaborator
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
@@ -42,10 +42,10 @@ class Collaborators extends AbstractApi
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $collaborator
|
||||
* @param array $params
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $collaborator
|
||||
* @param array $params
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
@@ -57,9 +57,9 @@ class Collaborators extends AbstractApi
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#remove-user-as-a-collaborator
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $collaborator
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $collaborator
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
@@ -71,9 +71,9 @@ class Collaborators extends AbstractApi
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $collaborator
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $collaborator
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
|
||||
@@ -143,7 +143,7 @@ class Contents extends AbstractApi
|
||||
'ref' => $reference,
|
||||
]);
|
||||
|
||||
if ($response->getStatusCode() != 200) {
|
||||
if ($response->getStatusCode() !== 200) {
|
||||
return false;
|
||||
}
|
||||
} catch (TwoFactorAuthenticationRequiredException $ex) {
|
||||
@@ -276,8 +276,8 @@ class Contents extends AbstractApi
|
||||
{
|
||||
$file = $this->show($username, $repository, $path, $reference);
|
||||
|
||||
if (!isset($file['type']) || 'file' !== $file['type']) {
|
||||
throw new InvalidArgumentException(sprintf('Path "%s" is not a file.', $path));
|
||||
if (!isset($file['type']) || !in_array($file['type'], ['file', 'symlink'], true)) {
|
||||
throw new InvalidArgumentException(sprintf('Path "%s" is not a file or a symlink to a file.', $path));
|
||||
}
|
||||
|
||||
if (!isset($file['content'])) {
|
||||
|
||||
@@ -16,8 +16,8 @@ class Releases extends AbstractApi
|
||||
/**
|
||||
* Get the latest release.
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -29,9 +29,9 @@ class Releases extends AbstractApi
|
||||
/**
|
||||
* List releases for a tag.
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $tag
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $tag
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user