WebhookRequest::authorize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Fenerum\Webhooks\Http\Requests;
6
7
use Illuminate\Foundation\Http\FormRequest;
8
9
class WebhookRequest extends FormRequest
10
{
11
    /**
12
     * Determine if the user is authorized to make this request.
13
     *
14
     * @return bool
15
     */
16
    public function authorize(): bool
17
    {
18
        return config('fenerum.webhook_auth_username') === $this->getUser() &&
19
               config('fenerum.webhook_auth_password') === $this->getPassword();
20
    }
21
22
    /**
23
     * Get the validation rules that apply to the request.
24
     *
25
     * @return array
26
     */
27
    public function rules(): array
28
    {
29
        return [
30
            'event' => ['required', 'string'],
31
            'data' => ['required', 'array'],
32
        ];
33
    }
34
}
35