Total Complexity | 4 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class CreateRequest extends FormRequest |
||
10 | { |
||
11 | /** |
||
12 | * Determine if the user is authorized to make this request. |
||
13 | * |
||
14 | * @return bool |
||
15 | */ |
||
16 | public function authorize() |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Get the validation rules that apply to the request. |
||
25 | * |
||
26 | * @return array |
||
27 | */ |
||
28 | public function rules() |
||
29 | { |
||
30 | return [ |
||
31 | 'name' => 'required|string', |
||
32 | 'description' => 'required|string', |
||
33 | 'location' => 'array', |
||
34 | 'start' => 'required|date_format:Y-m-d H:i', |
||
35 | 'end' => 'required|date_format:Y-m-d H:i', |
||
36 | 'published' => 'required|boolean', |
||
37 | 'url' => 'url', |
||
38 | 'video_url' => 'url', |
||
39 | 'banner' => 'base64image', |
||
40 | ]; |
||
41 | } |
||
42 | |||
43 | protected function failedAuthorization() |
||
47 | } |
||
48 | } |
||
50 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.