Passed
Push — master ( 92e76a...1cfcdd )
by Robson
02:02
created

Name::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Test;
4
5
class Name
6
{
7
    public function __construct($router)
8
    {
9
        $this->router = $router;
0 ignored issues
show
Bug Best Practice introduced by
The property router does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
10
    }
11
12
    public function home(): void
13
    {
14
        echo "<h1>Home</h1>";
15
        echo "<p>", $this->router->route("name.home"), "</p>";
16
        echo "<p>", $this->router->route("name.hello"), "</p>";
17
        echo "<p>", $this->router->route("name.redirect"), "</p>";
18
    }
19
20
    public function hello(): void
21
    {
22
        echo "<h1>Hello World</h1>";
23
    }
24
25
    public function redirect(): void
26
    {
27
        $this->router->redirect("name.hello");
28
    }
29
}