ResponseEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 3
crap 1
1
<?php
2
namespace Fwk\Core\Events;
3
4
use Fwk\Core\Application;
5
use Fwk\Core\Context;
6
use Fwk\Core\CoreEvent;
7
use Fwk\Core\AppEvents;
8
use Symfony\Component\HttpFoundation\Response;
9
10
/**
11
 */
12
class ResponseEvent extends CoreEvent
13
{
14
    protected $response;
15
    
16
    /**
17
     * Constructor
18
     * 
19
     * @param Response    $response
20
     * @param Application $app
21
     * @param Context     $context 
0 ignored issues
show
Documentation introduced by
Should the type for parameter $context not be null|Context?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
22
     * 
23
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
24
     */
25 18
    public function __construct(Response $response, Application $app, 
26
        Context $context = null
27
    ) {
28 18
        parent::__construct(
29 18
            AppEvents::RESPONSE, 
30 18
            array('response'  =>  $response), 
31 18
            $app, 
32
            $context
33 18
        );
34 18
    }
35
    
36
    public function getResponse()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
37
    {
38
        return $this->response;
39
    }
40
}