Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
28 | public function index() |
||
29 | { |
||
30 | return \Cache::remember('achievements', 10, function () { |
||
31 | $achieveStorage = []; |
||
32 | |||
33 | (new Achieve()) |
||
34 | ->selectRaw('name, count(user_id) as count') |
||
35 | ->groupBy('name') |
||
36 | ->get() |
||
37 | ->each(function ($item) use (&$achieveStorage) { |
||
38 | $achieveStorage[$item->name] = $item->count; |
||
39 | }); |
||
40 | |||
41 | return (new AchieveSubscriber()) |
||
42 | ->toCollection() |
||
43 | ->each(function (AbstractAchieve $achieve) use ($achieveStorage) { |
||
44 | $achieve->users = $achieveStorage[$achieve->name] ?? 0; |
||
|
|||
45 | }) |
||
46 | ->toArray(); |
||
47 | }); |
||
48 | } |
||
49 | } |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.