Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
30 | function loadFeatures() |
||
31 | { |
||
32 | $basePath = get_template_directory() . '/dist/Features'; |
||
33 | |||
34 | Feature::register('flynt-youtube-no-cookie-embed', $basePath); |
||
35 | |||
36 | // register all components in 'Components' folder |
||
37 | Feature::register('flynt-components', $basePath, [get_template_directory() . '/dist/Components/']); |
||
38 | |||
39 | // initialize ACF Field Groups and Option Pages |
||
40 | Feature::register('flynt-acf', $basePath, [[ |
||
41 | 'FieldLoader', |
||
42 | 'OptionPages', |
||
43 | 'FlexibleContentToggle', |
||
44 | 'GoogleMaps' |
||
45 | ]]); |
||
46 | |||
47 | // enable admin notices |
||
48 | Feature::register('flynt-admin-notices', $basePath); |
||
49 | |||
50 | // use timber rendering |
||
51 | Feature::register('flynt-timber-loader', $basePath); |
||
52 | |||
53 | // load jQuery in footer by default |
||
54 | Feature::register('flynt-jquery', $basePath); |
||
55 | |||
56 | // clean up some things |
||
57 | Feature::register('flynt-clean-head', $basePath); |
||
58 | Feature::register('flynt-clean-rss', $basePath); |
||
59 | Feature::register('flynt-mime-types', $basePath); |
||
60 | Feature::register('flynt-remove-editor', $basePath); |
||
61 | Feature::register('flynt-tiny-mce', $basePath); |
||
62 | Feature::register('flynt-base-style', $basePath); |
||
63 | |||
64 | // add components previews |
||
65 | Feature::register('flynt-admin-component-preview', $basePath); |
||
66 | |||
67 | // google analytics |
||
68 | Feature::register('flynt-google-analytics', $basePath); |
||
69 | |||
70 | // hide protected posts |
||
71 | Feature::register('flynt-hide-protected-posts', $basePath); |
||
72 | |||
73 | // move yoast seo plugin box to the bottom of the backend interface |
||
74 | Feature::register('flynt-yoast-to-bottom', $basePath); |
||
75 | |||
76 | Feature::register('flynt-password-form', $basePath); |
||
77 | Feature::register('flynt-external-script-loader', $basePath); |
||
78 | Feature::register('flynt-lodash', $basePath); |
||
79 | Feature::register('flynt-component-log-server', $basePath); |
||
80 | |||
81 | do_action('Flynt/afterRegisterFeatures', $basePath); |
||
82 | } |
||
83 |