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

BaseFormRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 5 1
A wantsPagination() 0 3 1
1
<?php
2
3
namespace SaasReady\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
0 ignored issues
show
Bug introduced by
The type Illuminate\Foundation\Http\FormRequest 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\Auth\ReadyAuthorization;
7
8
abstract class BaseFormRequest extends FormRequest
9
{
10
    public function authorize(): bool
11
    {
12
        return call_user_func(
13
            ReadyAuthorization::getAuthorization($this->getEndpointName()),
14
            $this
15
        );
16
    }
17
18
    abstract protected function getEndpointName(): string;
19
20
    public function wantsPagination(): bool
21
    {
22
        return $this->input('type') !== 'all';
23
    }
24
}
25