Extract Queue getter and setter into AppHelper

This commit is contained in:
Art4 2024-11-08 07:30:36 +00:00
parent f0ce7ea61e
commit 1d5fc6a4bf
2 changed files with 43 additions and 5 deletions

View file

@ -61,8 +61,6 @@ class App
'videoheight' => 350,
];
private $queue = [];
/**
* @var Mode The Mode of the Application
*/
@ -205,33 +203,39 @@ class App
/**
* Set workerqueue information
*
* @deprecated 2024.12 Use AppHelper::setQueue() instead
*
* @param array $queue
* @return void
*/
public function setQueue(array $queue)
{
$this->queue = $queue;
$this->appHelper->setQueue($queue);
}
/**
* Fetch workerqueue information
*
* @deprecated 2024.12 Use AppHelper::getQueue() instead
*
* @return array Worker queue
*/
public function getQueue(): array
{
return $this->queue ?? [];
return $this->appHelper->getQueue();
}
/**
* Fetch a specific workerqueue field
*
* @deprecated 2024.12 Use AppHelper::getQueueValue() instead
*
* @param string $index Work queue record to fetch
* @return mixed Work queue item or NULL if not found
*/
public function getQueueValue(string $index)
{
return $this->queue[$index] ?? null;
return $this->appHelper->getQueueValue($index);
}
public function setThemeInfoValue(string $index, $value)

View file

@ -28,6 +28,8 @@ final class AppHelper
private $contact_id = 0;
private $queue = [];
/**
* Set the profile owner ID
*/
@ -79,4 +81,36 @@ final class AppHelper
{
return $this->contact_id;
}
/**
* Set workerqueue information
*
* @param array<string,mixed> $queue
*/
public function setQueue(array $queue): void
{
$this->queue = $queue;
}
/**
* Fetch workerqueue information
*
* @return array<string,mixed> Worker queue
*/
public function getQueue(): array
{
return $this->queue;
}
/**
* Fetch a specific workerqueue field
*
* @param string $index Work queue record to fetch
*
* @return mixed|null Work queue item or NULL if not found
*/
public function getQueueValue(string $index)
{
return $this->queue[$index] ?? null;
}
}