Update #1

Merged
Llewellyn merged 4 commits from dev into master 2023-08-01 07:43:29 +00:00
7 changed files with 39 additions and 18 deletions

View File

@ -831,6 +831,5 @@ class Repository implements ServiceProviderInterface
$container->get('Gitea.Utilities.Response')
);
}
}

View File

@ -134,6 +134,10 @@ final class Response
{
return $error->error;
}
elseif (isset($error->message))
{
return $error->message;
}
return '';
}

View File

@ -108,6 +108,10 @@
{
return $error->error;
}
elseif (isset($error->message))
{
return $error->message;
}
return '';
}

View File

@ -15,7 +15,7 @@ abstract Api #Orange {
# Uri $uri
# Response $response
+ __construct(Http $http, Uri $uri, ...)
+ load_(string $url, string $token) : void
+ load_(?string $url = null, ?string $token = null) : void
}
note right of Api::__construct

View File

@ -67,17 +67,24 @@ abstract class Api
/**
* Load/Reload API.
*
* @param string $url The url.
* @param token $token The token.
* @param string|null $url The url.
* @param token|null $token The token.
*
* @return void
* @since 3.2.0
**/
public function load_(string $url, string $token)
public function load_(?string $url = null, ?string $token = null)
{
if ($url !== null)
{
$this->uri->setUrl($url);
}
if ($token !== null)
{
$this->http->setToken($token);
}
}
}

View File

@ -41,14 +41,21 @@
/**
* Load/Reload API.
*
* @param string $url The url.
* @param token $token The token.
* @param string|null $url The url.
* @param token|null $token The token.
*
* @return void
* @since 3.2.0
**/
public function load_(string $url, string $token)
public function load_(?string $url = null, ?string $token = null)
{
if ($url !== null)
{
$this->uri->setUrl($url);
}
if ($token !== null)
{
$this->http->setToken($token);
}
}