]> git.mxchange.org Git - friendica.git/commitdiff
Extract App::setContactId() and App::getContactId() into AppHelper
authorArt4 <art4@wlabs.de>
Wed, 6 Nov 2024 12:11:26 +0000 (13:11 +0100)
committerArt4 <art4@wlabs.de>
Wed, 6 Nov 2024 12:11:26 +0000 (13:11 +0100)
src/App.php
src/AppHelper.php

index 25a57984ea9ea6c060e7d7ae9589aabd8fe20b4d..7d495298de7ed2e4da63772a9f49712ff8afe8d7 100644 (file)
@@ -61,9 +61,7 @@ class App
                'videoheight'       => 350,
        ];
 
-       private $timezone      = '';
        private $profile_owner = 0;
-       private $contact_id    = 0;
        private $queue         = [];
 
        /**
@@ -151,22 +149,26 @@ class App
        /**
         * Set the contact ID
         *
+        * @deprecated 2024.12 Use AppHelper::setContactId() instead
+        *
         * @param int $contact_id
         * @return void
         */
        public function setContactId(int $contact_id)
        {
-               $this->contact_id = $contact_id;
+               DI::apphelper()->setContactId($contact_id);
        }
 
        /**
         * Get the contact ID
         *
+        * @deprecated 2024.12 Use AppHelper::getContactId() instead
+        *
         * @return int
         */
        public function getContactId(): int
        {
-               return $this->contact_id;
+               return DI::apphelper()->getContactId();
        }
 
        /**
index e89f94f2e7668c5d41c32467ded1328dd9bab4a8..a9d98a0bdc9260dbbaf8a7eeac232c1a8d661658 100644 (file)
@@ -24,13 +24,14 @@ final class AppHelper
 {
        private $timezone = '';
 
+       private $contact_id = 0;
+
        /**
         * Set the timezone
         *
         * @param string $timezone A valid time zone identifier, see https://www.php.net/manual/en/timezones.php
-        * @return void
         */
-       public function setTimeZone(string $timezone)
+       public function setTimeZone(string $timezone): void
        {
                $this->timezone = (new DateTimeZone($timezone))->getName();
 
@@ -38,12 +39,26 @@ final class AppHelper
        }
 
        /**
-        * Get the timezone
-        *
-        * @return int
+        * Get the timezone name
         */
        public function getTimeZone(): string
        {
                return $this->timezone;
        }
+
+       /**
+        * Set the contact ID
+        */
+       public function setContactId(int $contact_id): void
+       {
+               $this->contact_id = $contact_id;
+       }
+
+       /**
+        * Get the contact ID
+        */
+       public function getContactId(): int
+       {
+               return $this->contact_id;
+       }
 }