We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 51 | public function handle() |
||
| 52 | { |
||
| 53 | /** @var Menu $menu */ |
||
| 54 | foreach ($this->menus->all() as $menu) { |
||
| 55 | $link = new Link; |
||
| 56 | |||
| 57 | /** @var Page $page */ |
||
| 58 | $page = $this->pages->whereID($menu->page_id); |
||
| 59 | |||
| 60 | if ($menu->getAttribute('parent_id')) { |
||
| 61 | $prefix = str_slug($menu->parent->title); |
||
| 62 | } else { |
||
| 63 | $prefix = ''; |
||
| 64 | } |
||
| 65 | |||
| 66 | $page->setAttribute('prefix', $prefix)->save(); |
||
| 67 | |||
| 68 | $link->connect($menu, $page)->save(); |
||
| 69 | |||
| 70 | $this->info($menu->title.' => '.$page->getAttribute('seo_title').' ('.$page->getAttribute('prefix').'/'.$page->getAttribute('slug').')'); |
||
| 71 | } |
||
| 72 | } |
||
| 73 | } |
||
| 74 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.