Client - Added a static create() method

This commit is contained in:
Benjamin Blake
2020-02-25 21:38:09 -07:00
parent 0594dce6d0
commit a6f2ee8c8a

View File

@ -56,6 +56,23 @@ class Client {
$this->guzzleClient = new GuzzleClient(['base_uri' => $giteaURL]); $this->guzzleClient = new GuzzleClient(['base_uri' => $giteaURL]);
} }
/**
* Create a Gitea Client
*
* @param string $giteaURL
* @param string $authToken
*
* @return Client
*/
public static function create($giteaURL, $authToken = null)
{
$client = new self($giteaURL);
$client->setAuthToken($authToken);
return $client;
}
public function getGuzzleClient() public function getGuzzleClient()
{ {
return $this->guzzleClient; return $this->guzzleClient;