Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
58 | public function increment($field, $value) |
||
59 | { |
||
60 | if (!$this->uid) { |
||
61 | return false; |
||
62 | } |
||
63 | |||
64 | $redis = Yii::app()->redis->getClient(); |
||
65 | $key = $this->getCounterKey(); |
||
66 | |||
67 | //aggregated |
||
68 | $return = $redis->hIncrBy($key.':all', $field, (int)$value); |
||
69 | if ($this->level) { |
||
70 | //by uid+level |
||
71 | $redis->hIncrBy($key.':levels:'.$this->level, $field, (int)$value); |
||
72 | //by level |
||
73 | $redis->hIncrBy('counter:levels:'.$this->level, $field, (int)$value); |
||
74 | } |
||
75 | |||
76 | |||
77 | return $return; |
||
78 | } |
||
79 | |||
86 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.