Name   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A home() 0 6 1
A params() 0 3 1
A hello() 0 4 1
A redirect() 0 8 2
1
<?php
2
3
namespace Test;
4
5
use SimpSyst\Router\Router;
6
7
class Name
8
{
9
    /** @var Router */
10
    private $router;
11
12
    public function __construct($router)
13
    {
14
        $this->router = $router;
15
    }
16
17
    public function home(): void
18
    {
19
        echo "<h1>Home</h1>";
20
        echo "<p>", $this->router->route("name.home"), "</p>";
21
        echo "<p>", $this->router->route("name.hello"), "</p>";
22
        echo "<p>", $this->router->route("name.redirect"), "</p>";
23
    }
24
25
    public function hello($data): void
0 ignored issues
show
Unused Code introduced by
The parameter $data 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 hello(/** @scrutinizer ignore-unused */ $data): void

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
        echo "<h1>Hello World</h1>";
28
        echo "<a href='{$this->router->route("name.params", ["category" => 6, "page" => 1])}'>Route Params</a>";
29
    }
30
31
    public function params(array $data): void
32
    {
33
        var_dump($data);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($data) looks like debug code. Are you sure you do not want to remove it?
Loading history...
34
    }
35
36
    public function redirect($data): void
37
    {
38
        if ($data) {
39
            //$data = category => *, page => *
40
            $this->router->redirect("name.params", $data);
41
        }
42
43
        $this->router->redirect("name.hello");
44
    }
45
}