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\Provider as ProviderContract;
9
use Whoops\Run;
10
use Whoops\RunInterface;
11
 
12
/**
13
 * @internal
14
 *
15
 * @see \Tests\Unit\ProviderTest
16
 */
17
final class Provider implements ProviderContract
18
{
19
    /**
20
     * Holds an instance of the Run.
21
     *
22
     * @var \Whoops\RunInterface
23
     */
24
    protected $run;
25
 
26
    /**
27
     * Holds an instance of the handler.
28
     *
29
     * @var \NunoMaduro\Collision\Contracts\Handler
30
     */
31
    protected $handler;
32
 
33
    /**
34
     * Creates a new instance of the Provider.
35
     */
36
    public function __construct(RunInterface $run = null, HandlerContract $handler = null)
37
    {
38
        $this->run = $run ?: new Run();
39
        $this->handler = $handler ?: new Handler();
40
    }
41
 
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function register(): ProviderContract
46
    {
47
        $this->run->pushHandler($this->handler)
48
            ->register();
49
 
50
        return $this;
51
    }
52
 
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getHandler(): HandlerContract
57
    {
58
        return $this->handler;
59
    }
60
}