Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | public function getRecentlyPlayed(User $user, ?int $count = null): array |
||
38 | { |
||
39 | /** @var Builder $query */ |
||
40 | $query = $this->model |
||
41 | ->where('user_id', $user->id) |
||
42 | ->where('play_count', '>', 0) |
||
43 | ->orderBy('updated_at', 'DESC'); |
||
44 | |||
45 | if ($count) { |
||
|
|||
46 | $query = $query->take($count); |
||
47 | } |
||
48 | |||
49 | return $query |
||
50 | ->get() |
||
51 | ->pluck('song_id') |
||
52 | ->all(); |
||
53 | } |
||
55 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: