Work   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A notfound() 0 3 1
A admin() 0 3 1
A edit() 0 12 1
A home() 0 4 1
1
<?php
2
3
namespace Test;
4
5
/**
6
 * Class Work MVC :: CONTROLLER
7
 * @package Test
8
 */
9
class Work
10
{
11
    /**
12
     * Work constructor.
13
     */
14
    public function __construct()
15
    {
16
        $url = BASE;
17
18
        echo "<h1>Router @WorkCode</h1>";
19
        echo "<nav>
20
            <a href='{$url}'>Home</a>
21
            <a href='{$url}/edit/" . rand(44, 244) . "'>Edit</a>
22
            <a href='{$url}/error/'>Error</a>
23
        </nav>";
24
    }
25
26
    /**
27
     * @param array $data
28
     */
29
    public function home(array $data): void
30
    {
31
        echo "<h3>", __METHOD__, "::", $_SERVER["REQUEST_METHOD"], "</h3><hr>";
32
        echo "<pre>", print_r($data, true), "</pre>";
0 ignored issues
show
Bug introduced by
Are you sure print_r($data, true) of type string|true can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

32
        echo "<pre>", /** @scrutinizer ignore-type */ print_r($data, true), "</pre>";
Loading history...
33
    }
34
35
    /**
36
     * @param array $data
37
     */
38
    public function edit(array $data): void
39
    {
40
        echo "<h3>", __METHOD__, "::", $_SERVER["REQUEST_METHOD"], "</h3><hr>";
41
42
        echo "<form name='workcode' method='post' enctype='multipart/form-data'>
43
            <input name=\"first_name\" value=\"Denis\">
44
            <input name=\"last_name\" value=\"Lumerk\">
45
            <input name=\"email\" value=\"[email protected]\">
46
            <button>@CoffeeCode</button>
47
        </form>";
48
49
        echo "<pre>", print_r($data, true), "</pre>";
0 ignored issues
show
Bug introduced by
Are you sure print_r($data, true) of type string|true can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

49
        echo "<pre>", /** @scrutinizer ignore-type */ print_r($data, true), "</pre>";
Loading history...
50
    }
51
52
    /**
53
     * @param array $data
54
     */
55
    public function notfound(array $data): void
56
    {
57
        echo "<h3>Whoops!</h3>", "<pre>", print_r($data, true), "</pre>";
0 ignored issues
show
Bug introduced by
Are you sure print_r($data, true) of type string|true can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

57
        echo "<h3>Whoops!</h3>", "<pre>", /** @scrutinizer ignore-type */ print_r($data, true), "</pre>";
Loading history...
58
    }
59
60
    public function admin(array $data): void
61
    {
62
        echo "<h3>Admin Group:</h3>", "<pre>", print_r($data, true), "</pre>";
0 ignored issues
show
Bug introduced by
Are you sure print_r($data, true) of type string|true can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

62
        echo "<h3>Admin Group:</h3>", "<pre>", /** @scrutinizer ignore-type */ print_r($data, true), "</pre>";
Loading history...
63
    }
64
}