We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 1 |
| Paths | 1 |
| Total Lines | 58 |
| Code Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 1 |
| 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 |
||
| 122 | 1 | protected static function get_default_node_fixes() { |
|
| 123 | return [ |
||
| 124 | 1 | self::CHARACTERS => [ |
|
| 125 | // Nodify anything that requires adjacent text awareness here. |
||
| 126 | 1 | Node_Fixes\Smart_Maths_Fix::class => [], |
|
| 127 | Node_Fixes\Smart_Diacritics_Fix::class => [], |
||
| 128 | Node_Fixes\Smart_Quotes_Fix::class => [ 'feed' => true ], |
||
| 129 | Node_Fixes\Smart_Dashes_Fix::class => [ 'feed' => true ], |
||
| 130 | Node_Fixes\Smart_Ellipses_Fix::class => [ 'feed' => true ], |
||
| 131 | Node_Fixes\Smart_Marks_Fix::class => [ 'feed' => true ], |
||
| 132 | Node_Fixes\Smart_Area_Units_Fix::class => [ 'feed' => true ], |
||
| 133 | ], |
||
| 134 | |||
| 135 | 1 | self::SPACING_PRE_WORDS => [ |
|
| 136 | // Keep spacing after smart character replacement. |
||
| 137 | Node_Fixes\Single_Character_Word_Spacing_Fix::class => [], |
||
| 138 | Node_Fixes\Dash_Spacing_Fix::class => [], |
||
| 139 | Node_Fixes\Unit_Spacing_Fix::class => [], |
||
| 140 | Node_Fixes\Numbered_Abbreviation_Spacing_Fix::class => [], |
||
| 141 | Node_Fixes\French_Punctuation_Spacing_Fix::class => [], |
||
| 142 | ], |
||
| 143 | |||
| 144 | 1 | self::SPACING_POST_WORDS => [ |
|
| 145 | // Some final space manipulation. |
||
| 146 | Node_Fixes\Dewidow_Fix::class => [], |
||
| 147 | Node_Fixes\Space_Collapse_Fix::class => [], |
||
| 148 | ], |
||
| 149 | |||
| 150 | 1 | self::HTML_INSERTION => [ |
|
| 151 | // Everything that requires HTML injection occurs here (functions above assume tag-free content) |
||
| 152 | // pay careful attention to functions below for tolerance of injected tags. |
||
| 153 | Node_Fixes\Smart_Ordinal_Suffix_Fix::class => [ |
||
| 154 | // call before "Style_Numbers_Fix" and "Smart_Fractions_Fix". |
||
| 155 | 'classes' => [ 'ordinal' ], |
||
| 156 | ], |
||
| 157 | Node_Fixes\Smart_Exponents_Fix::class => [ |
||
| 158 | // call before "Style_Numbers_Fix". |
||
| 159 | ], |
||
| 160 | Node_Fixes\Smart_Fractions_Fix::class => [ |
||
| 161 | // call before "Style_Numbers_Fix" and after "Smart_Ordinal_Suffix_Fix". |
||
| 162 | 'classes' => [ 'numerator', 'denominator' ], |
||
| 163 | ], |
||
| 164 | Node_Fixes\Style_Caps_Fix::class => [ |
||
| 165 | // Call before "Style_Numbers_Fix". |
||
| 166 | 'classes' => [ 'caps' ], |
||
| 167 | ], |
||
| 168 | Node_Fixes\Style_Numbers_Fix::class => [ |
||
| 169 | // Call after "Smart_Ordinal_Suffix_Fix", "Smart_Exponents_Fix", "Smart_Fractions_Fix", and "Style_Caps_Fix". |
||
| 170 | 'classes' => [ 'numbers' ], |
||
| 171 | ], |
||
| 172 | Node_Fixes\Style_Ampersands_Fix::class => [ |
||
| 173 | 'classes' => [ 'amp' ], |
||
| 174 | ], |
||
| 175 | Node_Fixes\Style_Initial_Quotes_Fix::class => [ |
||
| 176 | 'classes' => [ 'quo', 'dquo' ], |
||
| 177 | ], |
||
| 178 | Node_Fixes\Style_Hanging_Punctuation_Fix::class => [ |
||
| 179 | 'classes' => [ 'push-single', 'push-double', 'pull-single', 'pull-double' ], |
||
| 180 | ], |
||
| 201 |