| Conditions | 1 |
| Paths | 1 |
| Total Lines | 57 |
| 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 |
||
| 25 | public function init_vocabulary() { |
||
| 26 | |||
| 27 | $configuration_service = \Wordlift_Configuration_Service::get_instance(); |
||
| 28 | |||
| 29 | $api_service = new Default_Api_Service( |
||
| 30 | apply_filters( 'wl_api_base_url', 'https://api.wordlift.io' ), |
||
| 31 | 60, |
||
| 32 | User_Agent::get_user_agent(), |
||
| 33 | $configuration_service->get_key() |
||
| 34 | ); |
||
| 35 | |||
| 36 | $cache_service = Cache_Service_Factory::get_cache_service(); |
||
| 37 | |||
| 38 | |||
| 39 | $analysis_service = new Analysis_Service( $api_service, $cache_service ); |
||
| 40 | |||
| 41 | $term_data_factory = new Term_Data_Factory( $analysis_service ); |
||
| 42 | |||
| 43 | $tag_rest_endpoint = new Tag_Rest_Endpoint( $term_data_factory ); |
||
| 44 | $tag_rest_endpoint->register_routes(); |
||
| 45 | |||
| 46 | $entity_rest_endpoint = new Entity_Rest_Endpoint(); |
||
| 47 | $entity_rest_endpoint->register_routes(); |
||
| 48 | |||
| 49 | $post_jsonld = new Post_Jsonld(); |
||
| 50 | $post_jsonld->enhance_post_jsonld(); |
||
| 51 | |||
| 52 | $term_jsonld = new Term_Jsonld(); |
||
| 53 | $term_jsonld->init(); |
||
| 54 | |||
| 55 | $term_count = Term_Count_Factory::get_instance( Term_Count_Factory::CACHED_TERM_COUNT ); |
||
| 56 | new Match_Terms( $term_count ); |
||
| 57 | |||
| 58 | $analysis_background_service = new Analysis_Background_Service( $analysis_service ); |
||
| 59 | |||
| 60 | |||
| 61 | new Tag_Created_Hook( $analysis_background_service ); |
||
| 62 | |||
| 63 | new Background_Analysis_Endpoint( $analysis_background_service, $cache_service ); |
||
| 64 | |||
| 65 | $reconcile_progress_endpoint = new Reconcile_Progress_Endpoint(); |
||
| 66 | $reconcile_progress_endpoint->register_routes(); |
||
| 67 | |||
| 68 | |||
| 69 | $term_page_hook = new Term_Page_Hook( $term_data_factory ); |
||
| 70 | $term_page_hook->connect_hook(); |
||
| 71 | |||
| 72 | $dashboard_widget = new Term_Matches_Widget( $term_count ); |
||
| 73 | $dashboard_widget->connect_hook(); |
||
| 74 | |||
| 75 | $cached_term_count_manager = new Cached_Term_count_Manager(); |
||
| 76 | $cached_term_count_manager->connect_hook(); |
||
| 77 | |||
| 78 | $settings_tab = new Settings_Tab(); |
||
| 79 | $settings_tab->connect_hook(); |
||
| 80 | |||
| 81 | } |
||
| 82 | |||
| 86 |