Issues (14)

exemple/controller/Test/Name.php (2 issues)

1
<?php
2
3
namespace Test;
4
5
use CoffeeCode\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
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, $this->router->current());
0 ignored issues
show
Security Debugging Code introduced by
var_dump($data, $this->router->current()) 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
}