| Total Complexity | 7 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class KarmaHandler |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @param null $user |
||
|
|
|||
| 18 | * @return int |
||
| 19 | */ |
||
| 20 | public function getUserKarma($user = null) |
||
| 21 | { |
||
| 22 | $user = (null === $user) ? $GLOBALS['xoopsUser'] : $user; |
||
| 23 | |||
| 24 | return $this->calculateUserKarma($user); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Placeholder for calculating user karma |
||
| 29 | * @param \XoopsUser $user |
||
| 30 | * @return int |
||
| 31 | */ |
||
| 32 | public function calculateUserKarma($user) |
||
| 33 | { |
||
| 34 | if (!\is_object($user)) { |
||
| 35 | $user_karma = 0; |
||
| 36 | } else { |
||
| 37 | $user_karma = $user->getVar('posts') * 50; |
||
| 38 | } |
||
| 39 | |||
| 40 | return $user_karma; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function updateUserKarma() |
||
| 44 | { |
||
| 45 | } |
||
| 46 | |||
| 47 | public function writeUserKarma() |
||
| 49 | } |
||
| 50 | |||
| 51 | public function readUserKarma() |
||
| 53 | } |
||
| 54 | } |
||
| 55 |