Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace NunoMaduro\Collision;
6
 
7
use NunoMaduro\Collision\Contracts\Handler as HandlerContract;
8
use NunoMaduro\Collision\Contracts\Writer as WriterContract;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Whoops\Handler\Handler as AbstractHandler;
11
 
12
/**
13
 * @internal
14
 *
15
 * @see \Tests\Unit\HandlerTest
16
 */
17
final class Handler extends AbstractHandler implements HandlerContract
18
{
19
    /**
20
     * Holds an instance of the writer.
21
     *
22
     * @var \NunoMaduro\Collision\Contracts\Writer
23
     */
24
    protected $writer;
25
 
26
    /**
27
     * Creates an instance of the Handler.
28
     */
29
    public function __construct(WriterContract $writer = null)
30
    {
31
        $this->writer = $writer ?: new Writer();
32
    }
33
 
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function handle()
38
    {
39
        $this->writer->write($this->getInspector());
40
 
41
        return static::QUIT;
42
    }
43
 
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function setOutput(OutputInterface $output): HandlerContract
48
    {
49
        $this->writer->setOutput($output);
50
 
51
        return $this;
52
    }
53
 
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function getWriter(): WriterContract
58
    {
59
        return $this->writer;
60
    }
61
}