Passed
Push — main ( 0416fa...c3f05b )
by Seth
01:34 queued 10s
created

CurrencyStoreRequest::getEndpointName()   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\Currency;
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\Currency;
0 ignored issues
show
Bug introduced by
The type SaasReady\Models\Currency 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
9
class CurrencyStoreRequest extends BaseFormRequest
10
{
11
    protected function getEndpointName(): string
12
    {
13
        return 'currencies.store';
14
    }
15
16
    public function rules(): array
17
    {
18
        return [
19
            'code' => [
20
                'required',
21
                'string',
22
                'min:3',
23
                'max:3',
24
                Rule::unique((new Currency())->getTable(), 'code'),
25
            ],
26
            'name' => 'required|string',
27
            'symbol' => 'required|string',
28
            'thousands_separator' => [
29
                'required',
30
                'string',
31
                Rule::in(',', '.'),
32
            ],
33
            'decimal_separator' => [
34
                'required',
35
                'string',
36
                Rule::in(',', '.'),
37
            ],
38
            'decimals' => 'required|int|min:0|max:6',
39
            'space_after_symbol' => 'required|bool',
40
            'is_active' => 'nullable|bool',
41
        ];
42
    }
43
}
44