Conditions | 7 |
Paths | 48 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 0 |
1 | <?php |
||
41 | public function postVote() |
||
42 | { |
||
43 | $vote = new Vote(); |
||
44 | |||
45 | $user = $this->di->get("session")->get("user"); |
||
46 | |||
47 | $parentType = isset($_POST["parentType"]) ? $_POST["parentType"] : ""; |
||
48 | $downVote = isset($_POST["downVote"]) ? $_POST["downVote"] : null; |
||
49 | $parentId = isset($_POST["parentId"]) ? $_POST["parentId"] : ""; |
||
50 | $upVote = isset($_POST["upVote"]) ? $_POST["upVote"] : null; |
||
51 | |||
52 | if ($upVote != null) { |
||
53 | return $vote->like($user, $parentId, $parentType); |
||
54 | } |
||
55 | if ($downVote != null) { |
||
56 | return $vote->dislike($user, $parentId, $parentType); |
||
57 | } |
||
58 | return false; |
||
59 | } |
||
60 | } |
||
61 |