FormRequest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 0
f 0
dl 0
loc 43
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
1
<?php
2
3
namespace Sfneal\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest as IlluminateFormRequest;
6
7
// todo: add tests
8
abstract class FormRequest extends IlluminateFormRequest
9
{
10
    /**
11
     * FormRequest constructor.
12
     *
13
     * @param  array  $query  The GET parameters
14
     * @param  array  $request  The POST parameters
15
     * @param  array  $attributes  The request attributes (parameters parsed from the PATH_INFO, ...)
16
     * @param  array  $cookies  The COOKIE parameters
17
     * @param  array  $files  The FILES parameters
18
     * @param  array  $server  The SERVER parameters
19
     * @param  string|resource|null  $content  The raw body data
20
     */
21
    public function __construct(array $query = [],
22
                                array $request = [],
23
                                array $attributes = [],
24
                                array $cookies = [],
25
                                array $files = [],
26
                                array $server = [],
27
                                $content = null)
28
    {
29
        parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content);
30
31
        // Set container
32
        $this->setContainer(app());
33
34
        // Get validator instance
35
        $this->getValidatorInstance();
36
    }
37
38
    /**
39
     * Determine if the user is authorized to make this request.
40
     *
41
     * @return bool
42
     */
43
    abstract public function authorize(): bool;
44
45
    /**
46
     * Get the validation rules that apply to the request.
47
     *
48
     * @return array
49
     */
50
    abstract public function rules(): array;
51
}
52