SendResponseEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Webino™ (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino for the canonical source repository
6
 * @copyright   Copyright (c) 2015-2017 Webino, s.r.o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoAppLib\Event;
12
13
use WebinoEventLib\EventInterface;
14
use Zend\Mvc\ResponseSender\SendResponseEvent as BaseSendResponseEvent;
15
16
/**
17
 * Class SendResponseEvent
18
 */
19
class SendResponseEvent extends BaseSendResponseEvent implements
20
    EventInterface,
21
    DispatchEventInterface
22
{
23
    use AppEventTrait;
24
25
    /**
26
     * @param DispatchEvent $event
27
     */
28
    public function __construct(DispatchEvent $event)
29
    {
30
        parent::__construct(self::class, $event->getApp(), $event->getParams());
31
        $this->setResponse($event->getResponse());
0 ignored issues
show
Bug introduced by
It seems like $event->getResponse() targeting WebinoAppLib\Event\DispatchEvent::getResponse() can also be of type object<Zend\Http\AbstractMessage>; however, Zend\Mvc\ResponseSender\...nseEvent::setResponse() does only seem to accept object<Zend\Stdlib\ResponseInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
32
    }
33
}
34