| Conditions | 5 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 39 | public function render() |
||
| 40 | { |
||
| 41 | $output = '<ul>'; |
||
| 42 | |||
| 43 | foreach ($this->menu->items() as $item) { |
||
| 44 | if ($item instanceof Menu) { |
||
| 45 | // Have a new instance of this presenter render the nested/submenu item |
||
| 46 | $output .= sprintf('<li>%s%s</li>', $item->label, (new static($item))->render()); |
||
| 47 | } else if ($item instanceof MenuItem) { |
||
| 48 | // Render the link as-is |
||
| 49 | $output .= sprintf( |
||
| 50 | '<li%1$s><a href="%2$s" title="%3$s">%3$s</a></li>', |
||
| 51 | $item->options('class') ? sprintf(' class="%s"', $item->options('class')) : null, |
||
| 52 | $item->link, |
||
|
|
|||
| 53 | $item->label |
||
| 54 | ); |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | $output .= '</ul>'; |
||
| 59 | |||
| 60 | return $output; |
||
| 61 | } |
||
| 62 | } |
||
| 63 |
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@propertyannotation 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.