Issues (16)

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

1
<?php
2
3
namespace Test;
4
5
use WorkCode\WCRouter\WCRouter;
0 ignored issues
show
The type WorkCode\WCRouter\WCRouter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class Name
8
{
9
    /** @var WCRouter */
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);
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
}