| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 160 | 
| Code Lines | 129 | 
| 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  | 
            ||
| 137 | protected function __construct($timezone = null)  | 
            ||
| 138 |     { | 
            ||
| 139 |         $this->singular_item = esc_html__('Attendee', 'event_espresso'); | 
            ||
| 140 |         $this->plural_item = esc_html__('Attendees', 'event_espresso'); | 
            ||
| 141 | $this->_tables = array(  | 
            ||
| 142 |             'Attendee_CPT'  => new EE_Primary_Table('posts', 'ID'), | 
            ||
| 143 | 'Attendee_Meta' => new EE_Secondary_Table(  | 
            ||
| 144 | 'esp_attendee_meta',  | 
            ||
| 145 | 'ATTM_ID',  | 
            ||
| 146 | 'ATT_ID'  | 
            ||
| 147 | ),  | 
            ||
| 148 | );  | 
            ||
| 149 | $this->_fields = array(  | 
            ||
| 150 | 'Attendee_CPT' => array(  | 
            ||
| 151 | 'ATT_ID' => new EE_Primary_Key_Int_Field(  | 
            ||
| 152 | 'ID',  | 
            ||
| 153 |                     esc_html__('Attendee ID', 'event_espresso') | 
            ||
| 154 | ),  | 
            ||
| 155 | 'ATT_full_name' => new EE_Plain_Text_Field(  | 
            ||
| 156 | 'post_title',  | 
            ||
| 157 |                     esc_html__('Attendee Full Name', 'event_espresso'), | 
            ||
| 158 | false,  | 
            ||
| 159 |                     esc_html__('Unknown', 'event_espresso') | 
            ||
| 160 | ),  | 
            ||
| 161 | 'ATT_bio' => new EE_Post_Content_Field(  | 
            ||
| 162 | 'post_content',  | 
            ||
| 163 |                     esc_html__('Attendee Biography', 'event_espresso'), | 
            ||
| 164 | false,  | 
            ||
| 165 |                     esc_html__('No Biography Provided', 'event_espresso') | 
            ||
| 166 | ),  | 
            ||
| 167 | 'ATT_slug' => new EE_Slug_Field(  | 
            ||
| 168 | 'post_name',  | 
            ||
| 169 |                     esc_html__('Attendee URL Slug', 'event_espresso'), | 
            ||
| 170 | false  | 
            ||
| 171 | ),  | 
            ||
| 172 | 'ATT_created' => new EE_Datetime_Field(  | 
            ||
| 173 | 'post_date',  | 
            ||
| 174 |                     esc_html__('Time Attendee Created', 'event_espresso'), | 
            ||
| 175 | false,  | 
            ||
| 176 | EE_Datetime_Field::now  | 
            ||
| 177 | ),  | 
            ||
| 178 | 'ATT_short_bio' => new EE_Simple_HTML_Field(  | 
            ||
| 179 | 'post_excerpt',  | 
            ||
| 180 |                     esc_html__('Attendee Short Biography', 'event_espresso'), | 
            ||
| 181 | true,  | 
            ||
| 182 |                     esc_html__('No Biography Provided', 'event_espresso') | 
            ||
| 183 | ),  | 
            ||
| 184 | 'ATT_modified' => new EE_Datetime_Field(  | 
            ||
| 185 | 'post_modified',  | 
            ||
| 186 |                     esc_html__('Time Attendee Last Modified', 'event_espresso'), | 
            ||
| 187 | false,  | 
            ||
| 188 | EE_Datetime_Field::now  | 
            ||
| 189 | ),  | 
            ||
| 190 | 'ATT_author' => new EE_WP_User_Field(  | 
            ||
| 191 | 'post_author',  | 
            ||
| 192 |                     esc_html__('Creator ID of the first Event attended', 'event_espresso'), | 
            ||
| 193 | false  | 
            ||
| 194 | ),  | 
            ||
| 195 | 'ATT_parent' => new EE_DB_Only_Int_Field(  | 
            ||
| 196 | 'post_parent',  | 
            ||
| 197 |                     esc_html__('Parent Attendee (unused)', 'event_espresso'), | 
            ||
| 198 | false,  | 
            ||
| 199 | 0  | 
            ||
| 200 | ),  | 
            ||
| 201 |                 'post_type'     => new EE_WP_Post_Type_Field('espresso_attendees'), | 
            ||
| 202 | 'status' => new EE_WP_Post_Status_Field(  | 
            ||
| 203 | 'post_status',  | 
            ||
| 204 |                     esc_html__('Attendee Status', 'event_espresso'), | 
            ||
| 205 | false,  | 
            ||
| 206 | 'publish'  | 
            ||
| 207 | ),  | 
            ||
| 208 | ),  | 
            ||
| 209 | 'Attendee_Meta' => array(  | 
            ||
| 210 | 'ATTM_ID' => new EE_DB_Only_Int_Field(  | 
            ||
| 211 | 'ATTM_ID',  | 
            ||
| 212 |                     esc_html__('Attendee Meta Row ID', 'event_espresso'), | 
            ||
| 213 | false  | 
            ||
| 214 | ),  | 
            ||
| 215 | 'ATT_ID_fk' => new EE_DB_Only_Int_Field(  | 
            ||
| 216 | 'ATT_ID',  | 
            ||
| 217 |                     esc_html__('Foreign Key to Attendee in Post Table', 'event_espresso'), | 
            ||
| 218 | false  | 
            ||
| 219 | ),  | 
            ||
| 220 | 'ATT_fname' => new EE_Plain_Text_Field(  | 
            ||
| 221 | 'ATT_fname',  | 
            ||
| 222 |                     esc_html__('First Name', 'event_espresso'), | 
            ||
| 223 | true,  | 
            ||
| 224 | ''  | 
            ||
| 225 | ),  | 
            ||
| 226 | 'ATT_lname' => new EE_Plain_Text_Field(  | 
            ||
| 227 |                     'ATT_lname', esc_html__('Last Name', 'event_espresso'), | 
            ||
| 228 | true,  | 
            ||
| 229 | ''  | 
            ||
| 230 | ),  | 
            ||
| 231 | 'ATT_address' => new EE_Plain_Text_Field(  | 
            ||
| 232 | 'ATT_address',  | 
            ||
| 233 |                     esc_html__('Address Part 1', 'event_espresso'), | 
            ||
| 234 | true,  | 
            ||
| 235 | ''  | 
            ||
| 236 | ),  | 
            ||
| 237 | 'ATT_address2' => new EE_Plain_Text_Field(  | 
            ||
| 238 | 'ATT_address2',  | 
            ||
| 239 |                     esc_html__('Address Part 2', 'event_espresso'), | 
            ||
| 240 | true,  | 
            ||
| 241 | ''  | 
            ||
| 242 | ),  | 
            ||
| 243 | 'ATT_city' => new EE_Plain_Text_Field(  | 
            ||
| 244 | 'ATT_city',  | 
            ||
| 245 |                     esc_html__('City', 'event_espresso'), | 
            ||
| 246 | true,  | 
            ||
| 247 | ''  | 
            ||
| 248 | ),  | 
            ||
| 249 | 'STA_ID' => new EE_Foreign_Key_Int_Field(  | 
            ||
| 250 | 'STA_ID',  | 
            ||
| 251 |                     esc_html__('State', 'event_espresso'), | 
            ||
| 252 | true,  | 
            ||
| 253 | 0,  | 
            ||
| 254 | 'State'  | 
            ||
| 255 | ),  | 
            ||
| 256 | 'CNT_ISO' => new EE_Foreign_Key_String_Field(  | 
            ||
| 257 | 'CNT_ISO',  | 
            ||
| 258 |                     esc_html__('Country', 'event_espresso'), | 
            ||
| 259 | true,  | 
            ||
| 260 | '',  | 
            ||
| 261 | 'Country'  | 
            ||
| 262 | ),  | 
            ||
| 263 | 'ATT_zip' => new EE_Plain_Text_Field(  | 
            ||
| 264 | 'ATT_zip',  | 
            ||
| 265 |                     esc_html__('ZIP/Postal Code', 'event_espresso'), | 
            ||
| 266 | true,  | 
            ||
| 267 | ''  | 
            ||
| 268 | ),  | 
            ||
| 269 | 'ATT_email' => new EE_Email_Field(  | 
            ||
| 270 | 'ATT_email',  | 
            ||
| 271 |                     esc_html__('Email Address', 'event_espresso'), | 
            ||
| 272 | true,  | 
            ||
| 273 | ''  | 
            ||
| 274 | ),  | 
            ||
| 275 | 'ATT_phone' => new EE_Plain_Text_Field(  | 
            ||
| 276 | 'ATT_phone',  | 
            ||
| 277 |                     esc_html__('Phone', 'event_espresso'), | 
            ||
| 278 | true,  | 
            ||
| 279 | ''  | 
            ||
| 280 | ),  | 
            ||
| 281 | ),  | 
            ||
| 282 | );  | 
            ||
| 283 | $this->_model_relations = array(  | 
            ||
| 284 | 'Registration' => new EE_Has_Many_Relation(),  | 
            ||
| 285 | 'State' => new EE_Belongs_To_Relation(),  | 
            ||
| 286 | 'Country' => new EE_Belongs_To_Relation(),  | 
            ||
| 287 |             'Event'             => new EE_HABTM_Relation('Registration', false), | 
            ||
| 288 | 'WP_User' => new EE_Belongs_To_Relation(),  | 
            ||
| 289 | 'Message' => new EE_Has_Many_Any_Relation(false),  | 
            ||
| 290 | //allow deletion of attendees even if they have messages in the queue for them.  | 
            ||
| 291 | 'Term_Relationship' => new EE_Has_Many_Relation(),  | 
            ||
| 292 |             'Term_Taxonomy'     => new EE_HABTM_Relation('Term_Relationship'), | 
            ||
| 293 | );  | 
            ||
| 294 | $this->_caps_slug = 'contacts';  | 
            ||
| 295 | parent::__construct($timezone);  | 
            ||
| 296 | }  | 
            ||
| 297 | |||
| 449 |