File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 66use Suin \RSSWriter \Feed as RSSFeed ;
77use Suin \RSSWriter \Channel as RSSChannel ;
88use Suin \RSSWriter \Item as RSSItem ;
9+ use Symfony \Component \HttpFoundation \Request as HttpRequest ;
910use Symfony \Component \HttpFoundation \Response as HttpResponse ;
1011
1112class RssController
1213{
14+ private readonly HttpRequest $ request ;
15+
16+ public function __construct ()
17+ {
18+ $ this ->request = HttpRequest::createFromGlobals ();
19+ }
20+
1321 public function run (): void
1422 {
1523 $ featuresXmlFilepath = Mesamatrix::path (Mesamatrix::$ config ->getValue ("info " , "xml_file " ));
@@ -43,7 +51,7 @@ public function run(): void
4351 ['Content-Type ' => 'text/xml ' ]
4452 );
4553
46- $ response ->prepare (Mesamatrix:: $ request );
54+ $ response ->prepare ($ this -> request );
4755 $ response ->send ();
4856 }
4957
@@ -79,8 +87,8 @@ private function generateRss(string $featuresXmlFilepath): ?string
7987 // prepare RSS
8088 $ rss = new RSSFeed ();
8189
82- $ baseUrl = Mesamatrix:: $ request ->getSchemeAndHttpHost ()
83- . Mesamatrix:: $ request ->getBasePath ();
90+ $ baseUrl = $ this -> request ->getSchemeAndHttpHost ()
91+ . $ this -> request ->getBasePath ();
8492
8593 $ channel = new RSSChannel ();
8694 $ channel
Original file line number Diff line number Diff line change 2626use Monolog \ErrorHandler ;
2727use Monolog \Handler \ErrorLogHandler ;
2828use Monolog \Handler \StreamHandler ;
29- use Symfony \Component \HttpFoundation \Request as HttpRequest ;
3029
3130class Mesamatrix
3231{
3332 public static string $ serverRoot ; // Path to root of installation
3433 public static string $ configDir ; // Path to configuration directory
3534 public static Config $ config ;
3635 public static Logger $ logger ;
37- public static HttpRequest $ request ;
3836
3937 public static function init ()
4038 {
@@ -82,9 +80,6 @@ public static function init()
8280 exit (1 );
8381 }
8482
85- // Initialize request
86- self ::$ request = HttpRequest::createFromGlobals ();
87-
8883 self ::$ logger ->debug ('Base initialization complete ' );
8984
9085 self ::$ logger ->debug ('Log level: ' . Logger::toMonologLevel ($ logLevel )->getName ());
You can’t perform that action at this time.
0 commit comments