Passed
Push — master ( 7656d0...dbe1c1 )
by Divine Niiquaye
04:04
created

KernelEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of DivineNii opensource projects.
7
 *
8
 * PHP version 7.4 and above required
9
 *
10
 * @author    Divine Niiquaye Ibok <[email protected]>
11
 * @copyright 2019 DivineNii (https://divinenii.com/)
12
 * @license   https://opensource.org/licenses/BSD-3-Clause License
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 */
17
18
namespace Rade\Event;
19
20
use Psr\Http\Message\ServerRequestInterface as Request;
21
use Rade\Application;
22
use Symfony\Contracts\EventDispatcher\Event;
23
24
/**
25
 * Base class for events thrown in the Application's class.
26
 *
27
 * @author Divine Niiquaye Ibok <[email protected]>
28
 */
29
class KernelEvent extends Event
30
{
31
    private Application $kernel;
32
    private Request $request;
33
34 4
    public function __construct(Application $app, Request $request)
35
    {
36 4
        $this->kernel = $app;
37 4
        $this->request = $request;
38
    }
39
40
    /**
41
     * Returns the kernel in which this event was thrown.
42
     */
43
    public function getApplication(): Application
44
    {
45
        return $this->kernel;
46
    }
47
48
    /**
49
     * Returns the request the kernel is currently processing.
50
     */
51 4
    public function getRequest(): Request
52
    {
53 4
        return $this->request;
54
    }
55
}
56