GitHub::headers()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
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