| Conditions | 7 |
| Paths | 1 |
| Total Lines | 86 |
| Code Lines | 50 |
| Lines | 0 |
| Ratio | 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 |
||
| 22 | static function users_general () { |
||
| 23 | $Config = Config::instance(); |
||
| 24 | $Index = Index::instance(); |
||
| 25 | $L = Language::instance(); |
||
| 26 | $Index->apply_button = true; |
||
| 27 | $Index->content( |
||
| 28 | static::vertical_table( |
||
| 29 | static::core_input('session_expire', 'number', null, false, 1, false, $L->seconds), |
||
| 30 | [ |
||
| 31 | h::info('sign_in_attempts_block_count'), |
||
| 32 | h::{'input[is=cs-input-text][type=number]'}( |
||
| 33 | [ |
||
| 34 | 'name' => 'core[sign_in_attempts_block_count]', |
||
| 35 | 'value' => $Config->core['sign_in_attempts_block_count'], |
||
| 36 | 'min' => 0, |
||
| 37 | 'onChange' => "if ($(this).val() == 0) { $('.cs-sign-in-attempts-block-count').hide(); } else { $('.cs-sign-in-attempts-block-count').show(); }" |
||
| 38 | ] |
||
| 39 | ) |
||
| 40 | ], |
||
| 41 | [ |
||
| 42 | static::core_input('sign_in_attempts_block_time', 'number', null, false, 1, false, $L->seconds), |
||
| 43 | [ |
||
| 44 | 'style' => $Config->core['sign_in_attempts_block_count'] == 0 ? 'display: none;' : '', |
||
| 45 | 'class' => 'cs-sign-in-attempts-block-count' |
||
| 46 | ] |
||
| 47 | ], |
||
| 48 | static::core_input('remember_user_ip', 'radio'), |
||
| 49 | static::core_input('password_min_length', 'number', null, false, 4), |
||
| 50 | static::core_input('password_min_strength', 'number', null, false, 0, 7), |
||
| 51 | [ |
||
| 52 | h::info('allow_user_registration'), |
||
| 53 | h::radio( |
||
| 54 | [ |
||
| 55 | 'name' => 'core[allow_user_registration]', |
||
| 56 | 'checked' => $Config->core['allow_user_registration'], |
||
| 57 | 'value' => [0, 1], |
||
| 58 | 'in' => [$L->off, $L->on], |
||
| 59 | 'onchange' => [ |
||
| 60 | "$('.cs-allow-user-registration').hide();", |
||
| 61 | "$('.cs-allow-user-registration').show();". |
||
| 62 | "if (!$('.cs-allow-user-registration input[value=1]').prop('checked')) { $('.cs-require-registration-confirmation').hide(); }" |
||
| 63 | ] |
||
| 64 | ] |
||
| 65 | ) |
||
| 66 | ], |
||
| 67 | [ |
||
| 68 | [ |
||
| 69 | h::info('require_registration_confirmation'), |
||
| 70 | h::radio( |
||
| 71 | [ |
||
| 72 | 'name' => 'core[require_registration_confirmation]', |
||
| 73 | 'checked' => $Config->core['require_registration_confirmation'], |
||
| 74 | 'value' => [0, 1], |
||
| 75 | 'in' => [$L->off, $L->on], |
||
| 76 | 'onchange' => [ |
||
| 77 | "$('.cs-require-registration-confirmation').hide();", |
||
| 78 | "$('.cs-require-registration-confirmation').show();" |
||
| 79 | ] |
||
| 80 | ] |
||
| 81 | ) |
||
| 82 | ], |
||
| 83 | [ |
||
| 84 | 'style' => $Config->core['allow_user_registration'] == 0 ? 'display: none;' : '', |
||
| 85 | 'class' => 'cs-allow-user-registration' |
||
| 86 | ] |
||
| 87 | ], |
||
| 88 | [ |
||
| 89 | static::core_input('registration_confirmation_time', 'number', null, false, 1, false, $L->days), |
||
| 90 | [ |
||
| 91 | 'style' => $Config->core['allow_user_registration'] == 1 && $Config->core['require_registration_confirmation'] == 1 ? '' : |
||
| 92 | 'display: none;', |
||
| 93 | 'class' => 'cs-allow-user-registration cs-require-registration-confirmation' |
||
| 94 | ] |
||
| 95 | ], |
||
| 96 | [ |
||
| 97 | static::core_input('auto_sign_in_after_registration', 'radio'), |
||
| 98 | [ |
||
| 99 | 'style' => $Config->core['allow_user_registration'] == 1 && $Config->core['require_registration_confirmation'] == 1 ? '' : |
||
| 100 | 'display: none;', |
||
| 101 | 'class' => 'cs-allow-user-registration cs-require-registration-confirmation' |
||
| 102 | ] |
||
| 103 | ], |
||
| 104 | static::core_textarea('rules', 'SIMPLE_EDITOR') |
||
| 105 | ) |
||
| 106 | ); |
||
| 107 | } |
||
| 108 | static function users_groups () { |
||
| 366 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: