| Conditions | 1 |
| Paths | 1 |
| Total Lines | 125 |
| Code Lines | 31 |
| 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 |
||
| 161 | private function load_dependencies() { |
||
| 162 | |||
| 163 | /** |
||
| 164 | * The class responsible for orchestrating the actions and filters of the |
||
| 165 | * core plugin. |
||
| 166 | */ |
||
| 167 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
||
| 168 | |||
| 169 | /** |
||
| 170 | * The class responsible for defining internationalization functionality |
||
| 171 | * of the plugin. |
||
| 172 | */ |
||
| 173 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
||
| 174 | |||
| 175 | /** |
||
| 176 | * The Log service. |
||
| 177 | */ |
||
| 178 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
||
| 179 | |||
| 180 | /** |
||
| 181 | * The Query builder. |
||
| 182 | */ |
||
| 183 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
||
| 184 | |||
| 185 | /** |
||
| 186 | * The Schema service. |
||
| 187 | */ |
||
| 188 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
||
| 189 | |||
| 190 | /** |
||
| 191 | * The UI service. |
||
| 192 | */ |
||
| 193 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
||
| 194 | |||
| 195 | /** |
||
| 196 | * The Thumbnail service. |
||
| 197 | */ |
||
| 198 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
||
| 199 | |||
| 200 | /** |
||
| 201 | * The Entity Types Taxonomy service. |
||
| 202 | */ |
||
| 203 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
||
| 204 | |||
| 205 | /** |
||
| 206 | * The Entity service. |
||
| 207 | */ |
||
| 208 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
||
| 209 | |||
| 210 | /** |
||
| 211 | * The User service. |
||
| 212 | */ |
||
| 213 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
||
| 214 | |||
| 215 | /** |
||
| 216 | * The Timeline service. |
||
| 217 | */ |
||
| 218 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
||
| 219 | |||
| 220 | /** |
||
| 221 | * The class responsible for defining all actions that occur in the admin area. |
||
| 222 | */ |
||
| 223 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
||
| 224 | |||
| 225 | /** |
||
| 226 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
||
| 227 | */ |
||
| 228 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
||
| 229 | |||
| 230 | /** |
||
| 231 | * The Notice service. |
||
| 232 | */ |
||
| 233 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
||
| 234 | |||
| 235 | /** |
||
| 236 | * The class responsible for defining all actions that occur in the public-facing |
||
| 237 | * side of the site. |
||
| 238 | */ |
||
| 239 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
||
| 240 | |||
| 241 | /** |
||
| 242 | * The Timeline shortcode. |
||
| 243 | */ |
||
| 244 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
||
| 245 | |||
| 246 | /** |
||
| 247 | * The ShareThis service. |
||
| 248 | */ |
||
| 249 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
||
| 250 | |||
| 251 | $this->loader = new Wordlift_Loader(); |
||
| 252 | |||
| 253 | // Instantiate a global logger. |
||
| 254 | global $wl_logger; |
||
|
|
|||
| 255 | $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
||
| 256 | |||
| 257 | // Create an instance of the UI service. |
||
| 258 | $this->ui_service = new Wordlift_UI_Service(); |
||
| 259 | |||
| 260 | // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
||
| 261 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
||
| 262 | |||
| 263 | // Create an instance of the Schema service. |
||
| 264 | new Wordlift_Schema_Service(); |
||
| 265 | |||
| 266 | // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
||
| 267 | $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
||
| 268 | |||
| 269 | // Create an instance of the User service. |
||
| 270 | $this->user_service = new Wordlift_User_Service(); |
||
| 271 | |||
| 272 | // Create a new instance of the Timeline service and Timeline shortcode. |
||
| 273 | $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
||
| 274 | |||
| 275 | // Create an instance of the Timeline shortcode. |
||
| 276 | new Wordlift_Timeline_Shortcode(); |
||
| 277 | |||
| 278 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
||
| 279 | |||
| 280 | // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
||
| 281 | $this->sharethis_service = new Wordlift_ShareThis_Service(); |
||
| 282 | |||
| 283 | // Create an instance of the Notice service. |
||
| 284 | new Wordlift_Notice_Service(); |
||
| 285 | } |
||
| 286 | |||
| 403 |
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state