Completed
Pull Request — develop (#1328)
by Naveen
03:16
created

Vocabulary_Loader   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 19

Importance

Changes 0
Metric Value
dl 0
loc 56
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 19

1 Method

Rating   Name   Duplication   Size   Complexity  
A init_vocabulary() 0 52 1
1
<?php
2
3
namespace Wordlift\Vocabulary;
4
5
use Wordlift\Api\Default_Api_Service;
6
use Wordlift\Api\User_Agent;
7
use Wordlift\Vocabulary\Api\Background_Analysis_Endpoint;
8
use Wordlift\Vocabulary\Api\Entity_Rest_Endpoint;
9
use Wordlift\Vocabulary\Api\Reconcile_Progress_Endpoint;
10
use Wordlift\Vocabulary\Api\Tag_Rest_Endpoint;
11
use Wordlift\Vocabulary\Dashboard\Term_Matches_Widget;
12
use Wordlift\Vocabulary\Data\Term_Count\Cached_Term_count_Manager;
13
use Wordlift\Vocabulary\Data\Term_Count\Term_Count_Factory;
14
use Wordlift\Vocabulary\Data\Term_Data\Term_Data_Factory;
15
use Wordlift\Vocabulary\Hooks\Tag_Created_Hook;
16
use Wordlift\Vocabulary\Hooks\Term_Page_Hook;
17
use Wordlift\Vocabulary\Jsonld\Post_Jsonld;
18
use Wordlift\Vocabulary\Pages\Match_Terms;
19
use Wordlift\Vocabulary\Tabs\Settings_Tab;
20
21
class Vocabulary_Loader {
22
23
	public function init_vocabulary() {
24
25
		$configuration_service = \Wordlift_Configuration_Service::get_instance();
26
27
		$api_service = new Default_Api_Service(
28
			apply_filters( 'wl_api_base_url', 'https://api.wordlift.io' ),
29
			60,
30
			User_Agent::get_user_agent(),
31
			$configuration_service->get_key()
32
		);
33
34
		$cache_service    = new Options_Cache( "wordlift-cmkg" );
35
		$analysis_service = new Analysis_Service( $api_service, $cache_service );
36
37
		$term_data_factory = new Term_Data_Factory( $analysis_service );
38
39
		$tag_rest_endpoint = new Tag_Rest_Endpoint( $term_data_factory );
40
		$tag_rest_endpoint->register_routes();
41
42
		$entity_rest_endpoint = new Entity_Rest_Endpoint();
43
		$entity_rest_endpoint->register_routes();
44
45
		$post_jsonld = new Post_Jsonld();
46
		$post_jsonld->enhance_post_jsonld();
47
48
		$term_count = Term_Count_Factory::get_instance( Term_Count_Factory::CACHED_TERM_COUNT );
49
		new Match_Terms( $term_count );
50
51
		$analysis_background_service = new Analysis_Background_Service( $analysis_service );
52
53
54
		new Tag_Created_Hook( $analysis_background_service );
55
56
		new Background_Analysis_Endpoint( $analysis_background_service, $cache_service );
57
58
		$reconcile_progress_endpoint = new Reconcile_Progress_Endpoint();
59
		$reconcile_progress_endpoint->register_routes();
60
61
62
		$term_page_hook = new Term_Page_Hook( $term_data_factory );
63
		$term_page_hook->connect_hook();
64
65
		$dashboard_widget = new Term_Matches_Widget( $term_count );
66
		$dashboard_widget->connect_hook();
67
68
		$cached_term_count_manager = new Cached_Term_count_Manager();
69
		$cached_term_count_manager->connect_hook();
70
71
		$settings_tab = new Settings_Tab();
72
		$settings_tab->connect_hook();
73
74
	}
75
76
}
77
78
79