Passed
Pull Request — main (#31)
by Seth
01:28
created

TranslationStoreRequest::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SaasReady\Http\Requests\Translation;
4
5
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...
6
use SaasReady\Http\Requests\BaseFormRequest;
7
use SaasReady\Models\Translation;
0 ignored issues
show
Bug introduced by
The type SaasReady\Models\Translation 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 SaasReady\Rules\TranslationValuesRule;
9
10
class TranslationStoreRequest extends BaseFormRequest
11
{
12
    protected function getEndpointName(): string
13
    {
14
        return 'translations.store';
15
    }
16
17
    public function rules(): array
18
    {
19
        return [
20
            'key' => [
21
                'required',
22
                'string',
23
                Rule::unique((new Translation())->getTable(), 'key'),
24
            ],
25
            'label' => 'required|string',
26
            'translations' => [
27
                'required',
28
                app(TranslationValuesRule::class),
0 ignored issues
show
Bug introduced by
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
                /** @scrutinizer ignore-call */ 
29
                app(TranslationValuesRule::class),
Loading history...
29
            ],
30
        ];
31
    }
32
}
33