mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-15 03:13:52 +09:00
Update dependencies
This commit is contained in:
@@ -62,21 +62,21 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
*/
|
||||
protected $bags = [];
|
||||
|
||||
public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
|
||||
public function __construct(string $name = 'MOCKSESSID', ?MetadataBag $metaBag = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->setMetadataBag($metaBag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setSessionData(array $array)
|
||||
{
|
||||
$this->data = $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function start()
|
||||
public function start(): bool
|
||||
{
|
||||
if ($this->started) {
|
||||
return true;
|
||||
@@ -91,10 +91,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function regenerate(bool $destroy = false, int $lifetime = null)
|
||||
public function regenerate(bool $destroy = false, ?int $lifetime = null): bool
|
||||
{
|
||||
if (!$this->started) {
|
||||
$this->start();
|
||||
@@ -106,16 +103,13 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function setId(string $id)
|
||||
{
|
||||
@@ -126,16 +120,13 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function setName(string $name)
|
||||
{
|
||||
@@ -143,7 +134,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
@@ -156,7 +147,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
@@ -173,17 +164,14 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function registerBag(SessionBagInterface $bag)
|
||||
{
|
||||
$this->bags[$bag->getName()] = $bag;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBag(string $name)
|
||||
public function getBag(string $name): SessionBagInterface
|
||||
{
|
||||
if (!isset($this->bags[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('The SessionBagInterface "%s" is not registered.', $name));
|
||||
@@ -196,29 +184,26 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
return $this->bags[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isStarted()
|
||||
public function isStarted(): bool
|
||||
{
|
||||
return $this->started;
|
||||
}
|
||||
|
||||
public function setMetadataBag(MetadataBag $bag = null)
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadataBag(?MetadataBag $bag = null)
|
||||
{
|
||||
if (null === $bag) {
|
||||
$bag = new MetadataBag();
|
||||
if (1 > \func_num_args()) {
|
||||
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
|
||||
}
|
||||
|
||||
$this->metadataBag = $bag;
|
||||
$this->metadataBag = $bag ?? new MetadataBag();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the MetadataBag.
|
||||
*
|
||||
* @return MetadataBag
|
||||
*/
|
||||
public function getMetadataBag()
|
||||
public function getMetadataBag(): MetadataBag
|
||||
{
|
||||
return $this->metadataBag;
|
||||
}
|
||||
@@ -228,21 +213,22 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
*
|
||||
* This doesn't need to be particularly cryptographically secure since this is just
|
||||
* a mock.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generateId()
|
||||
protected function generateId(): string
|
||||
{
|
||||
return hash('sha256', uniqid('ss_mock_', true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function loadSession()
|
||||
{
|
||||
$bags = array_merge($this->bags, [$this->metadataBag]);
|
||||
|
||||
foreach ($bags as $bag) {
|
||||
$key = $bag->getStorageKey();
|
||||
$this->data[$key] = $this->data[$key] ?? [];
|
||||
$this->data[$key] ??= [];
|
||||
$bag->initialize($this->data[$key]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user