MemberRegistrationProcessRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A prepareForValidation() 0 8 1
A rules() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Auth\Http\Requests\Frontarea;
6
7
class MemberRegistrationProcessRequest extends MemberRegistrationRequest
8
{
9
    /**
10
     * Prepare the data for validation.
11
     *
12
     * @return void
13
     */
14
    protected function prepareForValidation(): void
15
    {
16
        $data = $this->all();
17
18
        $data['is_active'] = ! config('cortex.auth.registration.moderated');
19
20
        $this->replace($data);
21
    }
22
23
    /**
24
     * Get the validation rules that apply to the request.
25
     *
26
     * @return array
27
     */
28
    public function rules(): array
29
    {
30
        $rules = app('cortex.auth.member')->getRules();
31
        $rules['password'] = 'required|confirmed|min:'.config('cortex.auth.password_min_chars');
32
33
        return $rules;
34
    }
35
}
36