Passed
Pull Request — master (#4)
by Morten Poul
12:59
created

ValidateWebhook   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
namespace Signifly\Shopify\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Http\Request;
7
use Signifly\Shopify\Webhooks\WebhookValidator;
8
9
class ValidateWebhook
10
{
11
    private WebhookValidator $webhookValidator;
12
13
    public function __construct(WebhookValidator $webhookValidator)
14
    {
15
        $this->webhookValidator = $webhookValidator;
16
    }
17
18
    public function handle(Request $request, Closure $next)
19
    {
20
        $this->webhookValidator->validateFromRequest($request);
21
22
        return $next($request);
23
    }
24
}
25