TenantRegistrationRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 43
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 8 2
A withValidator() 0 5 1
A rules() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Auth\Http\Requests\Frontarea;
6
7
use Rinvex\Support\Traits\Escaper;
8
use Illuminate\Foundation\Http\FormRequest;
9
use Cortex\Foundation\Exceptions\GenericException;
10
11
class TenantRegistrationRequest extends FormRequest
12
{
13
    use Escaper;
14
15
    /**
16
     * Determine if the user is authorized to make this request.
17
     *
18
     * @throws \Cortex\Foundation\Exceptions\GenericException
19
     *
20
     * @return bool
21
     */
22
    public function authorize(): bool
23
    {
24
        if (! config('cortex.auth.registration.enabled')) {
25
            throw new GenericException(trans('cortex/auth::messages.register.disabled'));
26
        }
27
28
        return true;
29
    }
30
31
    /**
32
     * Configure the validator instance.
33
     *
34
     * @param \Illuminate\Validation\Validator $validator
35
     *
36
     * @return void
37
     */
38
    public function withValidator($validator): void
0 ignored issues
show
Unused Code introduced by
The parameter $validator is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
        // Sanitize input data before submission
41
        $this->replace(array_merge($this->all(), $this->escape($this->except(['password', 'password_confirmation']))));
42
    }
43
44
    /**
45
     * Get the validation rules that apply to the request.
46
     *
47
     * @return array
48
     */
49
    public function rules(): array
50
    {
51
        return [];
52
    }
53
}
54