| Conditions | 8 |
| Paths | 26 |
| Total Lines | 54 |
| Code Lines | 37 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 77 | public function updatePage($request) |
||
| 78 | { |
||
| 79 | $page = $this->find($request['page_id']); |
||
| 80 | |||
| 81 | $meta = []; |
||
| 82 | foreach (ChuckSite::getSupportedLocales() as $langKey => $langValue) { |
||
| 83 | $page->setTranslation('title', $langKey, $request->get('page_title')[$langKey]); |
||
| 84 | $page->setTranslation('slug', $langKey, $request->get('page_slug')[$langKey]); |
||
| 85 | |||
| 86 | $meta[$langKey]['title'] = $request->get('meta_title')[$langKey]; |
||
| 87 | $meta[$langKey]['description'] = $request->get('meta_description')[$langKey]; |
||
| 88 | $meta[$langKey]['keywords'] = $request->get('meta_keywords')[$langKey]; |
||
| 89 | |||
| 90 | $meta[$langKey]['og:url'] = $request->get('page_slug')[$langKey]; |
||
| 91 | $meta[$langKey]['og:type'] = 'website'; |
||
| 92 | $meta[$langKey]['og:title'] = $request->get('meta_title')[$langKey]; |
||
| 93 | $meta[$langKey]['og:description'] = $request->get('meta_description')[$langKey]; |
||
| 94 | $meta[$langKey]['og:site_name'] = $request->get('meta_title')[$langKey]; |
||
| 95 | $meta[$langKey]['og:image'] = $request->get('meta_image'); |
||
| 96 | |||
| 97 | if ($request->get('meta_robots_index')[$langKey] == '1') { |
||
| 98 | $index = 'index, '; |
||
| 99 | } else { |
||
| 100 | $index = 'noindex, '; |
||
| 101 | } |
||
| 102 | |||
| 103 | if ($request->get('meta_robots_follow')[$langKey] == '1') { |
||
| 104 | $follow = 'follow'; |
||
| 105 | } else { |
||
| 106 | $follow = 'nofollow'; |
||
| 107 | } |
||
| 108 | |||
| 109 | $meta[$langKey]['robots'] = $index.$follow; |
||
| 110 | $meta[$langKey]['googlebots'] = $index.$follow; |
||
| 111 | |||
| 112 | $count = count($request->get('meta_key')[$langKey]); |
||
| 113 | for ($i = 0; $i < $count; $i++) { |
||
| 114 | if (!is_null($request->get('meta_value')[$langKey][$i])) { |
||
| 115 | $meta[$langKey][$request->get('meta_key')[$langKey][$i]] = $request->get('meta_value')[$langKey][$i]; |
||
| 116 | } |
||
| 117 | } |
||
| 118 | } |
||
| 119 | $page->meta = $meta; |
||
| 120 | |||
| 121 | $page->template_id = $request['template_id']; |
||
| 122 | $page->page = $request['page']; |
||
| 123 | $page->active = $request['active']; |
||
| 124 | $page->isHp = $request['isHp']; |
||
| 125 | $page->roles = count(is_array($request['roles']) ? $request['roles'] : []) > 0 ? implode('|', $request['roles']) : null; |
||
| 126 | |||
| 127 | $page->css = $request->get('css'); |
||
| 128 | $page->js = $request->get('js'); |
||
| 129 | |||
| 130 | $page->save(); |
||
| 131 | } |
||
| 133 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths