forked from joomla/gitea
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
cee2579d4c | |||
6cfaf85b5f |
@ -35,6 +35,14 @@ use VDM\Joomla\Abstraction\Factory as ExtendingFactory;
|
||||
*/
|
||||
abstract class Factory extends ExtendingFactory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* Package Container
|
||||
*
|
||||
* @var Container|null
|
||||
* @since 5.0.3
|
||||
**/
|
||||
protected static ?Container $container = null;
|
||||
|
||||
/**
|
||||
* Create a container object
|
||||
*
|
||||
|
@ -1,3 +1,11 @@
|
||||
/**
|
||||
* Package Container
|
||||
*
|
||||
* @var Container|null
|
||||
* @since 5.0.3
|
||||
**/
|
||||
protected static ?Container $container = null;
|
||||
|
||||
/**
|
||||
* Create a container object
|
||||
*
|
||||
|
@ -13,7 +13,7 @@
|
||||
```uml
|
||||
@startuml
|
||||
class Http << (F,LightGreen) >> #RoyalBlue {
|
||||
+ __construct(?string $token)
|
||||
+ __construct(?string $token = null)
|
||||
+ setToken(string $token) : void
|
||||
+ getToken() : ?string
|
||||
}
|
||||
|
@ -28,10 +28,10 @@ final class Http extends JoomlaHttp
|
||||
/**
|
||||
* The token
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $_token_; // to avoid collisions (but allow swapping)
|
||||
protected ?string $_token_; // to avoid collisions (but allow swapping)
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -41,7 +41,7 @@ final class Http extends JoomlaHttp
|
||||
* @since 3.2.0
|
||||
* @throws \InvalidArgumentException
|
||||
**/
|
||||
public function __construct(?string $token)
|
||||
public function __construct(?string $token = null)
|
||||
{
|
||||
// setup config
|
||||
$config = [
|
||||
@ -52,7 +52,7 @@ final class Http extends JoomlaHttp
|
||||
];
|
||||
|
||||
// add the token if given
|
||||
if (is_string($token))
|
||||
if (is_string($token) && !empty($token))
|
||||
{
|
||||
$config['headers']['Authorization'] = 'token ' . $token;
|
||||
$this->_token_ = $token;
|
||||
@ -79,9 +79,16 @@ final class Http extends JoomlaHttp
|
||||
]
|
||||
);
|
||||
|
||||
// add the token
|
||||
$headers['Authorization'] = 'token ' . $token;
|
||||
$this->_token_ = $token;
|
||||
if (empty($token))
|
||||
{
|
||||
unset($headers['Authorization']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add the token
|
||||
$headers['Authorization'] = 'token ' . $token;
|
||||
$this->_token_ = $token;
|
||||
}
|
||||
|
||||
$this->setOption('headers', $headers);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* The token
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $_token_; // to avoid collisions (but allow swapping)
|
||||
protected ?string $_token_; // to avoid collisions (but allow swapping)
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -14,7 +14,7 @@
|
||||
* @since 3.2.0
|
||||
* @throws \InvalidArgumentException
|
||||
**/
|
||||
public function __construct(?string $token)
|
||||
public function __construct(?string $token = null)
|
||||
{
|
||||
// setup config
|
||||
$config = [
|
||||
@ -25,7 +25,7 @@
|
||||
];
|
||||
|
||||
// add the token if given
|
||||
if (is_string($token))
|
||||
if (is_string($token) && !empty($token))
|
||||
{
|
||||
$config['headers']['Authorization'] = 'token ' . $token;
|
||||
$this->_token_ = $token;
|
||||
@ -52,9 +52,16 @@
|
||||
]
|
||||
);
|
||||
|
||||
// add the token
|
||||
$headers['Authorization'] = 'token ' . $token;
|
||||
$this->_token_ = $token;
|
||||
if (empty($token))
|
||||
{
|
||||
unset($headers['Authorization']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add the token
|
||||
$headers['Authorization'] = 'token ' . $token;
|
||||
$this->_token_ = $token;
|
||||
}
|
||||
|
||||
$this->setOption('headers', $headers);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user