Completed
Push — master ( dbf695...99cb7b )
by Ashley
01:12
created

Trello   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A verify() 0 10 1
A headers() 0 4 1
1
<?php
2
3
namespace Clarkeash\Shield\Services;
4
5
use Illuminate\Http\Request;
6
7
class Trello extends BaseService
8
{
9
    public function verify(Request $request): bool
10
    {
11
        $secret = config('shield.services.trello.app_secret');
12
13
        $content = trim($request->getContent()) . $request->fullUrl();
14
15
        $signature = hash_hmac('sha1', $content, $secret, true);
16
17
        return base64_encode($signature) === $request->header('X-Trello-Webhook');
18
    }
19
20
    public function headers(): array
21
    {
22
        return ['X-Trello-Webhook'];
23
    }
24
}