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

ValidateWebhook::handle()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 23
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 11
c 1
b 0
f 0
nc 5
nop 2
dl 0
loc 23
rs 9.6111

2 Methods

Rating   Name   Duplication   Size   Complexity  
A 0 5 1
A ValidateWebhook::__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