Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
Code Lines | 40 |
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 |
||
69 | public function defineProperties() |
||
70 | { |
||
71 | return [ |
||
72 | 'noPostsMessage' => [ |
||
73 | 'title' => 'rainlab.blog::lang.settings.posts_no_posts', |
||
74 | 'description' => 'rainlab.blog::lang.settings.posts_no_posts_description', |
||
75 | 'type' => 'string', |
||
76 | 'showExternalParam' => false |
||
77 | ], |
||
78 | 'orderBy' => [ |
||
79 | 'title' => 'rainlab.blog::lang.settings.posts_order', |
||
80 | 'description' => 'rainlab.blog::lang.settings.posts_order_description', |
||
81 | 'type' => 'dropdown', |
||
82 | 'default' => 'published_at asc', |
||
83 | 'showExternalParam' => false |
||
84 | ], |
||
85 | |||
86 | 'page' => [ |
||
87 | 'title' => 'Page', |
||
88 | 'description' => 'The URL parameter defining the page number.', |
||
89 | 'default' => '{{ :page }}', |
||
90 | 'type' => 'string', |
||
91 | 'group' => 'Pagination', |
||
92 | ], |
||
93 | 'resultsPerPage' => [ |
||
94 | 'title' => 'Results', |
||
95 | 'description' => 'The number of posts to display per page.', |
||
96 | 'default' => 10, |
||
97 | 'type' => 'string', |
||
98 | 'validationPattern' => '^(0+)?[1-9]\d*$', |
||
99 | 'validationMessage' => 'Results per page must be a positive whole number.', |
||
100 | 'showExternalParam' => false, |
||
101 | 'group' => 'Pagination', |
||
102 | ], |
||
103 | |||
104 | 'postPage' => [ |
||
105 | 'title' => 'Post page', |
||
106 | 'description' => 'Page to show linked posts', |
||
107 | 'type' => 'dropdown', |
||
108 | 'default' => 'blog/post', |
||
109 | 'group' => 'Links', |
||
110 | ], |
||
111 | 'categoryPage' => [ |
||
112 | 'title' => 'rainlab.blog::lang.settings.posts_category', |
||
113 | 'description' => 'rainlab.blog::lang.settings.posts_category_description', |
||
114 | 'type' => 'dropdown', |
||
115 | 'default' => 'blog/category', |
||
116 | 'group' => 'Links', |
||
117 | ] |
||
118 | ]; |
||
119 | } |
||
120 | |||
215 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.