]> git.mxchange.org Git - friendica.git/commitdiff
Refactor App, add AppHelper in constructor
authorArt4 <art4@wlabs.de>
Wed, 6 Nov 2024 12:26:33 +0000 (12:26 +0000)
committerArt4 <art4@wlabs.de>
Wed, 6 Nov 2024 12:26:33 +0000 (12:26 +0000)
src/App.php

index 66a7fb0309f79f830e603d0a032bcf85b78afc97..addda3fe59f539977d35c767fc3e1a264a1ac723 100644 (file)
@@ -125,6 +125,11 @@ class App
         */
        private $session;
 
+       /**
+        * @var AppHelper $appHelper
+        */
+       private $appHelper;
+
        /**
         * Set the profile owner ID
         *
@@ -156,7 +161,7 @@ class App
         */
        public function setContactId(int $contact_id)
        {
-               DI::apphelper()->setContactId($contact_id);
+               $this->appHelper->setContactId($contact_id);
        }
 
        /**
@@ -168,7 +173,7 @@ class App
         */
        public function getContactId(): int
        {
-               return DI::apphelper()->getContactId();
+               return $this->appHelper->getContactId();
        }
 
        /**
@@ -181,7 +186,7 @@ class App
         */
        public function setTimeZone(string $timezone)
        {
-               DI::apphelper()->setTimeZone($timezone);
+               $this->appHelper->setTimeZone($timezone);
        }
 
        /**
@@ -191,7 +196,7 @@ class App
         */
        public function getTimeZone(): string
        {
-               return DI::apphelper()->getTimeZone();
+               return $this->appHelper->getTimeZone();
        }
 
        /**
@@ -303,6 +308,7 @@ class App
                $this->args           = $args;
                $this->pConfig        = $pConfig;
                $this->session        = $session;
+               $this->appHelper      = DI::apphelper();
 
                $this->load($dbaDefinition, $viewDefinition);
        }
@@ -367,7 +373,7 @@ class App
                        $timezone = $default_timezone ?? '' ?: 'UTC';
                }
 
-               DI::apphelper()->setTimeZone($timezone);
+               $this->appHelper->setTimeZone($timezone);
        }
 
        /**