-
-
Notifications
You must be signed in to change notification settings - Fork 829
/
Installer.php
62 lines (54 loc) · 1.69 KB
/
Installer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Install;
use Flarum\Foundation\AppInterface;
use Flarum\Foundation\ErrorHandling\Registry;
use Flarum\Foundation\ErrorHandling\Reporter;
use Flarum\Foundation\ErrorHandling\WhoopsFormatter;
use Flarum\Http\Middleware as HttpMiddleware;
use Flarum\Install\Console\InstallCommand;
use Illuminate\Contracts\Container\Container;
use Laminas\Stratigility\MiddlewarePipe;
use Psr\Http\Server\RequestHandlerInterface;
class Installer implements AppInterface
{
public function __construct(
protected Container $container
) {
}
public function getContainer(): Container
{
return $this->container;
}
public function getRequestHandler(): RequestHandlerInterface
{
$pipe = new MiddlewarePipe;
$pipe->pipe(new HttpMiddleware\HandleErrors(
$this->container->make(Registry::class),
$this->container->make(WhoopsFormatter::class),
$this->container->tagged(Reporter::class)
));
$pipe->pipe($this->container->make(HttpMiddleware\StartSession::class));
$pipe->pipe(
new HttpMiddleware\ResolveRoute($this->container->make('flarum.install.routes'))
);
$pipe->pipe(new HttpMiddleware\ExecuteRoute());
return $pipe;
}
/**
* @return \Symfony\Component\Console\Command\Command[]
*/
public function getConsoleCommands(): array
{
return [
new InstallCommand(
$this->container->make(Installation::class)
),
];
}
}