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

@@ 81-89 (lines=9) @@
78
        $question = $question->getPost($id);
79
80
        // If not logged in, render other views
81
        if ($question->type == "question") {
82
            $views = [
83
                ["comment/crud/question", ["question" => $question], "main"]
84
             ];
85
            $this->di->get("pageRenderComment")->renderPage([
86
                "views" => $views,
87
                "title" => "Create your question"
88
            ]);
89
        }
90
        return false;
91
    }
92
}