Update #1
@ -830,7 +830,6 @@ class Repository implements ServiceProviderInterface
|
||||
$container->get('Gitea.Dynamic.Uri'),
|
||||
$container->get('Gitea.Utilities.Response')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -767,4 +767,4 @@
|
||||
$container->get('Gitea.Dynamic.Uri'),
|
||||
$container->get('Gitea.Utilities.Response')
|
||||
);
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ final class Response
|
||||
// Decode the error response and throw an exception.
|
||||
$message = $this->error($response);
|
||||
|
||||
throw new \DomainException("Invalid response received from API.$message", $response->code);
|
||||
throw new \DomainException("Invalid response received from API. $message", $response->code);
|
||||
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ final class Response
|
||||
// Decode the error response and throw an exception.
|
||||
$message = $this->error($response);
|
||||
|
||||
throw new \DomainException("Invalid response received from API.$message", $response->code);
|
||||
throw new \DomainException("Invalid response received from API. $message", $response->code);
|
||||
|
||||
}
|
||||
|
||||
@ -134,6 +134,10 @@ final class Response
|
||||
{
|
||||
return $error->error;
|
||||
}
|
||||
elseif (isset($error->message))
|
||||
{
|
||||
return $error->message;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
// Decode the error response and throw an exception.
|
||||
$message = $this->error($response);
|
||||
|
||||
throw new \DomainException("Invalid response received from API.$message", $response->code);
|
||||
throw new \DomainException("Invalid response received from API. $message", $response->code);
|
||||
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
// Decode the error response and throw an exception.
|
||||
$message = $this->error($response);
|
||||
|
||||
throw new \DomainException("Invalid response received from API.$message", $response->code);
|
||||
throw new \DomainException("Invalid response received from API. $message", $response->code);
|
||||
|
||||
}
|
||||
|
||||
@ -108,6 +108,10 @@
|
||||
{
|
||||
return $error->error;
|
||||
}
|
||||
elseif (isset($error->message))
|
||||
{
|
||||
return $error->message;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -67,16 +67,23 @@ 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)
|
||||
{
|
||||
$this->uri->setUrl($url);
|
||||
$this->http->setToken($token);
|
||||
if ($url !== null)
|
||||
{
|
||||
$this->uri->setUrl($url);
|
||||
}
|
||||
|
||||
if ($token !== null)
|
||||
{
|
||||
$this->http->setToken($token);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
$this->uri->setUrl($url);
|
||||
$this->http->setToken($token);
|
||||
if ($url !== null)
|
||||
{
|
||||
$this->uri->setUrl($url);
|
||||
}
|
||||
|
||||
if ($token !== null)
|
||||
{
|
||||
$this->http->setToken($token);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user