Test Failed
Push — master ( 48da91...4d2acf )
by Nicklas
01:59
created

CommentController::getPostEditComment()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 26
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 13
cts 13
cp 1
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 13
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Nicklas\Comment;
4
5
use \Nicklas\Comment\HTMLForm\Comment\CreateCommentForm;
6
use \Nicklas\Comment\HTMLForm\Comment\EditCommentForm;
7
8
/**
9
 * Extends the UserController, for comments
10
 */
11
class CommentController extends AdminController
12
{
13
14
15
    /**
16
     * Show all items.
17
     *
18
     * @return void
19
     */
20 1
    public function getIndex()
21
    {
22 1
        $comment = new Comment($this->di);
23 1
        $comment->setDb($this->di->get("db"));
24
25 1
        $form       = new CreateCommentForm($this->di);
26 1
        $form->check();
27
28
        $views = [
29 1
            ["comment/makeComment", ["form" => $form->getHTML()], "main"]
30 1
        ];
31 1
32
        // If not logged in, render other views
33
        if (!$this->di->get("session")->has("user")) {
34 1
            $views = [
35
                ["comment/loginComment", [], "main"]
36 1
            ];
37 1
        }
38 1
39 1
        $this->renderPage($views, "A collection of comments");
0 ignored issues
show
Bug introduced by
The method renderPage() does not seem to exist on object<Nicklas\Comment\CommentController>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
    }
41
}
42