| Conditions | 2 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 62 | public function generate() |
||
| 63 | { |
||
| 64 | // this form makes use of the session for passing around invalid form submission data, so make sure its enabled |
||
| 65 | add_filter('FHEE__EE_Session___save_session_to_db__abort_session_save', '__return_false'); |
||
| 66 | /** |
||
| 67 | * @var $reg_config EE_Registration_Config |
||
| 68 | */ |
||
| 69 | $reg_config = $this->config->registration; |
||
| 70 | return new EE_Form_Section_Proper( |
||
| 71 | array( |
||
| 72 | 'name' => 'privacy_consent_settings', |
||
| 73 | 'subsections' => array( |
||
| 74 | 'privacy_consent_form_hdr' => new EE_Form_Section_HTML( |
||
| 75 | EEH_HTML::h2(esc_html__('Privacy Policy Consent Settings', 'event_espresso')) |
||
| 76 | ), |
||
| 77 | 'enable' => new EE_Select_Reveal_Input( |
||
| 78 | array( |
||
| 79 | 'enable-privacy-consent' => esc_html__('Enabled', 'event_espresso'), |
||
| 80 | 'disable' => esc_html__('Disabled', 'event_espresso'), |
||
| 81 | ), |
||
| 82 | array( |
||
| 83 | 'default' => $reg_config->isConsentCheckboxEnabled() |
||
| 84 | ? 'enable-privacy-consent' |
||
| 85 | : 'disable', |
||
| 86 | 'html_label_text' => esc_html__('Privacy Consent Checkbox', 'event_espresso'), |
||
| 87 | 'html_help_text' => esc_html__( |
||
| 88 | 'When enabled, a checkbox appears in the registration form requiring users to consent to your site\'s privacy policy.', |
||
| 89 | 'event_espresso' |
||
| 90 | ), |
||
| 91 | ) |
||
| 92 | ), |
||
| 93 | 'enable-privacy-consent' => new EE_Form_Section_Proper( |
||
| 94 | array( |
||
| 95 | 'subsections' => array( |
||
| 96 | 'consent_assertion' => new EE_Text_Area_Input( |
||
| 97 | array( |
||
| 98 | 'default' => $reg_config->getConsentCheckboxLabelText(), |
||
| 99 | 'html_label_text' => esc_html__('Consent Text', 'event_espresso'), |
||
| 100 | 'html_help_text' => esc_html__( |
||
| 101 | 'Text describing what the registrant is consenting to by submitting their personal data in the registration form. To reset to default value, remove all this text and save.', |
||
| 102 | 'event_espresso' |
||
| 103 | ), |
||
| 104 | 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
||
| 105 | ) |
||
| 106 | ), |
||
| 107 | ), |
||
| 108 | ) |
||
| 109 | ), |
||
| 110 | ), |
||
| 111 | ) |
||
| 112 | ); |
||
| 113 | } |
||
| 114 | |||
| 140 |