ExitProductRequest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 13 4
A rules() 0 6 1
A getInvolvedRepository() 0 4 1
1
<?php
2
3
namespace App\Http\Requests;
4
5
use App\Repositories\InvolvedRepository;
6
7
class ExitProductRequest extends Request
8
{
9
    /**
10
     * @return bool
11
     */
12
    public function authorize()
13
    {
14
        $involve = $this->route()->getParameter('involved');
15
16
        if ($involve
17
            && $this->getInvolvedRepository()->checkIfAuthInvolved($involve->product)
18
        )
19
            if ($involve->active !== 0) {
20
                return true;
21
            }
22
23
        return false;
24
    }
25
26
    /**
27
     * @return array
28
     */
29
    public function rules()
30
    {
31
        return [
32
            'count' => $this->getInvolvedRepository()->countRules()
33
        ];
34
    }
35
36
    /**
37
     * @return InvolvedRepository
38
     */
39
    private function getInvolvedRepository()
40
    {
41
        return (new InvolvedRepository());
42
    }
43
}