Completed
Push — master ( 0a436d...ec1a89 )
by Nicklas
02:25
created

UserController::getUserIndex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 10
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Nicklas\Comment;
4
5
// MODULES
6
use \Nicklas\Comment\Modules\User;
7
8
/**
9
 * A controller class.
10
 */
11
class UserController extends ProfileController
12
{
13
14
    /**
15
     * Create page for all users overview
16
     *
17
     * @return void
18
     */
19 View Code Duplication
    public function getAllUsersIndex()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        $user = new User($this->di->get("db"));
22
        $users = $user->getAllUsers();
23
24
        $views = [
25
            ["comment/users/view-all", ["users" => $users], "main"]
26
        ];
27
28
        $this->di->get("pageRenderComment")->renderPage([
29
            "views" => $views,
30
            "title" => "Coffee users"
31
        ]);
32
    }
33
34
    /**
35
     * Create page for all users overview
36
     *
37
     * @return void
38
     */
39
    public function getUserIndex($name)
40
    {
41
        $user = new User($this->di->get("db"));
42
        $user = $user->getUser($name);
43
44
        $views = [
45
            ["comment/users/view-user", ["user" => $user], "main"]
46
        ];
47
48
        $this->di->get("pageRenderComment")->renderPage([
49
            "views" => $views,
50
            "title" => "User | $user->name"
51
        ]);
52
    }
53
}
54