Completed
Push — develop ( 0e2361...50a387 )
by Abdelrahman
01:29
created

PageFormRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 4 1
A process() 0 6 1
A rules() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Pages\Http\Requests\Tenantarea;
6
7
use Rinvex\Support\Http\Requests\FormRequest;
8
9
class PageFormRequest extends FormRequest
10
{
11
    /**
12
     * Determine if the user is authorized to make this request.
13
     *
14
     * @return bool
15
     */
16
    public function authorize()
17
    {
18
        return true;
19
    }
20
21
    /**
22
     * Process given request data before validation.
23
     *
24
     * @param array $data
25
     *
26
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use array<string,string>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
27
     */
28
    public function process($data)
29
    {
30
        $data['domain'] = $this->getHost();
31
32
        return $data;
33
    }
34
35
    /**
36
     * Get the validation rules that apply to the request.
37
     *
38
     * @return array
39
     */
40
    public function rules()
41
    {
42
        $page = $this->route('page') ?? app('rinvex.pages.page');
43
        $page->updateRulesUniques();
44
45
        return $page->getRules();
46
    }
47
}
48