Delegate::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
namespace PortlandLabs\Slackbot\Slack\Rtm\Event\Handler;
3
4
use PortlandLabs\Slackbot\Slack\Rtm\Event;
5
use PortlandLabs\Slackbot\Slack\Rtm\Event\Handler;
6
use PortlandLabs\Slackbot\Slack\Rtm\Event\Middleware;
7
8
class Delegate implements Handler
9
{
10
11
    /** @var Middleware */
12
    protected $nextMiddleware;
13
14
    /** @var Handler */
15
    protected $nextHandler;
16
17
    public function __construct(Middleware $nextMiddleware, Handler $nextHandler)
18
    {
19
        $this->nextMiddleware = $nextMiddleware;
20
        $this->nextHandler = $nextHandler;
21
    }
22
23
    /**
24
     * Handle an incoming event
25
     *
26
     * @param Event $event
27
     * @return Event
28
     */
29
    public function handle(Event $event): Event
30
    {
31
        return $this->nextMiddleware->process($event, $this->nextHandler);
32
    }
33
}