| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function index(...$articleSlugs) |
||
| 11 | { |
||
| 12 | $articleSlug = collect($articleSlugs)->last(); |
||
| 13 | |||
| 14 | $article = ArticleRepository::findBySlug($articleSlug); |
||
| 15 | |||
| 16 | if ($article->hasChildren()) { |
||
| 17 | return redirect($article->first_child->url); |
||
|
|
|||
| 18 | } |
||
| 19 | |||
| 20 | return view('front.article.index')->with(compact('article')); |
||
| 21 | } |
||
| 22 | } |
||
| 23 |
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.