Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
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 |
||
31 | function loadFeatures() |
||
32 | { |
||
33 | $basePath = get_template_directory() . '/dist/Features'; |
||
34 | |||
35 | global $flyntCurrentOptionCategory; |
||
36 | $flyntCurrentOptionCategory = 'feature'; |
||
37 | |||
38 | Feature::register('YoutubeNoCookieEmbed', $basePath); |
||
39 | |||
40 | // initialize ACF Field Groups and Option Pages |
||
41 | Feature::register('Acf', $basePath, [[ |
||
42 | 'FlexibleContentToggle', |
||
43 | 'GoogleMaps' |
||
44 | ]]); |
||
45 | |||
46 | // enable admin notices |
||
47 | Feature::register('AdminNotices', $basePath); |
||
48 | |||
49 | // use timber rendering |
||
50 | Feature::register('TimberLoader', $basePath); |
||
51 | |||
52 | // load jQuery in footer by default |
||
53 | Feature::register('Jquery', $basePath); |
||
54 | |||
55 | // clean up some things |
||
56 | Feature::register('CleanHead', $basePath); |
||
57 | Feature::register('CleanRss', $basePath); |
||
58 | Feature::register('MimeTypes', $basePath); |
||
59 | Feature::register('RemoveEditor', $basePath); |
||
60 | Feature::register('TinyMce', $basePath); |
||
61 | Feature::register('BaseStyle', $basePath); |
||
62 | |||
63 | // add components previews |
||
64 | Feature::register('AdminComponentPreview', $basePath); |
||
65 | |||
66 | // google analytics |
||
67 | Feature::register('GoogleAnalytics', $basePath); |
||
68 | |||
69 | // hide protected posts |
||
70 | Feature::register('HideProtectedPosts', $basePath); |
||
71 | |||
72 | // move yoast seo plugin box to the bottom of the backend interface |
||
73 | Feature::register('YoastToBottom', $basePath); |
||
74 | |||
75 | Feature::register('PasswordForm', $basePath); |
||
76 | Feature::register('ExternalScriptLoader', $basePath); |
||
77 | Feature::register('Lodash', $basePath); |
||
78 | Feature::register('ComponentLogServer', $basePath); |
||
79 | |||
80 | do_action('Flynt/afterRegisterFeatures'); |
||
81 | } |
||
82 | |||
91 |