Refactor App, add AppHelper in constructor

pull/14542/head
Art4 2024-11-06 12:26:33 +00:00
rodzic 00d2e24dd2
commit b5317f8e46
1 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -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);
}
/**