ApisGeneratorRequest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
eloc 11
c 3
b 0
f 1
dl 0
loc 35
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 11 1
A authorize() 0 4 1
A getReservedNames() 0 3 1
1
<?php
2
3
4
namespace KMLaravel\ApiGenerator\Requests;
5
6
7
use Illuminate\Console\GeneratorCommand;
0 ignored issues
show
Bug introduced by
The type Illuminate\Console\GeneratorCommand was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Illuminate\Foundation\Http\FormRequest;
9
use Illuminate\Validation\Rule;
0 ignored issues
show
Bug introduced by
The type Illuminate\Validation\Rule was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use KMLaravel\ApiGenerator\Facade\KMGeneratorCommandFacade;
11
12
class ApisGeneratorRequest extends FormRequest
13
{
14
15
    /**
16
     * Determine if the user is authorized to make this request.
17
     *
18
     * @return bool
19
     */
20
    public
21
    function authorize()
22
    {
23
        return config('apis_generator.request_auth');
24
    }
25
26
    /**
27
     * Get the validation rules that apply to the request.
28
     *
29
     * @return array
30
     */
31
    public
32
    function rules()
33
34
    {
35
36
        return [
37
            "title" => "required|string|".Rule::notIn($this->getReservedNames()),
38
            "basic_options" => "required",
39
            "advanced_options" => "sometimes",
40
            "column" => "required|array",
41
            "column.*.type" => "required|".Rule::notIn($this->getReservedNames()),
42
        ];
43
    }
44
    function getReservedNames()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
45
    {
46
       return KMGeneratorCommandFacade::getReservedNames();
47
    }
48
}
49