Properties

$data

$data : \stdClass

Type

\stdClass — The repository's data.

Methods

request()

request(\duncan3dc\GitHub\string  $method, \duncan3dc\GitHub\string  $url, array  $data = array()) 

Parameters

\duncan3dc\GitHub\string $method
\duncan3dc\GitHub\string $url
array $data

post()

post(string  $url, array  $data = array()) : \stdClass

Send a POST request and return the response.

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

Returns

\stdClass

put()

put(string  $url, array  $data = array()) : \stdClass

Send a PUT request and return the response.

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

Returns

\stdClass

delete()

delete(string  $url, array  $data = array()) : \stdClass

Send a DELETE request and return the response.

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

Returns

\stdClass

get()

get(string  $url, array  $data = array()) : \stdClass

Send a GET request and return the response.

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

Returns

\stdClass

getAll()

getAll(string  $url, array  $data = array(), callable  $callback = null) : \Traversable|array<mixed,\stdClass>

Send a GET request and return the response.

This method will loop through all the pages until one returns no results

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

callable $callback

An optional handler to yield items via

Returns

\Traversable|array<mixed,\stdClass>

fromName()

fromName(string  $owner, string  $name, \duncan3dc\GitHub\ApiInterface  $api) : \duncan3dc\GitHub\RepositoryInterface

Create a new instance.

Parameters

string $owner

The owner of this repository (organization or user)

string $name

The name of the repository this instance represents

\duncan3dc\GitHub\ApiInterface $api

The instance to communicate with GitHub

Returns

\duncan3dc\GitHub\RepositoryInterface

fromApiResponse()

fromApiResponse(\stdClass  $data, \duncan3dc\GitHub\ApiInterface  $api) : \duncan3dc\GitHub\RepositoryInterface

Create a new instance.

Parameters

\stdClass $data

The repository's data from the GitHub Api

\duncan3dc\GitHub\ApiInterface $api

The instance to communicate with GitHub

Returns

\duncan3dc\GitHub\RepositoryInterface

getName()

getName() : string

Get the name of this repository.

Returns

string

getFullName()

getFullName() : string

Get the full name of this repository (including the owner).

Returns

string

getDescription()

getDescription() : string

Get the description of this repository.

Returns

string

isPrivate()

isPrivate() : boolean

Check if this repository is private.

Returns

boolean

isPublic()

isPublic() : boolean

Check if this repository is public.

Returns

boolean

isFork()

isFork() : boolean

Check if this repository is a fork of another.

Returns

boolean

getBranches()

getBranches() : \duncan3dc\GitHub\iterable|array<mixed,\duncan3dc\GitHub\BranchInterface>

Get all the branches in this repository.

Returns

\duncan3dc\GitHub\iterable|array<mixed,\duncan3dc\GitHub\BranchInterface>

getBranch()

getBranch(\duncan3dc\GitHub\string  $branch) : \duncan3dc\GitHub\BranchInterface

Get a branch from this repository.

Parameters

\duncan3dc\GitHub\string $branch

The name of the branch

Returns

\duncan3dc\GitHub\BranchInterface

getPullRequest()

getPullRequest(\duncan3dc\GitHub\int  $number) : \duncan3dc\GitHub\PullRequestInterface

Get a pull request from this repository.

Parameters

\duncan3dc\GitHub\int $number

The unique ID of the pr

Returns

\duncan3dc\GitHub\PullRequestInterface

getTags()

getTags() : \duncan3dc\GitHub\iterable|array<mixed,\duncan3dc\GitHub\TagInterface>

Get all the tags in this repository.

Returns

\duncan3dc\GitHub\iterable|array<mixed,\duncan3dc\GitHub\TagInterface>

response()

response(\Psr\Http\Message\ResponseInterface  $response) : \stdClass

Convert a response into a simple object.

Parameters

\Psr\Http\Message\ResponseInterface $response

The response to convert

Returns

\stdClass

__construct()

__construct(\stdClass  $data, \duncan3dc\GitHub\ApiInterface  $api) 

Create a new instance.

Parameters

\stdClass $data

The repository's data from the GitHub Api

\duncan3dc\GitHub\ApiInterface $api

The instance to communicate with GitHub

getUrl()

getUrl(string  $path) : string

Generate a url using this repository as the base.

Parameters

string $path

The path underneath this repository to hit

Returns

string