Passed
Push — master ( 2d2309...cbe71d )
by Nikita
26:59 queued 05:24
created

ServerVarsRequest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 6
eloc 8
c 2
b 1
f 0
dl 0
loc 24
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A vars() 0 3 1
A updateBeforeStart() 0 3 2
A autostart() 0 3 2
A rules() 0 6 1
1
<?php
2
3
namespace Gameap\Http\Requests;
4
5
class ServerVarsRequest extends Request
6
{
7
    public function rules()
8
    {
9
        return [
10
            'vars'                => 'required|array',
11
            'autostart'           => 'nullable|boolean',
12
            'update_before_start' => 'nullable|boolean',
13
        ];
14
    }
15
16
    public function vars(): array
17
    {
18
        return $this->get('vars');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('vars') could return the type null which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
19
    }
20
21
    public function autostart(): bool
22
    {
23
        return $this->get('autostart') !== null && $this->get('autostart');
24
    }
25
26
    public function updateBeforeStart(): bool
27
    {
28
        return $this->get('update_before_start') !== null && $this->get('update_before_start');
29
    }
30
}
31