Passed
Push — main ( deaffd...dea3f5 )
by Chema
55s queued 13s
created

FakeController   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 54
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A basicAction() 0 3 1
A stringParamAction() 0 4 1
A nonScalarParam() 0 3 1
A optionalStringParamAction() 0 4 1
A boolParamAction() 0 5 1
A nonTypedParam() 0 3 1
A manyParamsAction() 0 3 1
A intParamAction() 0 4 1
A floatParamAction() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Router\Fixtures;
6
7
final class FakeController
8
{
9
    public function basicAction(): string
10
    {
11
        return 'Expected!';
12
    }
13
14
    public function stringParamAction(string $param): string
15
    {
16
        $type = get_debug_type($param);
17
        return "The '{$type}' param is '{$param}'!";
18
    }
19
20
    public function optionalStringParamAction(string $param = 'bob'): string
21
    {
22
        $type = get_debug_type($param);
23
        return "The optional '{$type}' param is '{$param}'!";
24
    }
25
26
    public function intParamAction(int $param): string
27
    {
28
        $type = get_debug_type($param);
29
        return "The '{$type}' param is '{$param}'!";
30
    }
31
32
    public function floatParamAction(float $param): string
33
    {
34
        $type = get_debug_type($param);
35
        return "The '{$type}' param is '{$param}'!";
36
    }
37
38
    public function boolParamAction(bool $param): string
39
    {
40
        $type = get_debug_type($param);
41
        $stringParam = json_encode($param);
42
        return "The '{$type}' param is '{$stringParam}'!";
43
    }
44
45
    public function manyParamsAction(string $firstParam, string $secondParam, string $thirdParam): string
46
    {
47
        return "The params are '{$firstParam}', '{$secondParam}' and '{$thirdParam}'!";
48
    }
49
50
    /**
51
     * @param mixed $param
52
     */
53
    public function nonTypedParam($param): string
0 ignored issues
show
Unused Code introduced by
The parameter $param 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

53
    public function nonTypedParam(/** @scrutinizer ignore-unused */ $param): string

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...
54
    {
55
        return 'I AM ERROR!';
56
    }
57
58
    public function nonScalarParam(array $param): string
0 ignored issues
show
Unused Code introduced by
The parameter $param 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

58
    public function nonScalarParam(/** @scrutinizer ignore-unused */ array $param): string

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...
59
    {
60
        return 'I AM ERROR!';
61
    }
62
}
63