Passed
Pull Request — master (#439)
by Kirill
06:35
created

DemoController   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 46
rs 10
c 1
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A entity() 0 3 1
A entity2() 0 3 1
A guardedButNoName() 0 3 1
A doAttribute() 0 4 1
A guardedButNoNameAttribute() 0 4 1
A do() 0 3 1
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\App\Controller;
13
14
use Spiral\App\User\Role;
15
use Spiral\App\User\User;
16
use Spiral\Domain\Annotation\Guarded;
17
18
class DemoController
19
{
20
    public function entity(User $user)
21
    {
22
        return $user->getName();
23
    }
24
25
    public function entity2(User $user, Role $role)
0 ignored issues
show
Unused Code introduced by
The parameter $user is not used and could be removed. ( Ignorable by Annotation )

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

25
    public function entity2(/** @scrutinizer ignore-unused */ User $user, Role $role)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $role is not used and could be removed. ( Ignorable by Annotation )

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

25
    public function entity2(User $user, /** @scrutinizer ignore-unused */ Role $role)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        return 'ok';
28
    }
29
30
    /**
31
     * @Guarded()
32
     * @return string
33
     */
34
    public function guardedButNoName()
35
    {
36
        return 'ok';
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    #[Guarded()]
43
    public function guardedButNoNameAttribute()
44
    {
45
        return 'ok';
46
    }
47
48
    /**
49
     * @Guarded("do")
50
     * @return string
51
     */
52
    public function do()
53
    {
54
        return 'ok';
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    #[Guarded(permission: 'do')]
61
    public function doAttribute()
62
    {
63
        return 'ok';
64
    }
65
}
66