]> git.mxchange.org Git - friendica.git/commitdiff
Extract Queue getter and setter into AppHelper
authorArt4 <art4@wlabs.de>
Fri, 8 Nov 2024 07:30:36 +0000 (07:30 +0000)
committerArt4 <art4@wlabs.de>
Fri, 8 Nov 2024 07:30:36 +0000 (07:30 +0000)
src/App.php
src/AppHelper.php

index 0fb65d532a0b88e3fa6cb9d940648e6134d4f277..cc276b6a9bc27063513993a35b69b3c7990a995f 100644 (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)
index 45a71dc6b21f65dcb5dc62c540c96e6e74d4ae98..eb9a1aa07cda5ea411981186ee7a4f472d041b09 100644 (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;
+       }
 }