| Conditions | 3 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | public function load($locale, $group, $namespace = null) |
||
| 20 | { |
||
| 21 | if (!is_null($namespace) && $namespace !== '*') { |
||
| 22 | return $this->loadNamespaced($locale, $group, $namespace); |
||
| 23 | } |
||
| 24 | |||
| 25 | return Fragment::query() |
||
| 26 | ->where('name', 'LIKE', "{$group}.%") |
||
| 27 | ->get() |
||
| 28 | ->map(function (Fragment $fragment) use ($locale, $group) { |
||
| 29 | return [ |
||
| 30 | 'key' => str_replace("{$group}.", '', $fragment->name), |
||
|
|
|||
| 31 | 'text' => $fragment->translate($locale)->text, |
||
| 32 | ]; |
||
| 33 | }) |
||
| 34 | ->pluck('text', 'key') |
||
| 35 | ->toArray(); |
||
| 36 | } |
||
| 37 | } |
||
| 38 |
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@propertyannotation 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.