1
0
mirror of https://github.com/flarum/core.git synced 2025-08-02 14:37:49 +02:00

Use anonymous class for FakeApp (#2725)

It's a better implementation than declaring a second class in the same file, which can confuse IDEs. Furthermore, FakeApp shouldn't be used outside this file.
This commit is contained in:
Alexander Skvortsov
2021-03-22 14:00:36 -04:00
committed by GitHub
parent 397c4c10ed
commit aabf88e6d6

View File

@@ -17,24 +17,21 @@ class Schedule extends LaravelSchedule
{ {
public function dueEvents($container) public function dueEvents($container)
{ {
return (new Collection($this->events))->filter->isDue(new FakeApp($container)); return (new Collection($this->events))->filter->isDue(new class($container) {
} public function __construct($container)
} {
$this->config = $container->make(Config::class);
class FakeApp }
{
public function __construct($container) public function isDownForMaintenance()
{ {
$this->config = $container->make(Config::class); return $this->config->inMaintenanceMode();
} }
public function isDownForMaintenance() public function environment()
{ {
return $this->config->inMaintenanceMode(); return '';
} }
});
public function environment()
{
return '';
} }
} }