| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 1 | public function getIndex() |
|
| 23 | { |
||
| 24 | 1 | $comment = new Comment($this->di); |
|
| 25 | 1 | $comment->setDb($this->di->get("db")); |
|
| 26 | |||
| 27 | 1 | $form = new CreateCommentForm($this->di); |
|
| 28 | 1 | $form->check(); |
|
| 29 | |||
| 30 | $views = [ |
||
| 31 | 1 | ["comment/makeComment", ["form" => $form->getHTML()], "main"] |
|
| 32 | 1 | ]; |
|
| 33 | |||
| 34 | // If not logged in, render other views |
||
| 35 | 1 | if (!$this->di->get("session")->has("user")) { |
|
| 36 | $views = [ |
||
| 37 | 1 | ["comment/loginComment", [], "main"] |
|
| 38 | 1 | ]; |
|
| 39 | 1 | } |
|
| 40 | |||
| 41 | 1 | $this->di->get("pageRenderComment")->renderPage([ |
|
| 42 | 1 | "views" => $views, |
|
| 43 | "title" => "Create a comment" |
||
| 44 | 1 | ]); |
|
| 45 | 1 | } |
|
| 46 | } |
||
| 47 |