Code Duplication    Length = 9-9 lines in 3 locations

src/Comment/UserController.php 1 location

@@ 47-55 (lines=9) @@
44
     */
45
    public function checkIsLogin()
46
    {
47
        if (!$this->di->get("session")->has("user")) {
48
            $views = [
49
                ["user/fail/fail", [], "main"]
50
            ];
51
            $this->di->get("pageRenderComment")->renderPage([
52
                "views" => $views,
53
                "title" => "Not logged in"
54
            ]);
55
        }
56
    }
57
58

src/Comment/AdminController.php 1 location

@@ 49-57 (lines=9) @@
46
        $user->setDb($this->di->get("db"));
47
        $user = $user->find("name", $this->di->get("session")->get("user"));
48
49
        if ($user->authority != "admin") {
50
            $views = [
51
                ["admin/fail", [], "main"]
52
            ];
53
            $this->di->get("pageRenderComment")->renderPage([
54
                "views" => $views,
55
                "title" => "Not authorized"
56
            ]);
57
        }
58
    }
59
60

src/Comment/CommentController.php 1 location

@@ 100-108 (lines=9) @@
97
        $question = $question->getQuestion($id);
98
99
        // If not logged in, render other views
100
        if ($question->type == "question") {
101
            $views = [
102
                ["comment/question/view-question", ["question" => $question], "main"]
103
             ];
104
            $this->di->get("pageRenderComment")->renderPage([
105
                "views" => $views,
106
                "title" => "Create your question"
107
            ]);
108
        }
109
        return false;
110
    }
111
}