1
0
mirror of https://github.com/flarum/core.git synced 2025-06-21 18:26:01 +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 3cc18c1da2
commit 706eaeda41

View File

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