Stable release of v4.0.0-alpha1
First alpha release of Component Builder towards Joomla 4 (very unstable...).
This commit is contained in:
@@ -52,7 +52,7 @@ final class Http extends JoomlaHttp
|
||||
// add the token if given
|
||||
if (is_string($token))
|
||||
{
|
||||
$config['headers']['Authorization'] = 'token ' . $token;
|
||||
$config['headers']['Authorization'] = $token;
|
||||
$this->_token_ = $token;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ final class Http extends JoomlaHttp
|
||||
);
|
||||
|
||||
// add the token
|
||||
$headers['Authorization'] = 'token ' . $token;
|
||||
$headers['Authorization'] = $token;
|
||||
$this->_token_ = $token;
|
||||
|
||||
$this->setOption('headers', $headers);
|
||||
|
@@ -12,7 +12,7 @@
|
||||
namespace VDM\Joomla\Gitea\Utilities;
|
||||
|
||||
|
||||
use Joomla\CMS\Http\Response as JoomlaResponse;
|
||||
use Joomla\Http\Response as JoomlaResponse;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
@@ -36,7 +36,7 @@ final class Response
|
||||
* @since 3.2.0
|
||||
* @throws \DomainException
|
||||
**/
|
||||
public function get(JoomlaResponse $response, int $expectedCode = 200, $default = null)
|
||||
public function get($response, int $expectedCode = 200, $default = null)
|
||||
{
|
||||
// Validate the response code.
|
||||
if ($response->code != $expectedCode)
|
||||
@@ -62,7 +62,7 @@ final class Response
|
||||
* @since 3.2.0
|
||||
* @throws \DomainException
|
||||
**/
|
||||
public function get_(JoomlaResponse $response, array $validate = [200 => null])
|
||||
public function get_($response, array $validate = [200 => null])
|
||||
{
|
||||
// Validate the response code.
|
||||
if (!isset($validate[$response->code]))
|
||||
@@ -86,24 +86,23 @@ final class Response
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected function body(JoomlaResponse $response, $default = null)
|
||||
protected function body($response, $default = null)
|
||||
{
|
||||
// check that we have a body and that its JSON
|
||||
if (isset($response->body) && StringHelper::check($response->body))
|
||||
$body = $response->body ?? null;
|
||||
// check that we have a body
|
||||
if (StringHelper::check($body))
|
||||
{
|
||||
if (JsonHelper::check($response->body))
|
||||
if (JsonHelper::check($body))
|
||||
{
|
||||
$body = json_decode((string) $response->body);
|
||||
$body = json_decode((string) $body);
|
||||
|
||||
if (isset($body->content_base64))
|
||||
{
|
||||
$body->content = base64_decode((string) $body->content_base64);
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
return $response->body;
|
||||
return $body;
|
||||
}
|
||||
|
||||
return $default;
|
||||
@@ -117,7 +116,7 @@ final class Response
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected function error(JoomlaResponse $response): string
|
||||
protected function error($response): string
|
||||
{
|
||||
// do we have a json string
|
||||
if (isset($response->body) && JsonHelper::check($response->body))
|
||||
@@ -140,7 +139,6 @@ final class Response
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user