LanguageIndexRequest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A wantsActiveLanguages() 0 3 1
A rules() 0 5 1
A getLimit() 0 3 2
A getEndpointName() 0 3 1
1
<?php
2
3
namespace SaasReady\Http\Requests\Language;
4
5
use SaasReady\Http\Requests\BaseFormRequest;
6
7
class LanguageIndexRequest extends BaseFormRequest
8
{
9
    protected function getEndpointName(): string
10
    {
11
        return 'languages.index';
12
    }
13
14
    public function rules(): array
15
    {
16
        return [
17
            'limit' => 'nullable|int|max:100',
18
            'is_active' => 'nullable|bool',
19
        ];
20
    }
21
22
    public function getLimit(): int
23
    {
24
        return $this->input('limit') ?: 10;
25
    }
26
27
    public function wantsActiveLanguages(): bool
28
    {
29
        return $this->boolean('is_active');
30
    }
31
}
32