| Conditions | 5 |
| Paths | 9 |
| Total Lines | 52 |
| Code Lines | 36 |
| 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 |
||
| 23 | public function create(Request $request) |
||
| 24 | { |
||
| 25 | $page = new Page(); |
||
| 26 | |||
| 27 | $meta = []; |
||
| 28 | foreach (ChuckSite::getSupportedLocales() as $langKey => $langValue) { |
||
| 29 | $page->setTranslation('title', $langKey, $request->get('page_title')[$langKey]); |
||
| 30 | $page->setTranslation('slug', $langKey, $request->get('page_slug')[$langKey]); |
||
| 31 | |||
| 32 | $meta[$langKey]['title'] = $request->get('meta_title')[$langKey]; |
||
| 33 | $meta[$langKey]['description'] = $request->get('meta_description')[$langKey]; |
||
| 34 | $meta[$langKey]['keywords'] = $request->get('meta_keywords')[$langKey]; |
||
| 35 | |||
| 36 | $meta[$langKey]['og:url'] = $request->get('page_slug')[$langKey]; |
||
| 37 | $meta[$langKey]['og:type'] = 'website'; |
||
| 38 | $meta[$langKey]['og:title'] = $request->get('meta_title')[$langKey]; |
||
| 39 | $meta[$langKey]['og:description'] = $request->get('meta_description')[$langKey]; |
||
| 40 | $meta[$langKey]['og:site_name'] = $request->get('meta_title')[$langKey]; |
||
| 41 | $meta[$langKey]['og:image'] = $request->get('meta_image'); |
||
| 42 | |||
| 43 | if ($request->get('meta_robots_index')[$langKey] == '1') { |
||
| 44 | $index = 'index, '; |
||
| 45 | } else { |
||
| 46 | $index = 'noindex, '; |
||
| 47 | } |
||
| 48 | |||
| 49 | if ($request->get('meta_robots_follow')[$langKey] == '1') { |
||
| 50 | $follow = 'follow'; |
||
| 51 | } else { |
||
| 52 | $follow = 'nofollow'; |
||
| 53 | } |
||
| 54 | |||
| 55 | $meta[$langKey]['robots'] = $index.$follow; |
||
| 56 | $meta[$langKey]['googlebots'] = $index.$follow; |
||
| 57 | |||
| 58 | $count = count($request->get('meta_key')[$langKey]); |
||
| 59 | for ($i = 0; $i < $count; $i++) { |
||
| 60 | $meta[$langKey][$request->get('meta_key')[$langKey][$i]] = $request->get('meta_value')[$langKey][$i]; |
||
| 61 | } |
||
| 62 | } |
||
| 63 | $page->meta = $meta; |
||
| 64 | |||
| 65 | $page->template_id = $request['template_id']; |
||
| 66 | $page->page = $request['page']; |
||
| 67 | $page->active = $request['active']; |
||
| 68 | $page->isHp = $request['isHp']; |
||
| 69 | $page->order = ($this->page->max('order') ?? 0) + 1; |
||
| 70 | |||
| 71 | $page->css = $request->get('css'); |
||
| 72 | $page->js = $request->get('js'); |
||
| 73 | |||
| 74 | $page->save(); |
||
| 75 | } |
||
| 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