Conditions | 1 |
Paths | 1 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | protected function getHostsWithChecks() |
||
24 | { |
||
25 | $hosts = HostRepository::all(); |
||
26 | $result = $hosts->map( |
||
27 | function (Host $host) { |
||
28 | $checks = $host->checks->map( |
||
|
|||
29 | function (Check $check) { |
||
30 | return $check->type; |
||
31 | } |
||
32 | )->toArray(); |
||
33 | |||
34 | return [ |
||
35 | 'name' => $host->name, |
||
36 | 'ssh_user' => $host->ssh_user, |
||
37 | 'port' => $host->port, |
||
38 | 'ip' => $host->ip, |
||
39 | 'checks' => $checks, |
||
40 | ]; |
||
41 | } |
||
42 | )->toArray(); |
||
43 | |||
44 | return $result; |
||
45 | } |
||
46 | } |
||
47 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read 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.