WebhookController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 3 1
1
<?php
2
3
namespace Slides\Connector\Auth\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use Slides\Connector\Auth\Webhooks\Dispatcher;
7
8
/**
9
 * Class WebhookController
10
 *
11
 * @package Slides\Connector\Auth\Http\Controllers
12
 */
13
class WebhookController extends \Illuminate\Routing\Controller
14
{
15
    /**
16
     * The webhook dispatcher.
17
     *
18
     * @var Dispatcher
19
     */
20
    protected $dispatcher;
21
22
    /**
23
     * WebhookController constructor.
24
     *
25
     * @param Dispatcher $dispatcher
26
     */
27
    public function __construct(Dispatcher $dispatcher)
28
    {
29
        $this->dispatcher = $dispatcher;
30
    }
31
32
    /**
33
     * Handle the incoming webhook.
34
     *
35
     * @param string $key
36
     * @param Request $request
37
     *
38
     * @return array|null
39
     *
40
     * @throws \Slides\Connector\Auth\Exceptions\WebhookValidationException
41
     */
42
    public function __invoke(string $key, Request $request)
43
    {
44
        return $this->dispatcher->handle($key, $request->all());
45
    }
46
}