| Conditions | 1 |
| Paths | 1 |
| Total Lines | 66 |
| Code Lines | 52 |
| 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 if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
||
| 72 | protected function __construct( $timezone = NULL ) { |
||
| 73 | $this->singular_item = __('Question','event_espresso'); |
||
| 74 | $this->plural_item = __('Questions','event_espresso'); |
||
| 75 | $this->_allowed_question_types=apply_filters( |
||
| 76 | 'FHEE__EEM_Question__construct__allowed_question_types', |
||
| 77 | array( |
||
| 78 | EEM_Question::QST_type_text =>__('Text','event_espresso'), |
||
| 79 | EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
||
| 80 | EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
||
| 81 | EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
||
| 82 | EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
||
| 83 | EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
||
| 84 | EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
||
| 85 | EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
||
| 86 | EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
||
| 87 | ) |
||
| 88 | ); |
||
| 89 | $this->_question_type_categories = apply_filters( |
||
| 90 | 'FHEE__EEM_Question__construct__question_type_categories', |
||
| 91 | array( |
||
| 92 | 'text' => array( |
||
| 93 | self::QST_type_text, |
||
| 94 | self::QST_type_textarea, |
||
| 95 | self::QST_type_html_textarea, |
||
| 96 | ), |
||
| 97 | 'single-answer-enum' => array( |
||
| 98 | self::QST_type_radio, |
||
| 99 | self::QST_type_dropdown |
||
| 100 | ), |
||
| 101 | ) |
||
| 102 | ); |
||
| 103 | |||
| 104 | $this->_tables = array( |
||
|
|
|||
| 105 | 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
||
| 106 | ); |
||
| 107 | $this->_fields = array( |
||
| 108 | 'Question'=>array( |
||
| 109 | 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
||
| 110 | 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
||
|
1 ignored issue
–
show
|
|||
| 111 | 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''), |
||
|
1 ignored issue
–
show
|
|||
| 112 | 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ), |
||
| 113 | 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
||
| 114 | 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
||
|
1 ignored issue
–
show
|
|||
| 115 | 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
||
|
1 ignored issue
–
show
|
|||
| 116 | 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
||
| 117 | 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
||
|
1 ignored issue
–
show
|
|||
| 118 | 'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso' ), false, EE_INF ), |
||
| 119 | 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
||
| 120 | 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
||
| 121 | ) |
||
| 122 | ); |
||
| 123 | $this->_model_relations = array( |
||
| 124 | 'Question_Group'=>new EE_HABTM_Relation('Question_Group_Question'), |
||
| 125 | 'Question_Option'=>new EE_Has_Many_Relation(), |
||
| 126 | 'Answer'=>new EE_Has_Many_Relation(), |
||
| 127 | 'WP_User' => new EE_Belongs_To_Relation(), |
||
| 128 | //for QST_order column |
||
| 129 | 'Question_Group_Question'=>new EE_Has_Many_Relation() |
||
| 130 | ); |
||
| 131 | //this model is generally available for reading |
||
| 132 | $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
||
| 133 | $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
||
| 134 | $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
||
| 135 | $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
||
| 136 | parent::__construct( $timezone ); |
||
| 137 | } |
||
| 138 | |||
| 307 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..