|
@@ 124-140 (lines=17) @@
|
| 121 |
|
* |
| 122 |
|
* @return int |
| 123 |
|
*/ |
| 124 |
|
public function addPointsForComment(Comment $comment) |
| 125 |
|
{ |
| 126 |
|
$points = $this->points['comment']; |
| 127 |
|
$points += $this->language->evaluate($this->points['comment_reactions'], ['comment' => $comment]); |
| 128 |
|
$points += $this->getPointsForMessageLength($comment->getMessage()); |
| 129 |
|
|
| 130 |
|
// Add points for using recommended links |
| 131 |
|
$points += $this->addPointsForLinks($comment->getMessage()); |
| 132 |
|
|
| 133 |
|
// Set points if message contains code |
| 134 |
|
$points = $this->language->evaluate($this->points['code'], ['codeDetector' => $this->codeDetector, 'message' => $comment->getMessage(), 'points' => $points]); |
| 135 |
|
|
| 136 |
|
// Remove points for using offensive words |
| 137 |
|
$points += $this->getOffensivePoints($comment->getMessage()); |
| 138 |
|
|
| 139 |
|
return $points; |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* Add points based on reply. |
|
@@ 149-165 (lines=17) @@
|
| 146 |
|
* |
| 147 |
|
* @return int |
| 148 |
|
*/ |
| 149 |
|
public function addPointsForReply(Reply $reply) |
| 150 |
|
{ |
| 151 |
|
$points = $this->points['reply']; |
| 152 |
|
$points += $this->language->evaluate($this->points['comment_reactions'], ['comment' => $reply]); |
| 153 |
|
$points += $this->getPointsForMessageLength($reply->getMessage()); |
| 154 |
|
|
| 155 |
|
// Add points for using recommended links |
| 156 |
|
$points += $this->addPointsForLinks($reply->getMessage()); |
| 157 |
|
|
| 158 |
|
// Set points if message contains code |
| 159 |
|
$points = $this->language->evaluate($this->points['code'], ['codeDetector' => $this->codeDetector, 'message' => $reply->getMessage(), 'points' => $points]); |
| 160 |
|
|
| 161 |
|
// Remove points for using offensive words |
| 162 |
|
$points += $this->getOffensivePoints($reply->getMessage()); |
| 163 |
|
|
| 164 |
|
return $points; |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
/** |
| 168 |
|
* Add points for attaching recommended links. |