BulkActionRequest::actionName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace UserAdmin\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
7
class BulkActionRequest extends FormRequest
8
{
9 3
    public function rules()
10
    {
11
        return [
12 3
            config('user-adminboard.pagename_key') => [ 'required', 'string', 'max:100' ],
13
            'group'                                => [ 'required', 'string', 'max:100' ],
14
            'name'                                 => [ 'required', 'string', 'max:100' ],
15
            'items'                                => [ 'required', 'array', 'max:300' ],
16
        ];
17
    }
18
19
    /**
20
     * Get the error messages for the defined validation rules.
21
     *
22
     * @return array
23
     */
24 3
    public function messages()
25
    {
26
        return [
27 3
            'items.max' => 'A lot of items selected',
28
        ];
29
    }
30
31 2
    public function group(): string
32
    {
33 2
        return $this->input('group');
34
    }
35
36 1
    public function actionName(): string
37
    {
38 1
        return $this->input('name');
39
    }
40
41 1
    public function actionItems(): array
42
    {
43 1
        return $this->input('items');
44
    }
45
}
46