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 | 26 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 52 | public function handle() |
||
| 53 | { |
||
| 54 | /** @var Menu $menu */ |
||
| 55 | foreach($this->menus->all() as $menu) |
||
| 56 | { |
||
| 57 | $link = new Link; |
||
| 58 | |||
| 59 | /** @var Page $page */ |
||
| 60 | $page = $this->pages->whereID($menu->page_id); |
||
| 61 | |||
| 62 | if ($menu->getAttribute('parent_id')) |
||
| 63 | { |
||
| 64 | $prefix = str_slug($menu->parent->title); |
||
| 65 | } |
||
| 66 | else |
||
| 67 | { |
||
| 68 | $prefix = ""; |
||
| 69 | } |
||
| 70 | |||
| 71 | $page->setAttribute('prefix', $prefix)->save(); |
||
| 72 | |||
| 73 | $link->connect($menu, $page)->save(); |
||
| 74 | |||
| 75 | $this->info($menu->title . " => " . $page->getAttribute('seo_title') . " (" . $page->getAttribute('prefix') . "/" . $page->getAttribute('slug') . ")"); |
||
| 76 | } |
||
| 77 | } |
||
| 78 | } |
||
| 79 |
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.