GitHub   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A verify() 0 6 1
A headers() 0 4 1
1
<?php
2
3
namespace Clarkeash\Shield\Services;
4
5
use Illuminate\Http\Request;
6
7
class GitHub extends BaseService
8
{
9
    public function verify(Request $request): bool
10
    {
11
        $generated = 'sha1=' . hash_hmac('sha1', $request->getContent(), config('shield.services.github.token'));
12
13
        return hash_equals($generated, $this->header($request, 'X-Hub-Signature'));
14
    }
15
16
    public function headers(): array
17
    {
18
        return ['X-Hub-Signature'];
19
    }
20
}
21