Skip to content

Commit 87130ab

Browse files
authored
Merge pull request #23 from AmazonPython/analysis-64bd0o
Apply fixes from StyleCI
2 parents c9d2c79 + c465335 commit 87130ab

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

app/Trending.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Trending
88
{
99
/**
10-
* 获取所有热门线程
10+
* 获取所有热门线程.
1111
*
1212
* @return array
1313
*/
@@ -20,7 +20,7 @@ public function get()
2020
}
2121

2222
/**
23-
* 获取缓存键名
23+
* 获取缓存键名.
2424
*
2525
* @return string
2626
*/
@@ -30,19 +30,18 @@ private function cacheKey()
3030
}
3131

3232
/**
33-
* 将新线程推送到热门线程列表
33+
* 将新线程推送到热门线程列表.
3434
*
3535
* @param Thread $thread
3636
*/
3737
public function push($thread, $increment = 1)
3838
{
39-
4039
$trending = Cache::get($this->cacheKey(), collect());
4140

4241
$trending[$thread->id] = (object) [
4342
'score' => $this->score($thread) + $increment,
4443
'title' => $thread->title,
45-
'path' => $thread->path(),
44+
'path' => $thread->path(),
4645
];
4746

4847
Cache::forever($this->cacheKey(), $trending);
@@ -52,15 +51,15 @@ public function score($thread)
5251
{
5352
$trending = Cache::get($this->cacheKey(), collect());
5453

55-
if (! isset($trending[$thread->id])) {
54+
if (!isset($trending[$thread->id])) {
5655
return 0;
5756
}
5857

5958
return $trending[$thread->id]->score;
6059
}
6160

6261
/**
63-
* 重置所有热门线程
62+
* 重置所有热门线程.
6463
*/
6564
public function reset()
6665
{

0 commit comments

Comments
 (0)