Conditions | 1 |
Paths | 1 |
Total Lines | 58 |
Code Lines | 34 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
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 |
||
33 | public static function module_script_data( $args ) { |
||
34 | // Assign variables. |
||
35 | $id = $args['id'] ?? ''; |
||
36 | $name = $args['name'] ?? ''; |
||
37 | $selector = $args['selector'] ?? ''; |
||
38 | $attrs = $args['attrs'] ?? []; |
||
39 | $store_instance = $args['storeInstance'] ?? null; |
||
40 | |||
41 | // Module decoration attributes. |
||
42 | $module_decoration_attrs = $attrs['module']['decoration'] ?? []; |
||
43 | |||
44 | // Element Script Data Options. |
||
45 | ElementScriptData::set( |
||
46 | [ |
||
47 | 'id' => $id, |
||
48 | 'selector' => $selector, |
||
49 | 'attrs' => array_merge( |
||
50 | $module_decoration_attrs, |
||
51 | [ |
||
52 | 'link' => $args['attrs']['module']['advanced']['link'] ?? [], |
||
53 | ] |
||
54 | ), |
||
55 | 'storeInstance' => $store_instance, |
||
56 | ] |
||
57 | ); |
||
58 | |||
59 | MultiViewScriptData::set( |
||
60 | [ |
||
61 | 'id' => $id, |
||
62 | 'name' => $name, |
||
63 | 'hoverSelector' => $selector, |
||
64 | 'setContent' => [ |
||
65 | [ |
||
66 | 'selector' => $selector . ' .example_static_module__title', |
||
67 | 'data' => $attrs['title']['innerContent'] ?? [], |
||
68 | 'valueResolver' => function( $value ) { |
||
69 | return $value ?? ''; |
||
70 | }, |
||
71 | ], |
||
72 | [ |
||
73 | 'selector' => $selector . ' .example_static_module__content', |
||
74 | 'data' => $attrs['content']['innerContent'] ?? [], |
||
75 | 'valueResolver' => function( $value ) { |
||
76 | return $value ?? ''; |
||
77 | }, |
||
78 | 'sanitizer' => 'et_core_esc_previously', |
||
79 | ], |
||
80 | ], |
||
81 | 'setAttrs' => [ |
||
82 | [ |
||
83 | 'selector' => $selector . ' .example_static_module__image img', |
||
84 | 'data' => [ |
||
85 | 'src' => $attrs['image']['innerContent'] ?? [], |
||
86 | ], |
||
87 | 'valueResolver' => function( $value ) { |
||
88 | return $value['src'] ?? ''; |
||
89 | }, |
||
90 | 'tag' => 'img', |
||
91 | ], |
||
97 |
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