Delegate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 3 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
}