Completed
Pull Request — develop (#1328)
by Naveen
03:11
created
src/wordlift/vocabulary/api/class-api-config.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,19 +8,19 @@
 block discarded – undo
8 8
  */
9 9
 class Api_Config {
10 10
 
11
-	const REST_NAMESPACE = '/cafemediakg/v1';
11
+    const REST_NAMESPACE = '/cafemediakg/v1';
12 12
 
13
-	public static function get_api_config() {
14
-		// Create ui settings array to be used by js client.
15
-		$settings            = array();
16
-		$settings['restUrl'] = get_rest_url(
17
-			null,
18
-			Api_Config::REST_NAMESPACE . '/tags'
19
-		);
20
-		$settings['baseUrl'] = get_rest_url( null, Api_Config::REST_NAMESPACE );
21
-		$settings['nonce']   = wp_create_nonce( 'wp_rest' );
13
+    public static function get_api_config() {
14
+        // Create ui settings array to be used by js client.
15
+        $settings            = array();
16
+        $settings['restUrl'] = get_rest_url(
17
+            null,
18
+            Api_Config::REST_NAMESPACE . '/tags'
19
+        );
20
+        $settings['baseUrl'] = get_rest_url( null, Api_Config::REST_NAMESPACE );
21
+        $settings['nonce']   = wp_create_nonce( 'wp_rest' );
22 22
 
23
-		return $settings;
24
-	}
23
+        return $settings;
24
+    }
25 25
 
26 26
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@
 block discarded – undo
15 15
 		$settings            = array();
16 16
 		$settings['restUrl'] = get_rest_url(
17 17
 			null,
18
-			Api_Config::REST_NAMESPACE . '/tags'
18
+			Api_Config::REST_NAMESPACE.'/tags'
19 19
 		);
20
-		$settings['baseUrl'] = get_rest_url( null, Api_Config::REST_NAMESPACE );
21
-		$settings['nonce']   = wp_create_nonce( 'wp_rest' );
20
+		$settings['baseUrl'] = get_rest_url(null, Api_Config::REST_NAMESPACE);
21
+		$settings['nonce']   = wp_create_nonce('wp_rest');
22 22
 
23 23
 		return $settings;
24 24
 	}
Please login to merge, or discard this patch.
src/wordlift/vocabulary/api/class-entity-rest-endpoint.php 2 patches
Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -14,155 +14,155 @@
 block discarded – undo
14 14
  */
15 15
 class Entity_Rest_Endpoint {
16 16
 
17
-	const SAME_AS_META_KEY = 'entity_same_as';
18
-	const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
19
-	const DESCRIPTION_META_KEY = 'entity_description';
20
-	const TYPE_META_KEY = 'entity_type';
21
-	const EXTERNAL_ENTITY_META_KEY = '_wl_is_external';
22
-	const IGNORE_TAG_FROM_LISTING = '_wl_cmkg_ignore_tag_from_ui';
23
-
24
-
25
-	public function register_routes() {
26
-		$that = $this;
27
-		add_action( 'rest_api_init',
28
-			function () use ( $that ) {
29
-				$that->register_accept_route();
30
-				$that->register_undo_route();
31
-				$that->register_nomatch_route();
32
-			} );
33
-	}
34
-
35
-
36
-	public function accept_entity( $request ) {
37
-		$data        = $request->get_params();
38
-		$term_id     = (int) $data['term_id'];
39
-		$entity_data = (array) $data['entity'];
40
-
41
-
42
-		$same_as_list = array_merge( $entity_data['sameAs'], array( $entity_data['@id'] ) );
43
-
44
-		// Insert Same As
45
-		delete_term_meta( $term_id, self::SAME_AS_META_KEY );
46
-		foreach ( $same_as_list as $same_as ) {
47
-			add_term_meta( $term_id, self::SAME_AS_META_KEY, $same_as );
48
-		}
49
-
50
-		// Insert Alt labels
51
-		$alt_labels = array( (string) $entity_data['name'] );
52
-		delete_term_meta( $term_id, self::ALTERNATIVE_LABEL_META_KEY );
53
-		foreach ( $alt_labels as $alt_label ) {
54
-			add_term_meta( $term_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
55
-		}
56
-
57
-		// Insert description and type
58
-		add_term_meta( $term_id, self::DESCRIPTION_META_KEY, $entity_data['description'], true );
59
-		add_term_meta( $term_id, self::TYPE_META_KEY, $entity_data['@type'], true );
60
-
61
-		// Mark as external
62
-		add_term_meta( $term_id, $this::EXTERNAL_ENTITY_META_KEY, 1, true );
63
-
64
-		// Mark as ignored from ui
65
-		update_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING, 1 );
66
-
67
-		return $term_id;
68
-	}
69
-
70
-	public function undo( $request ) {
71
-		$data    = $request->get_params();
72
-		$term_id = (int) $data['term_id'];
73
-		// Insert Same As
74
-		delete_term_meta( $term_id, self::SAME_AS_META_KEY );
75
-		delete_term_meta( $term_id, self::ALTERNATIVE_LABEL_META_KEY );
76
-		delete_term_meta( $term_id, self::DESCRIPTION_META_KEY );
77
-		delete_term_meta( $term_id, self::TYPE_META_KEY );
78
-		delete_term_meta( $term_id, self::EXTERNAL_ENTITY_META_KEY );
79
-		delete_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING );
80
-
81
-		return $term_id;
82
-	}
83
-
84
-
85
-	public function mark_as_no_match( $request ) {
86
-		$data    = $request->get_params();
87
-		$term_id = (int) $data['term_id'];
88
-
89
-		return add_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING, 1 );
90
-	}
91
-
92
-
93
-	private function register_undo_route() {
94
-		register_rest_route(
95
-			Api_Config::REST_NAMESPACE,
96
-			'/entity/undo',
97
-			array(
98
-				'methods'             => WP_REST_Server::CREATABLE,
99
-				'callback'            => array( $this, 'undo' ),
100
-				//@todo : review the permission level
101
-				'permission_callback' => function () {
102
-					return current_user_can( 'manage_options' );
103
-				},
104
-				'args'                => array(
105
-					'term_id' => array(
106
-						'validate_callback' => function ( $param, $request, $key ) {
107
-							return is_numeric( $param ) && $param;
108
-						},
109
-						'required'          => true,
110
-					),
111
-				),
112
-			)
113
-		);
114
-	}
115
-
116
-	private function register_accept_route() {
117
-		register_rest_route(
118
-			Api_Config::REST_NAMESPACE,
119
-			'/entity/accept',
120
-			array(
121
-				'methods'             => WP_REST_Server::CREATABLE,
122
-				'callback'            => array( $this, 'accept_entity' ),
123
-				//@todo : review the permission level
124
-				'permission_callback' => function () {
125
-					return current_user_can( 'manage_options' );
126
-				},
127
-				'args'                => array(
128
-					'term_id' => array(
129
-						'validate_callback' => function ( $param, $request, $key ) {
130
-							return is_numeric( $param ) && $param;
131
-						},
132
-						'required'          => true,
133
-					),
134
-					'entity'  => array(
135
-						'validate_callback' => function ( $param, $request, $key ) {
136
-							return is_array( $param );
137
-						},
138
-						'required'          => true,
139
-					),
140
-				),
141
-			)
142
-		);
143
-	}
144
-
145
-	private function register_nomatch_route() {
146
-		register_rest_route(
147
-			Api_Config::REST_NAMESPACE,
148
-			'/entity/no_match',
149
-			array(
150
-				'methods'             => WP_REST_Server::CREATABLE,
151
-				'callback'            => array( $this, 'mark_as_no_match' ),
152
-				//@todo : review the permission level
153
-				'permission_callback' => function () {
154
-					return current_user_can( 'manage_options' );
155
-				},
156
-				'args'                => array(
157
-					'term_id' => array(
158
-						'validate_callback' => function ( $param, $request, $key ) {
159
-							return is_numeric( $param ) && $param;
160
-						},
161
-						'required'          => true,
162
-					),
163
-				),
164
-			)
165
-		);
166
-	}
17
+    const SAME_AS_META_KEY = 'entity_same_as';
18
+    const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
19
+    const DESCRIPTION_META_KEY = 'entity_description';
20
+    const TYPE_META_KEY = 'entity_type';
21
+    const EXTERNAL_ENTITY_META_KEY = '_wl_is_external';
22
+    const IGNORE_TAG_FROM_LISTING = '_wl_cmkg_ignore_tag_from_ui';
23
+
24
+
25
+    public function register_routes() {
26
+        $that = $this;
27
+        add_action( 'rest_api_init',
28
+            function () use ( $that ) {
29
+                $that->register_accept_route();
30
+                $that->register_undo_route();
31
+                $that->register_nomatch_route();
32
+            } );
33
+    }
34
+
35
+
36
+    public function accept_entity( $request ) {
37
+        $data        = $request->get_params();
38
+        $term_id     = (int) $data['term_id'];
39
+        $entity_data = (array) $data['entity'];
40
+
41
+
42
+        $same_as_list = array_merge( $entity_data['sameAs'], array( $entity_data['@id'] ) );
43
+
44
+        // Insert Same As
45
+        delete_term_meta( $term_id, self::SAME_AS_META_KEY );
46
+        foreach ( $same_as_list as $same_as ) {
47
+            add_term_meta( $term_id, self::SAME_AS_META_KEY, $same_as );
48
+        }
49
+
50
+        // Insert Alt labels
51
+        $alt_labels = array( (string) $entity_data['name'] );
52
+        delete_term_meta( $term_id, self::ALTERNATIVE_LABEL_META_KEY );
53
+        foreach ( $alt_labels as $alt_label ) {
54
+            add_term_meta( $term_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
55
+        }
56
+
57
+        // Insert description and type
58
+        add_term_meta( $term_id, self::DESCRIPTION_META_KEY, $entity_data['description'], true );
59
+        add_term_meta( $term_id, self::TYPE_META_KEY, $entity_data['@type'], true );
60
+
61
+        // Mark as external
62
+        add_term_meta( $term_id, $this::EXTERNAL_ENTITY_META_KEY, 1, true );
63
+
64
+        // Mark as ignored from ui
65
+        update_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING, 1 );
66
+
67
+        return $term_id;
68
+    }
69
+
70
+    public function undo( $request ) {
71
+        $data    = $request->get_params();
72
+        $term_id = (int) $data['term_id'];
73
+        // Insert Same As
74
+        delete_term_meta( $term_id, self::SAME_AS_META_KEY );
75
+        delete_term_meta( $term_id, self::ALTERNATIVE_LABEL_META_KEY );
76
+        delete_term_meta( $term_id, self::DESCRIPTION_META_KEY );
77
+        delete_term_meta( $term_id, self::TYPE_META_KEY );
78
+        delete_term_meta( $term_id, self::EXTERNAL_ENTITY_META_KEY );
79
+        delete_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING );
80
+
81
+        return $term_id;
82
+    }
83
+
84
+
85
+    public function mark_as_no_match( $request ) {
86
+        $data    = $request->get_params();
87
+        $term_id = (int) $data['term_id'];
88
+
89
+        return add_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING, 1 );
90
+    }
91
+
92
+
93
+    private function register_undo_route() {
94
+        register_rest_route(
95
+            Api_Config::REST_NAMESPACE,
96
+            '/entity/undo',
97
+            array(
98
+                'methods'             => WP_REST_Server::CREATABLE,
99
+                'callback'            => array( $this, 'undo' ),
100
+                //@todo : review the permission level
101
+                'permission_callback' => function () {
102
+                    return current_user_can( 'manage_options' );
103
+                },
104
+                'args'                => array(
105
+                    'term_id' => array(
106
+                        'validate_callback' => function ( $param, $request, $key ) {
107
+                            return is_numeric( $param ) && $param;
108
+                        },
109
+                        'required'          => true,
110
+                    ),
111
+                ),
112
+            )
113
+        );
114
+    }
115
+
116
+    private function register_accept_route() {
117
+        register_rest_route(
118
+            Api_Config::REST_NAMESPACE,
119
+            '/entity/accept',
120
+            array(
121
+                'methods'             => WP_REST_Server::CREATABLE,
122
+                'callback'            => array( $this, 'accept_entity' ),
123
+                //@todo : review the permission level
124
+                'permission_callback' => function () {
125
+                    return current_user_can( 'manage_options' );
126
+                },
127
+                'args'                => array(
128
+                    'term_id' => array(
129
+                        'validate_callback' => function ( $param, $request, $key ) {
130
+                            return is_numeric( $param ) && $param;
131
+                        },
132
+                        'required'          => true,
133
+                    ),
134
+                    'entity'  => array(
135
+                        'validate_callback' => function ( $param, $request, $key ) {
136
+                            return is_array( $param );
137
+                        },
138
+                        'required'          => true,
139
+                    ),
140
+                ),
141
+            )
142
+        );
143
+    }
144
+
145
+    private function register_nomatch_route() {
146
+        register_rest_route(
147
+            Api_Config::REST_NAMESPACE,
148
+            '/entity/no_match',
149
+            array(
150
+                'methods'             => WP_REST_Server::CREATABLE,
151
+                'callback'            => array( $this, 'mark_as_no_match' ),
152
+                //@todo : review the permission level
153
+                'permission_callback' => function () {
154
+                    return current_user_can( 'manage_options' );
155
+                },
156
+                'args'                => array(
157
+                    'term_id' => array(
158
+                        'validate_callback' => function ( $param, $request, $key ) {
159
+                            return is_numeric( $param ) && $param;
160
+                        },
161
+                        'required'          => true,
162
+                    ),
163
+                ),
164
+            )
165
+        );
166
+    }
167 167
 
168 168
 }
169 169
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 
25 25
 	public function register_routes() {
26 26
 		$that = $this;
27
-		add_action( 'rest_api_init',
28
-			function () use ( $that ) {
27
+		add_action('rest_api_init',
28
+			function() use ($that) {
29 29
 				$that->register_accept_route();
30 30
 				$that->register_undo_route();
31 31
 				$that->register_nomatch_route();
@@ -33,60 +33,60 @@  discard block
 block discarded – undo
33 33
 	}
34 34
 
35 35
 
36
-	public function accept_entity( $request ) {
36
+	public function accept_entity($request) {
37 37
 		$data        = $request->get_params();
38 38
 		$term_id     = (int) $data['term_id'];
39 39
 		$entity_data = (array) $data['entity'];
40 40
 
41 41
 
42
-		$same_as_list = array_merge( $entity_data['sameAs'], array( $entity_data['@id'] ) );
42
+		$same_as_list = array_merge($entity_data['sameAs'], array($entity_data['@id']));
43 43
 
44 44
 		// Insert Same As
45
-		delete_term_meta( $term_id, self::SAME_AS_META_KEY );
46
-		foreach ( $same_as_list as $same_as ) {
47
-			add_term_meta( $term_id, self::SAME_AS_META_KEY, $same_as );
45
+		delete_term_meta($term_id, self::SAME_AS_META_KEY);
46
+		foreach ($same_as_list as $same_as) {
47
+			add_term_meta($term_id, self::SAME_AS_META_KEY, $same_as);
48 48
 		}
49 49
 
50 50
 		// Insert Alt labels
51
-		$alt_labels = array( (string) $entity_data['name'] );
52
-		delete_term_meta( $term_id, self::ALTERNATIVE_LABEL_META_KEY );
53
-		foreach ( $alt_labels as $alt_label ) {
54
-			add_term_meta( $term_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
51
+		$alt_labels = array((string) $entity_data['name']);
52
+		delete_term_meta($term_id, self::ALTERNATIVE_LABEL_META_KEY);
53
+		foreach ($alt_labels as $alt_label) {
54
+			add_term_meta($term_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label);
55 55
 		}
56 56
 
57 57
 		// Insert description and type
58
-		add_term_meta( $term_id, self::DESCRIPTION_META_KEY, $entity_data['description'], true );
59
-		add_term_meta( $term_id, self::TYPE_META_KEY, $entity_data['@type'], true );
58
+		add_term_meta($term_id, self::DESCRIPTION_META_KEY, $entity_data['description'], true);
59
+		add_term_meta($term_id, self::TYPE_META_KEY, $entity_data['@type'], true);
60 60
 
61 61
 		// Mark as external
62
-		add_term_meta( $term_id, $this::EXTERNAL_ENTITY_META_KEY, 1, true );
62
+		add_term_meta($term_id, $this::EXTERNAL_ENTITY_META_KEY, 1, true);
63 63
 
64 64
 		// Mark as ignored from ui
65
-		update_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING, 1 );
65
+		update_term_meta($term_id, self::IGNORE_TAG_FROM_LISTING, 1);
66 66
 
67 67
 		return $term_id;
68 68
 	}
69 69
 
70
-	public function undo( $request ) {
70
+	public function undo($request) {
71 71
 		$data    = $request->get_params();
72 72
 		$term_id = (int) $data['term_id'];
73 73
 		// Insert Same As
74
-		delete_term_meta( $term_id, self::SAME_AS_META_KEY );
75
-		delete_term_meta( $term_id, self::ALTERNATIVE_LABEL_META_KEY );
76
-		delete_term_meta( $term_id, self::DESCRIPTION_META_KEY );
77
-		delete_term_meta( $term_id, self::TYPE_META_KEY );
78
-		delete_term_meta( $term_id, self::EXTERNAL_ENTITY_META_KEY );
79
-		delete_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING );
74
+		delete_term_meta($term_id, self::SAME_AS_META_KEY);
75
+		delete_term_meta($term_id, self::ALTERNATIVE_LABEL_META_KEY);
76
+		delete_term_meta($term_id, self::DESCRIPTION_META_KEY);
77
+		delete_term_meta($term_id, self::TYPE_META_KEY);
78
+		delete_term_meta($term_id, self::EXTERNAL_ENTITY_META_KEY);
79
+		delete_term_meta($term_id, self::IGNORE_TAG_FROM_LISTING);
80 80
 
81 81
 		return $term_id;
82 82
 	}
83 83
 
84 84
 
85
-	public function mark_as_no_match( $request ) {
85
+	public function mark_as_no_match($request) {
86 86
 		$data    = $request->get_params();
87 87
 		$term_id = (int) $data['term_id'];
88 88
 
89
-		return add_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING, 1 );
89
+		return add_term_meta($term_id, self::IGNORE_TAG_FROM_LISTING, 1);
90 90
 	}
91 91
 
92 92
 
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
 			'/entity/undo',
97 97
 			array(
98 98
 				'methods'             => WP_REST_Server::CREATABLE,
99
-				'callback'            => array( $this, 'undo' ),
99
+				'callback'            => array($this, 'undo'),
100 100
 				//@todo : review the permission level
101
-				'permission_callback' => function () {
102
-					return current_user_can( 'manage_options' );
101
+				'permission_callback' => function() {
102
+					return current_user_can('manage_options');
103 103
 				},
104 104
 				'args'                => array(
105 105
 					'term_id' => array(
106
-						'validate_callback' => function ( $param, $request, $key ) {
107
-							return is_numeric( $param ) && $param;
106
+						'validate_callback' => function($param, $request, $key) {
107
+							return is_numeric($param) && $param;
108 108
 						},
109 109
 						'required'          => true,
110 110
 					),
@@ -119,21 +119,21 @@  discard block
 block discarded – undo
119 119
 			'/entity/accept',
120 120
 			array(
121 121
 				'methods'             => WP_REST_Server::CREATABLE,
122
-				'callback'            => array( $this, 'accept_entity' ),
122
+				'callback'            => array($this, 'accept_entity'),
123 123
 				//@todo : review the permission level
124
-				'permission_callback' => function () {
125
-					return current_user_can( 'manage_options' );
124
+				'permission_callback' => function() {
125
+					return current_user_can('manage_options');
126 126
 				},
127 127
 				'args'                => array(
128 128
 					'term_id' => array(
129
-						'validate_callback' => function ( $param, $request, $key ) {
130
-							return is_numeric( $param ) && $param;
129
+						'validate_callback' => function($param, $request, $key) {
130
+							return is_numeric($param) && $param;
131 131
 						},
132 132
 						'required'          => true,
133 133
 					),
134 134
 					'entity'  => array(
135
-						'validate_callback' => function ( $param, $request, $key ) {
136
-							return is_array( $param );
135
+						'validate_callback' => function($param, $request, $key) {
136
+							return is_array($param);
137 137
 						},
138 138
 						'required'          => true,
139 139
 					),
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 			'/entity/no_match',
149 149
 			array(
150 150
 				'methods'             => WP_REST_Server::CREATABLE,
151
-				'callback'            => array( $this, 'mark_as_no_match' ),
151
+				'callback'            => array($this, 'mark_as_no_match'),
152 152
 				//@todo : review the permission level
153
-				'permission_callback' => function () {
154
-					return current_user_can( 'manage_options' );
153
+				'permission_callback' => function() {
154
+					return current_user_can('manage_options');
155 155
 				},
156 156
 				'args'                => array(
157 157
 					'term_id' => array(
158
-						'validate_callback' => function ( $param, $request, $key ) {
159
-							return is_numeric( $param ) && $param;
158
+						'validate_callback' => function($param, $request, $key) {
159
+							return is_numeric($param) && $param;
160 160
 						},
161 161
 						'required'          => true,
162 162
 					),
Please login to merge, or discard this patch.
src/wordlift/vocabulary/api/class-background-analysis-endpoint.php 2 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -14,132 +14,132 @@
 block discarded – undo
14 14
 
15 15
 class Background_Analysis_Endpoint {
16 16
 
17
-	/**
18
-	 * @var Analysis_Background_Service
19
-	 */
20
-	private $background_service;
21
-	/**
22
-	 * @var Options_Cache
23
-	 */
24
-	private $cache_service;
25
-
26
-	public function __construct( $background_service, $cache_service ) {
27
-		$this->background_service = $background_service;
28
-		$this->cache_service = $cache_service;
29
-		$this->register_routes();
30
-	}
31
-
32
-	public function register_routes() {
33
-		$that = $this;
34
-		add_action( 'rest_api_init',
35
-			function () use ( $that ) {
36
-				$that->register_start_route();
37
-				$that->register_stop_route();
38
-				$that->register_stats_route();
39
-				$that->register_restart_route();
40
-			} );
41
-	}
42
-
43
-	private function register_start_route() {
44
-		register_rest_route(
45
-			Api_Config::REST_NAMESPACE,
46
-			'/background_analysis/start',
47
-			array(
48
-				'methods'             => WP_REST_Server::CREATABLE,
49
-				'callback'            => array( $this, 'start' ),
50
-				'permission_callback' => function () {
51
-					return current_user_can( 'manage_options' );
52
-				},
53
-			)
54
-		);
55
-	}
56
-
57
-	private function register_stop_route() {
58
-		register_rest_route(
59
-			Api_Config::REST_NAMESPACE,
60
-			'/background_analysis/stop',
61
-			array(
62
-				'methods'             => WP_REST_Server::CREATABLE,
63
-				'callback'            => array( $this, 'stop' ),
64
-				'permission_callback' => function () {
65
-					return current_user_can( 'manage_options' );
66
-				},
67
-			)
68
-		);
69
-	}
70
-
71
-	private function register_stats_route() {
72
-		register_rest_route(
73
-			Api_Config::REST_NAMESPACE,
74
-			'/background_analysis/stats',
75
-			array(
76
-				'methods'             => WP_REST_Server::CREATABLE,
77
-				'callback'            => array( $this, 'get_stats' ),
78
-				'permission_callback' => function () {
79
-					return current_user_can( 'manage_options' );
80
-				},
81
-			)
82
-		);
83
-	}
84
-
85
-
86
-	private function register_restart_route() {
87
-		register_rest_route(
88
-			Api_Config::REST_NAMESPACE,
89
-			'/background_analysis/restart',
90
-			array(
91
-				'methods'             => WP_REST_Server::CREATABLE,
92
-				'callback'            => array( $this, 'restart' ),
93
-				'permission_callback' => function () {
94
-					return current_user_can( 'manage_options' );
95
-				},
96
-			)
97
-		);
98
-	}
99
-
100
-
101
-	public function get_stats() {
102
-		/**
103
-		 * @var $state Sync_State
104
-		 */
105
-		$state = get_option( Analysis_Background_Process::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown() );
106
-
107
-		return $state->get_array();
108
-	}
109
-
110
-	public function start() {
111
-		$this->background_service->start();
112
-
113
-		return true;
114
-	}
115
-
116
-
117
-	public function restart() {
118
-		$this->background_service->cancel();
119
-		// clear the flags and restart again.
120
-		global $wpdb;
121
-		$query = <<<EOF
17
+    /**
18
+     * @var Analysis_Background_Service
19
+     */
20
+    private $background_service;
21
+    /**
22
+     * @var Options_Cache
23
+     */
24
+    private $cache_service;
25
+
26
+    public function __construct( $background_service, $cache_service ) {
27
+        $this->background_service = $background_service;
28
+        $this->cache_service = $cache_service;
29
+        $this->register_routes();
30
+    }
31
+
32
+    public function register_routes() {
33
+        $that = $this;
34
+        add_action( 'rest_api_init',
35
+            function () use ( $that ) {
36
+                $that->register_start_route();
37
+                $that->register_stop_route();
38
+                $that->register_stats_route();
39
+                $that->register_restart_route();
40
+            } );
41
+    }
42
+
43
+    private function register_start_route() {
44
+        register_rest_route(
45
+            Api_Config::REST_NAMESPACE,
46
+            '/background_analysis/start',
47
+            array(
48
+                'methods'             => WP_REST_Server::CREATABLE,
49
+                'callback'            => array( $this, 'start' ),
50
+                'permission_callback' => function () {
51
+                    return current_user_can( 'manage_options' );
52
+                },
53
+            )
54
+        );
55
+    }
56
+
57
+    private function register_stop_route() {
58
+        register_rest_route(
59
+            Api_Config::REST_NAMESPACE,
60
+            '/background_analysis/stop',
61
+            array(
62
+                'methods'             => WP_REST_Server::CREATABLE,
63
+                'callback'            => array( $this, 'stop' ),
64
+                'permission_callback' => function () {
65
+                    return current_user_can( 'manage_options' );
66
+                },
67
+            )
68
+        );
69
+    }
70
+
71
+    private function register_stats_route() {
72
+        register_rest_route(
73
+            Api_Config::REST_NAMESPACE,
74
+            '/background_analysis/stats',
75
+            array(
76
+                'methods'             => WP_REST_Server::CREATABLE,
77
+                'callback'            => array( $this, 'get_stats' ),
78
+                'permission_callback' => function () {
79
+                    return current_user_can( 'manage_options' );
80
+                },
81
+            )
82
+        );
83
+    }
84
+
85
+
86
+    private function register_restart_route() {
87
+        register_rest_route(
88
+            Api_Config::REST_NAMESPACE,
89
+            '/background_analysis/restart',
90
+            array(
91
+                'methods'             => WP_REST_Server::CREATABLE,
92
+                'callback'            => array( $this, 'restart' ),
93
+                'permission_callback' => function () {
94
+                    return current_user_can( 'manage_options' );
95
+                },
96
+            )
97
+        );
98
+    }
99
+
100
+
101
+    public function get_stats() {
102
+        /**
103
+         * @var $state Sync_State
104
+         */
105
+        $state = get_option( Analysis_Background_Process::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown() );
106
+
107
+        return $state->get_array();
108
+    }
109
+
110
+    public function start() {
111
+        $this->background_service->start();
112
+
113
+        return true;
114
+    }
115
+
116
+
117
+    public function restart() {
118
+        $this->background_service->cancel();
119
+        // clear the flags and restart again.
120
+        global $wpdb;
121
+        $query = <<<EOF
122 122
 DELETE FROM $wpdb->termmeta WHERE meta_key=%s OR meta_key=%s
123 123
 EOF;
124
-		// Remove the flags, if the tag is already accepted we wont remove that ui flag.
125
-		$query = $wpdb->prepare( $query, array(
126
-			Analysis_Background_Service::ANALYSIS_DONE_FLAG,
127
-			Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM
128
-		) );
129
-		$wpdb->query( $query );
130
-		// clear the cache
131
-		$this->cache_service->flush_all();
132
-		$this->background_service->start();
124
+        // Remove the flags, if the tag is already accepted we wont remove that ui flag.
125
+        $query = $wpdb->prepare( $query, array(
126
+            Analysis_Background_Service::ANALYSIS_DONE_FLAG,
127
+            Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM
128
+        ) );
129
+        $wpdb->query( $query );
130
+        // clear the cache
131
+        $this->cache_service->flush_all();
132
+        $this->background_service->start();
133 133
 
134
-		return array( 'status' => 'restart_complete' );
135
-	}
134
+        return array( 'status' => 'restart_complete' );
135
+    }
136 136
 
137 137
 
138
-	public function stop() {
139
-		$this->background_service->stop();
138
+    public function stop() {
139
+        $this->background_service->stop();
140 140
 
141
-		return true;
142
-	}
141
+        return true;
142
+    }
143 143
 
144 144
 
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	private $cache_service;
25 25
 
26
-	public function __construct( $background_service, $cache_service ) {
26
+	public function __construct($background_service, $cache_service) {
27 27
 		$this->background_service = $background_service;
28 28
 		$this->cache_service = $cache_service;
29 29
 		$this->register_routes();
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
 	public function register_routes() {
33 33
 		$that = $this;
34
-		add_action( 'rest_api_init',
35
-			function () use ( $that ) {
34
+		add_action('rest_api_init',
35
+			function() use ($that) {
36 36
 				$that->register_start_route();
37 37
 				$that->register_stop_route();
38 38
 				$that->register_stats_route();
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 			'/background_analysis/start',
47 47
 			array(
48 48
 				'methods'             => WP_REST_Server::CREATABLE,
49
-				'callback'            => array( $this, 'start' ),
50
-				'permission_callback' => function () {
51
-					return current_user_can( 'manage_options' );
49
+				'callback'            => array($this, 'start'),
50
+				'permission_callback' => function() {
51
+					return current_user_can('manage_options');
52 52
 				},
53 53
 			)
54 54
 		);
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 			'/background_analysis/stop',
61 61
 			array(
62 62
 				'methods'             => WP_REST_Server::CREATABLE,
63
-				'callback'            => array( $this, 'stop' ),
64
-				'permission_callback' => function () {
65
-					return current_user_can( 'manage_options' );
63
+				'callback'            => array($this, 'stop'),
64
+				'permission_callback' => function() {
65
+					return current_user_can('manage_options');
66 66
 				},
67 67
 			)
68 68
 		);
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 			'/background_analysis/stats',
75 75
 			array(
76 76
 				'methods'             => WP_REST_Server::CREATABLE,
77
-				'callback'            => array( $this, 'get_stats' ),
78
-				'permission_callback' => function () {
79
-					return current_user_can( 'manage_options' );
77
+				'callback'            => array($this, 'get_stats'),
78
+				'permission_callback' => function() {
79
+					return current_user_can('manage_options');
80 80
 				},
81 81
 			)
82 82
 		);
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 			'/background_analysis/restart',
90 90
 			array(
91 91
 				'methods'             => WP_REST_Server::CREATABLE,
92
-				'callback'            => array( $this, 'restart' ),
93
-				'permission_callback' => function () {
94
-					return current_user_can( 'manage_options' );
92
+				'callback'            => array($this, 'restart'),
93
+				'permission_callback' => function() {
94
+					return current_user_can('manage_options');
95 95
 				},
96 96
 			)
97 97
 		);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		/**
103 103
 		 * @var $state Sync_State
104 104
 		 */
105
-		$state = get_option( Analysis_Background_Process::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown() );
105
+		$state = get_option(Analysis_Background_Process::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown());
106 106
 
107 107
 		return $state->get_array();
108 108
 	}
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 DELETE FROM $wpdb->termmeta WHERE meta_key=%s OR meta_key=%s
123 123
 EOF;
124 124
 		// Remove the flags, if the tag is already accepted we wont remove that ui flag.
125
-		$query = $wpdb->prepare( $query, array(
125
+		$query = $wpdb->prepare($query, array(
126 126
 			Analysis_Background_Service::ANALYSIS_DONE_FLAG,
127 127
 			Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM
128
-		) );
129
-		$wpdb->query( $query );
128
+		));
129
+		$wpdb->query($query);
130 130
 		// clear the cache
131 131
 		$this->cache_service->flush_all();
132 132
 		$this->background_service->start();
133 133
 
134
-		return array( 'status' => 'restart_complete' );
134
+		return array('status' => 'restart_complete');
135 135
 	}
136 136
 
137 137
 
Please login to merge, or discard this patch.
src/wordlift/vocabulary/class-sync-state.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -4,56 +4,56 @@
 block discarded – undo
4 4
 
5 5
 class Sync_State {
6 6
 
7
-	public $started;
8
-	public $index;
9
-	public $count;
10
-	public $last_update;
11
-	public $state;
12
-
13
-	/**
14
-	 * Sync_Model constructor.
15
-	 *
16
-	 * @param $started
17
-	 * @param $index
18
-	 * @param $count
19
-	 * @param $last_update
20
-	 * @param $state
21
-	 */
22
-	public function __construct( $started, $index, $count, $last_update, $state ) {
23
-		$this->started     = $started;
24
-		$this->index       = $index;
25
-		$this->count       = (int) $count;
26
-		$this->last_update = $last_update;
27
-		$this->state       = $state;
28
-	}
29
-
30
-	public function increment_index( $count ) {
31
-		$this->index       += $count;
32
-		$this->last_update = time();
33
-
34
-		return $this;
35
-	}
36
-
37
-	public function set_state( $value ) {
38
-		$this->state       = $value;
39
-		$this->last_update = time();
40
-
41
-		return $this;
42
-	}
43
-
44
-	public function get_array() {
45
-		return array(
46
-			'started'     => $this->started,
47
-			'index'       => $this->index,
48
-			'count'       => $this->count,
49
-			'last_update' => $this->last_update,
50
-			'state'       => $this->state
51
-		);
52
-	}
53
-
54
-	public static function unknown() {
55
-
56
-		return new self( time(), 0, 0, time(), 'unknown' );
57
-	}
7
+    public $started;
8
+    public $index;
9
+    public $count;
10
+    public $last_update;
11
+    public $state;
12
+
13
+    /**
14
+     * Sync_Model constructor.
15
+     *
16
+     * @param $started
17
+     * @param $index
18
+     * @param $count
19
+     * @param $last_update
20
+     * @param $state
21
+     */
22
+    public function __construct( $started, $index, $count, $last_update, $state ) {
23
+        $this->started     = $started;
24
+        $this->index       = $index;
25
+        $this->count       = (int) $count;
26
+        $this->last_update = $last_update;
27
+        $this->state       = $state;
28
+    }
29
+
30
+    public function increment_index( $count ) {
31
+        $this->index       += $count;
32
+        $this->last_update = time();
33
+
34
+        return $this;
35
+    }
36
+
37
+    public function set_state( $value ) {
38
+        $this->state       = $value;
39
+        $this->last_update = time();
40
+
41
+        return $this;
42
+    }
43
+
44
+    public function get_array() {
45
+        return array(
46
+            'started'     => $this->started,
47
+            'index'       => $this->index,
48
+            'count'       => $this->count,
49
+            'last_update' => $this->last_update,
50
+            'state'       => $this->state
51
+        );
52
+    }
53
+
54
+    public static function unknown() {
55
+
56
+        return new self( time(), 0, 0, time(), 'unknown' );
57
+    }
58 58
 
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @param $last_update
20 20
 	 * @param $state
21 21
 	 */
22
-	public function __construct( $started, $index, $count, $last_update, $state ) {
22
+	public function __construct($started, $index, $count, $last_update, $state) {
23 23
 		$this->started     = $started;
24 24
 		$this->index       = $index;
25 25
 		$this->count       = (int) $count;
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 		$this->state       = $state;
28 28
 	}
29 29
 
30
-	public function increment_index( $count ) {
31
-		$this->index       += $count;
30
+	public function increment_index($count) {
31
+		$this->index += $count;
32 32
 		$this->last_update = time();
33 33
 
34 34
 		return $this;
35 35
 	}
36 36
 
37
-	public function set_state( $value ) {
37
+	public function set_state($value) {
38 38
 		$this->state       = $value;
39 39
 		$this->last_update = time();
40 40
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 	public static function unknown() {
45 45
 
46
-		return new self( time(), 0, 0, time(), 'unknown' );
46
+		return new self(time(), 0, 0, time(), 'unknown');
47 47
 	}
48 48
 
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/vocabulary/class-analysis-background-service.php 2 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -6,135 +6,135 @@
 block discarded – undo
6 6
 class Analysis_Background_Service {
7 7
 
8 8
 
9
-	const ANALYSIS_DONE_FLAG = '_wl_cmkg_analysis_complete_for_term_options_cache';
10
-	const TERMS_COUNT_TRANSIENT = '_wl_cmkg_analysis_background_service_terms_count';
11
-	const ENTITIES_PRESENT_FOR_TERM = '_wl_cmkg_analysis_entities_present_for_term_options_cache';
12
-
13
-	/**
14
-	 * @var Analysis_Service
15
-	 */
16
-	private $analysis_service;
17
-	/**
18
-	 * @var Analysis_Background_Process
19
-	 */
20
-	private $analysis_background_process;
21
-
22
-	/**
23
-	 * @var \Wordlift_Log_Service
24
-	 */
25
-	private $log;
26
-
27
-
28
-	public function __construct( $analysis_service ) {
29
-
30
-		$this->analysis_service = $analysis_service;
31
-
32
-		$this->analysis_background_process = new Analysis_Background_Process( $this );
33
-
34
-		$this->log = \Wordlift_Log_Service::get_logger( get_class() );
35
-	}
36
-
37
-	public function start() {
38
-		$this->analysis_background_process->start();
39
-	}
40
-
41
-	public function cancel() {
42
-		$this->analysis_background_process->cancel();
43
-	}
44
-
45
-	public function stop() {
46
-		$this->analysis_background_process->cancel();
47
-		$this->analysis_background_process->request_cancel();
48
-	}
49
-
50
-	/**
51
-	 * A list of term ids.
52
-	 * @return int|\WP_Error|\WP_Term[]
53
-	 */
54
-	public function next() {
55
-
56
-		$state = $this->info();
57
-
58
-		return get_terms( array(
59
-			'fields'     => 'ids',
60
-			'taxonomy'   => 'post_tag',
61
-			'hide_empty' => false,
62
-			'number'     => $this->get_batch_size(),
63
-			'offset'     => $state->index,
64
-			'meta_query' => array(
65
-				array(
66
-					'key'     => self::ANALYSIS_DONE_FLAG,
67
-					'compare' => 'NOT EXISTS'
68
-				)
69
-			),
70
-		) );
71
-	}
72
-
73
-	public function count() {
74
-
75
-		$count = count( get_terms( array(
76
-			'fields'     => 'ids',
77
-			'taxonomy'   => 'post_tag',
78
-			'hide_empty' => false,
79
-			// return all terms, we cant pass -1 here.
80
-			'number'     => 0,
81
-			'meta_query' => array(
82
-				array(
83
-					'key'     => self::ANALYSIS_DONE_FLAG,
84
-					'compare' => 'NOT EXISTS'
85
-				)
86
-			),
87
-		) ) );
88
-
89
-		$this->log->debug( "Count returned as $count" );
90
-
91
-
92
-		return $count;
93
-	}
94
-
95
-	public function get_batch_size() {
96
-		return 10;
97
-	}
98
-
99
-	public function info() {
100
-		return Analysis_Background_Process::get_state();
101
-	}
102
-
103
-	/**
104
-	 * @param $term_ids
105
-	 *
106
-	 * @return bool
107
-	 */
108
-	public function perform_analysis_for_terms( $term_ids ) {
109
-
110
-		foreach ( $term_ids as $term_id ) {
111
-
112
-			$tag = get_term( $term_id );
113
-
114
-			// This adds the entities to ttl cache
115
-			$result = $this->analysis_service->get_entities( $tag );
9
+    const ANALYSIS_DONE_FLAG = '_wl_cmkg_analysis_complete_for_term_options_cache';
10
+    const TERMS_COUNT_TRANSIENT = '_wl_cmkg_analysis_background_service_terms_count';
11
+    const ENTITIES_PRESENT_FOR_TERM = '_wl_cmkg_analysis_entities_present_for_term_options_cache';
12
+
13
+    /**
14
+     * @var Analysis_Service
15
+     */
16
+    private $analysis_service;
17
+    /**
18
+     * @var Analysis_Background_Process
19
+     */
20
+    private $analysis_background_process;
21
+
22
+    /**
23
+     * @var \Wordlift_Log_Service
24
+     */
25
+    private $log;
26
+
27
+
28
+    public function __construct( $analysis_service ) {
29
+
30
+        $this->analysis_service = $analysis_service;
31
+
32
+        $this->analysis_background_process = new Analysis_Background_Process( $this );
33
+
34
+        $this->log = \Wordlift_Log_Service::get_logger( get_class() );
35
+    }
36
+
37
+    public function start() {
38
+        $this->analysis_background_process->start();
39
+    }
40
+
41
+    public function cancel() {
42
+        $this->analysis_background_process->cancel();
43
+    }
44
+
45
+    public function stop() {
46
+        $this->analysis_background_process->cancel();
47
+        $this->analysis_background_process->request_cancel();
48
+    }
49
+
50
+    /**
51
+     * A list of term ids.
52
+     * @return int|\WP_Error|\WP_Term[]
53
+     */
54
+    public function next() {
55
+
56
+        $state = $this->info();
57
+
58
+        return get_terms( array(
59
+            'fields'     => 'ids',
60
+            'taxonomy'   => 'post_tag',
61
+            'hide_empty' => false,
62
+            'number'     => $this->get_batch_size(),
63
+            'offset'     => $state->index,
64
+            'meta_query' => array(
65
+                array(
66
+                    'key'     => self::ANALYSIS_DONE_FLAG,
67
+                    'compare' => 'NOT EXISTS'
68
+                )
69
+            ),
70
+        ) );
71
+    }
72
+
73
+    public function count() {
74
+
75
+        $count = count( get_terms( array(
76
+            'fields'     => 'ids',
77
+            'taxonomy'   => 'post_tag',
78
+            'hide_empty' => false,
79
+            // return all terms, we cant pass -1 here.
80
+            'number'     => 0,
81
+            'meta_query' => array(
82
+                array(
83
+                    'key'     => self::ANALYSIS_DONE_FLAG,
84
+                    'compare' => 'NOT EXISTS'
85
+                )
86
+            ),
87
+        ) ) );
88
+
89
+        $this->log->debug( "Count returned as $count" );
90
+
91
+
92
+        return $count;
93
+    }
94
+
95
+    public function get_batch_size() {
96
+        return 10;
97
+    }
98
+
99
+    public function info() {
100
+        return Analysis_Background_Process::get_state();
101
+    }
102
+
103
+    /**
104
+     * @param $term_ids
105
+     *
106
+     * @return bool
107
+     */
108
+    public function perform_analysis_for_terms( $term_ids ) {
109
+
110
+        foreach ( $term_ids as $term_id ) {
111
+
112
+            $tag = get_term( $term_id );
113
+
114
+            // This adds the entities to ttl cache
115
+            $result = $this->analysis_service->get_entities( $tag );
116 116
 
117
-			$this->log->debug( "Received result " . var_export( $result ) . " for ${term_id}" );
117
+            $this->log->debug( "Received result " . var_export( $result ) . " for ${term_id}" );
118 118
 
119
-			if ( $result !== false ) {
120
-				// then set the analysis complete flag.
121
-				update_term_meta( $term_id, self::ANALYSIS_DONE_FLAG, 1 );
122
-				if ( count( $result ) > 0 ) {
123
-					update_term_meta( $term_id, self::ENTITIES_PRESENT_FOR_TERM, 1 );
124
-				}
125
-			}
119
+            if ( $result !== false ) {
120
+                // then set the analysis complete flag.
121
+                update_term_meta( $term_id, self::ANALYSIS_DONE_FLAG, 1 );
122
+                if ( count( $result ) > 0 ) {
123
+                    update_term_meta( $term_id, self::ENTITIES_PRESENT_FOR_TERM, 1 );
124
+                }
125
+            }
126 126
 
127
-		}
127
+        }
128 128
 
129
-		/**
130
-		 * This action fires when the analysis is complete for the current batch
131
-		 * @since 3.30.0
132
-		 */
133
-		do_action( 'wordlift_vocabulary_analysis_complete_for_terms_batch' );
134
-
135
-		return true;
136
-
137
-
138
-	}
129
+        /**
130
+         * This action fires when the analysis is complete for the current batch
131
+         * @since 3.30.0
132
+         */
133
+        do_action( 'wordlift_vocabulary_analysis_complete_for_terms_batch' );
134
+
135
+        return true;
136
+
137
+
138
+    }
139 139
 
140 140
 }
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 	private $log;
26 26
 
27 27
 
28
-	public function __construct( $analysis_service ) {
28
+	public function __construct($analysis_service) {
29 29
 
30 30
 		$this->analysis_service = $analysis_service;
31 31
 
32
-		$this->analysis_background_process = new Analysis_Background_Process( $this );
32
+		$this->analysis_background_process = new Analysis_Background_Process($this);
33 33
 
34
-		$this->log = \Wordlift_Log_Service::get_logger( get_class() );
34
+		$this->log = \Wordlift_Log_Service::get_logger(get_class());
35 35
 	}
36 36
 
37 37
 	public function start() {
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 		$state = $this->info();
57 57
 
58
-		return get_terms( array(
58
+		return get_terms(array(
59 59
 			'fields'     => 'ids',
60 60
 			'taxonomy'   => 'post_tag',
61 61
 			'hide_empty' => false,
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 					'compare' => 'NOT EXISTS'
68 68
 				)
69 69
 			),
70
-		) );
70
+		));
71 71
 	}
72 72
 
73 73
 	public function count() {
74 74
 
75
-		$count = count( get_terms( array(
75
+		$count = count(get_terms(array(
76 76
 			'fields'     => 'ids',
77 77
 			'taxonomy'   => 'post_tag',
78 78
 			'hide_empty' => false,
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 					'compare' => 'NOT EXISTS'
85 85
 				)
86 86
 			),
87
-		) ) );
87
+		)));
88 88
 
89
-		$this->log->debug( "Count returned as $count" );
89
+		$this->log->debug("Count returned as $count");
90 90
 
91 91
 
92 92
 		return $count;
@@ -105,22 +105,22 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return bool
107 107
 	 */
108
-	public function perform_analysis_for_terms( $term_ids ) {
108
+	public function perform_analysis_for_terms($term_ids) {
109 109
 
110
-		foreach ( $term_ids as $term_id ) {
110
+		foreach ($term_ids as $term_id) {
111 111
 
112
-			$tag = get_term( $term_id );
112
+			$tag = get_term($term_id);
113 113
 
114 114
 			// This adds the entities to ttl cache
115
-			$result = $this->analysis_service->get_entities( $tag );
115
+			$result = $this->analysis_service->get_entities($tag);
116 116
 
117
-			$this->log->debug( "Received result " . var_export( $result ) . " for ${term_id}" );
117
+			$this->log->debug("Received result ".var_export($result)." for ${term_id}");
118 118
 
119
-			if ( $result !== false ) {
119
+			if ($result !== false) {
120 120
 				// then set the analysis complete flag.
121
-				update_term_meta( $term_id, self::ANALYSIS_DONE_FLAG, 1 );
122
-				if ( count( $result ) > 0 ) {
123
-					update_term_meta( $term_id, self::ENTITIES_PRESENT_FOR_TERM, 1 );
121
+				update_term_meta($term_id, self::ANALYSIS_DONE_FLAG, 1);
122
+				if (count($result) > 0) {
123
+					update_term_meta($term_id, self::ENTITIES_PRESENT_FOR_TERM, 1);
124 124
 				}
125 125
 			}
126 126
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		 * This action fires when the analysis is complete for the current batch
131 131
 		 * @since 3.30.0
132 132
 		 */
133
-		do_action( 'wordlift_vocabulary_analysis_complete_for_terms_batch' );
133
+		do_action('wordlift_vocabulary_analysis_complete_for_terms_batch');
134 134
 
135 135
 		return true;
136 136
 
Please login to merge, or discard this patch.
src/wordlift/vocabulary/pages/class-match-terms.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -12,55 +12,55 @@
 block discarded – undo
12 12
  * @author Naveen Muthusamy <[email protected]>
13 13
  */
14 14
 class Match_Terms {
15
-	/**
16
-	 * @var Term_Count
17
-	 */
18
-	private $term_count;
15
+    /**
16
+     * @var Term_Count
17
+     */
18
+    private $term_count;
19 19
 
20
-	/**
21
-	 * Match_Terms constructor.
22
-	 *
23
-	 * @param $term_count Term_Count
24
-	 */
25
-	public function __construct( $term_count ) {
20
+    /**
21
+     * Match_Terms constructor.
22
+     *
23
+     * @param $term_count Term_Count
24
+     */
25
+    public function __construct( $term_count ) {
26 26
 
27
-		$this->term_count = $term_count;
28
-		add_action( 'admin_menu', array( $this, 'admin_menu', ) );
27
+        $this->term_count = $term_count;
28
+        add_action( 'admin_menu', array( $this, 'admin_menu', ) );
29 29
 
30
-	}
30
+    }
31 31
 
32
-	public function admin_menu() {
33
-		$number = $this->term_count->get_term_count();
34
-		add_submenu_page(
35
-			'wl_admin_menu',
36
-			__( 'Match Terms', 'wordlift' ),
37
-			__( 'Match Terms', 'wordlift' ) . " " . Badge_Generator::generate_html($number),
38
-			'manage_options',
39
-			'wl-vocabulary-match-terms',
40
-			array( $this, 'submenu_page_callback' )
41
-		);
42
-	}
32
+    public function admin_menu() {
33
+        $number = $this->term_count->get_term_count();
34
+        add_submenu_page(
35
+            'wl_admin_menu',
36
+            __( 'Match Terms', 'wordlift' ),
37
+            __( 'Match Terms', 'wordlift' ) . " " . Badge_Generator::generate_html($number),
38
+            'manage_options',
39
+            'wl-vocabulary-match-terms',
40
+            array( $this, 'submenu_page_callback' )
41
+        );
42
+    }
43 43
 
44 44
 
45 45
 
46 46
 
47 47
 
48
-	public function submenu_page_callback() {
48
+    public function submenu_page_callback() {
49 49
 
50
-		Scripts_Helper::enqueue_based_on_wordpress_version(
51
-			'wl-vocabulary-reconcile-script',
52
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary',
53
-			array( 'react', 'react-dom', 'wp-polyfill' ),
54
-			true
55
-		);
50
+        Scripts_Helper::enqueue_based_on_wordpress_version(
51
+            'wl-vocabulary-reconcile-script',
52
+            plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary',
53
+            array( 'react', 'react-dom', 'wp-polyfill' ),
54
+            true
55
+        );
56 56
 
57 57
 
58
-		wp_enqueue_style( 'wl-vocabulary-reconcile-script',
59
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . "js/dist/vocabulary.full.css" );
60
-		wp_localize_script( 'wl-vocabulary-reconcile-script', '_wlVocabularyMatchTermsConfig', Api_Config::get_api_config() );
61
-		echo "<div id='wl_cmkg_background_process' class='wrap'></div>";
62
-		echo "<div id='wl_cmkg_reconcile_progress' class='wrap'></div>";
63
-		echo "<div id='wl_cmkg_table' class='wrap'></div>";
64
-	}
58
+        wp_enqueue_style( 'wl-vocabulary-reconcile-script',
59
+            plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . "js/dist/vocabulary.full.css" );
60
+        wp_localize_script( 'wl-vocabulary-reconcile-script', '_wlVocabularyMatchTermsConfig', Api_Config::get_api_config() );
61
+        echo "<div id='wl_cmkg_background_process' class='wrap'></div>";
62
+        echo "<div id='wl_cmkg_reconcile_progress' class='wrap'></div>";
63
+        echo "<div id='wl_cmkg_table' class='wrap'></div>";
64
+    }
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param $term_count Term_Count
24 24
 	 */
25
-	public function __construct( $term_count ) {
25
+	public function __construct($term_count) {
26 26
 
27 27
 		$this->term_count = $term_count;
28
-		add_action( 'admin_menu', array( $this, 'admin_menu', ) );
28
+		add_action('admin_menu', array($this, 'admin_menu',));
29 29
 
30 30
 	}
31 31
 
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 		$number = $this->term_count->get_term_count();
34 34
 		add_submenu_page(
35 35
 			'wl_admin_menu',
36
-			__( 'Match Terms', 'wordlift' ),
37
-			__( 'Match Terms', 'wordlift' ) . " " . Badge_Generator::generate_html($number),
36
+			__('Match Terms', 'wordlift'),
37
+			__('Match Terms', 'wordlift')." ".Badge_Generator::generate_html($number),
38 38
 			'manage_options',
39 39
 			'wl-vocabulary-match-terms',
40
-			array( $this, 'submenu_page_callback' )
40
+			array($this, 'submenu_page_callback')
41 41
 		);
42 42
 	}
43 43
 
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 
50 50
 		Scripts_Helper::enqueue_based_on_wordpress_version(
51 51
 			'wl-vocabulary-reconcile-script',
52
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary',
53
-			array( 'react', 'react-dom', 'wp-polyfill' ),
52
+			plugin_dir_url(dirname(dirname(__DIR__))).'js/dist/vocabulary',
53
+			array('react', 'react-dom', 'wp-polyfill'),
54 54
 			true
55 55
 		);
56 56
 
57 57
 
58
-		wp_enqueue_style( 'wl-vocabulary-reconcile-script',
59
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . "js/dist/vocabulary.full.css" );
60
-		wp_localize_script( 'wl-vocabulary-reconcile-script', '_wlVocabularyMatchTermsConfig', Api_Config::get_api_config() );
58
+		wp_enqueue_style('wl-vocabulary-reconcile-script',
59
+			plugin_dir_url(dirname(dirname(__DIR__)))."js/dist/vocabulary.full.css");
60
+		wp_localize_script('wl-vocabulary-reconcile-script', '_wlVocabularyMatchTermsConfig', Api_Config::get_api_config());
61 61
 		echo "<div id='wl_cmkg_background_process' class='wrap'></div>";
62 62
 		echo "<div id='wl_cmkg_reconcile_progress' class='wrap'></div>";
63 63
 		echo "<div id='wl_cmkg_table' class='wrap'></div>";
Please login to merge, or discard this patch.
src/wordlift/vocabulary/dashboard/class-term-matches-widget.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -9,35 +9,35 @@  discard block
 block discarded – undo
9 9
  * @author Naveen Muthusamy <[email protected]>
10 10
  */
11 11
 class Term_Matches_Widget {
12
-	/**
13
-	 * @var Term_Count
14
-	 */
15
-	private $term_count;
12
+    /**
13
+     * @var Term_Count
14
+     */
15
+    private $term_count;
16 16
 
17
-	/**
18
-	 * Term_Matches_Widget constructor.
19
-	 *
20
-	 * @param $term_count Term_Count
21
-	 */
22
-	public function __construct( $term_count ) {
23
-		$this->term_count = $term_count;
24
-	}
17
+    /**
18
+     * Term_Matches_Widget constructor.
19
+     *
20
+     * @param $term_count Term_Count
21
+     */
22
+    public function __construct( $term_count ) {
23
+        $this->term_count = $term_count;
24
+    }
25 25
 
26
-	public function connect_hook() {
27
-		add_action( 'wl_admin_dashboard_widgets', array( $this, 'render_widget' ) );
28
-	}
26
+    public function connect_hook() {
27
+        add_action( 'wl_admin_dashboard_widgets', array( $this, 'render_widget' ) );
28
+    }
29 29
 
30
-	public function render_widget() {
31
-		$term_count  = $this->term_count->get_term_count();
32
-		if ( $term_count <= 0 ) {
33
-			return;
34
-		}
30
+    public function render_widget() {
31
+        $term_count  = $this->term_count->get_term_count();
32
+        if ( $term_count <= 0 ) {
33
+            return;
34
+        }
35 35
 
36
-		$match_terms_url = menu_page_url('wl-vocabulary-match-terms', false);
37
-		$term_count_link = "<a href='$match_terms_url'>" . $term_count . " term(s)</a>";
38
-		$match_terms = __('Match terms', 'wordlift');
39
-		$additional_text = __(' waiting to be matched with entities.', 'wordlift');
40
-		echo <<<EOF
36
+        $match_terms_url = menu_page_url('wl-vocabulary-match-terms', false);
37
+        $term_count_link = "<a href='$match_terms_url'>" . $term_count . " term(s)</a>";
38
+        $match_terms = __('Match terms', 'wordlift');
39
+        $additional_text = __(' waiting to be matched with entities.', 'wordlift');
40
+        echo <<<EOF
41 41
         <div id="wl-match-terms" class="wl-dashboard__block wl-dashboard__block--match-terms">
42 42
             <header>
43 43
                 <h3>$match_terms</h3>
@@ -47,6 +47,6 @@  discard block
 block discarded – undo
47 47
                 </p>
48 48
         </div>
49 49
 EOF;
50
-	}
50
+    }
51 51
 
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@
 block discarded – undo
19 19
 	 *
20 20
 	 * @param $term_count Term_Count
21 21
 	 */
22
-	public function __construct( $term_count ) {
22
+	public function __construct($term_count) {
23 23
 		$this->term_count = $term_count;
24 24
 	}
25 25
 
26 26
 	public function connect_hook() {
27
-		add_action( 'wl_admin_dashboard_widgets', array( $this, 'render_widget' ) );
27
+		add_action('wl_admin_dashboard_widgets', array($this, 'render_widget'));
28 28
 	}
29 29
 
30 30
 	public function render_widget() {
31
-		$term_count  = $this->term_count->get_term_count();
32
-		if ( $term_count <= 0 ) {
31
+		$term_count = $this->term_count->get_term_count();
32
+		if ($term_count <= 0) {
33 33
 			return;
34 34
 		}
35 35
 
36 36
 		$match_terms_url = menu_page_url('wl-vocabulary-match-terms', false);
37
-		$term_count_link = "<a href='$match_terms_url'>" . $term_count . " term(s)</a>";
37
+		$term_count_link = "<a href='$match_terms_url'>".$term_count." term(s)</a>";
38 38
 		$match_terms = __('Match terms', 'wordlift');
39 39
 		$additional_text = __(' waiting to be matched with entities.', 'wordlift');
40 40
 		echo <<<EOF
Please login to merge, or discard this patch.
src/wordlift/vocabulary/hooks/class-term-page-hook.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -15,60 +15,60 @@
 block discarded – undo
15 15
  */
16 16
 class Term_Page_Hook {
17 17
 
18
-	const HANDLE = 'wl-vocabulary-term-page-handle';
18
+    const HANDLE = 'wl-vocabulary-term-page-handle';
19 19
 
20
-	const LOCALIZED_KEY = '_wlVocabularyTermPageSettings';
20
+    const LOCALIZED_KEY = '_wlVocabularyTermPageSettings';
21 21
 
22
-	private $term_data_factory;
22
+    private $term_data_factory;
23 23
 
24
-	/**
25
-	 * Term_Page_Hook constructor.
26
-	 *
27
-	 * @param $term_data_factory Term_Data_Factory
28
-	 */
29
-	public function __construct( $term_data_factory ) {
30
-		$this->term_data_factory = $term_data_factory;
31
-	}
24
+    /**
25
+     * Term_Page_Hook constructor.
26
+     *
27
+     * @param $term_data_factory Term_Data_Factory
28
+     */
29
+    public function __construct( $term_data_factory ) {
30
+        $this->term_data_factory = $term_data_factory;
31
+    }
32 32
 
33
-	public function connect_hook() {
33
+    public function connect_hook() {
34 34
 
35
-		add_action( 'post_tag_edit_form_fields', array( $this, 'load_scripts' ), PHP_INT_MAX );
35
+        add_action( 'post_tag_edit_form_fields', array( $this, 'load_scripts' ), PHP_INT_MAX );
36 36
 
37
-	}
37
+    }
38 38
 
39
-	/**
40
-	 * @param $term \WP_Term
41
-	 */
42
-	public function load_scripts( $term ) {
39
+    /**
40
+     * @param $term \WP_Term
41
+     */
42
+    public function load_scripts( $term ) {
43 43
 
44
-		$is_entity_matched = intval( get_term_meta( $term->term_id, Entity_Rest_Endpoint::IGNORE_TAG_FROM_LISTING, true ) ) === 1;
44
+        $is_entity_matched = intval( get_term_meta( $term->term_id, Entity_Rest_Endpoint::IGNORE_TAG_FROM_LISTING, true ) ) === 1;
45 45
 
46
-		$is_entities_present = intval( get_term_meta( $term->term_id, Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM, true ) ) === 1;
46
+        $is_entities_present = intval( get_term_meta( $term->term_id, Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM, true ) ) === 1;
47 47
 
48
-		if ( $is_entity_matched || ! $is_entities_present ) {
49
-			return;
50
-		}
48
+        if ( $is_entity_matched || ! $is_entities_present ) {
49
+            return;
50
+        }
51 51
 
52
-		$term_data = $this->term_data_factory->get_term_data( $term );
52
+        $term_data = $this->term_data_factory->get_term_data( $term );
53 53
 
54
-		Scripts_Helper::enqueue_based_on_wordpress_version(
55
-			self::HANDLE,
56
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page',
57
-			array( 'react', 'react-dom', 'wp-polyfill' ),
58
-			true
59
-		);
54
+        Scripts_Helper::enqueue_based_on_wordpress_version(
55
+            self::HANDLE,
56
+            plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page',
57
+            array( 'react', 'react-dom', 'wp-polyfill' ),
58
+            true
59
+        );
60 60
 
61
-		wp_enqueue_style( self::HANDLE, plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page.full.css' );
61
+        wp_enqueue_style( self::HANDLE, plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page.full.css' );
62 62
 
63
-		wp_localize_script( self::HANDLE, self::LOCALIZED_KEY, array(
64
-			'termData'  => $term_data->get_data(),
65
-			'apiConfig' => Api_Config::get_api_config()
66
-		) );
63
+        wp_localize_script( self::HANDLE, self::LOCALIZED_KEY, array(
64
+            'termData'  => $term_data->get_data(),
65
+            'apiConfig' => Api_Config::get_api_config()
66
+        ) );
67 67
 
68
-		echo "<tr class=\"form-field\">
68
+        echo "<tr class=\"form-field\">
69 69
 				<th>Match term</th>
70 70
 				<td style='width: 100%;'><div id='wl_vocabulary_terms_widget'></div></td>
71 71
 			</tr>";
72
-	}
72
+    }
73 73
 
74 74
 }
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,44 +26,44 @@
 block discarded – undo
26 26
 	 *
27 27
 	 * @param $term_data_factory Term_Data_Factory
28 28
 	 */
29
-	public function __construct( $term_data_factory ) {
29
+	public function __construct($term_data_factory) {
30 30
 		$this->term_data_factory = $term_data_factory;
31 31
 	}
32 32
 
33 33
 	public function connect_hook() {
34 34
 
35
-		add_action( 'post_tag_edit_form_fields', array( $this, 'load_scripts' ), PHP_INT_MAX );
35
+		add_action('post_tag_edit_form_fields', array($this, 'load_scripts'), PHP_INT_MAX);
36 36
 
37 37
 	}
38 38
 
39 39
 	/**
40 40
 	 * @param $term \WP_Term
41 41
 	 */
42
-	public function load_scripts( $term ) {
42
+	public function load_scripts($term) {
43 43
 
44
-		$is_entity_matched = intval( get_term_meta( $term->term_id, Entity_Rest_Endpoint::IGNORE_TAG_FROM_LISTING, true ) ) === 1;
44
+		$is_entity_matched = intval(get_term_meta($term->term_id, Entity_Rest_Endpoint::IGNORE_TAG_FROM_LISTING, true)) === 1;
45 45
 
46
-		$is_entities_present = intval( get_term_meta( $term->term_id, Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM, true ) ) === 1;
46
+		$is_entities_present = intval(get_term_meta($term->term_id, Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM, true)) === 1;
47 47
 
48
-		if ( $is_entity_matched || ! $is_entities_present ) {
48
+		if ($is_entity_matched || ! $is_entities_present) {
49 49
 			return;
50 50
 		}
51 51
 
52
-		$term_data = $this->term_data_factory->get_term_data( $term );
52
+		$term_data = $this->term_data_factory->get_term_data($term);
53 53
 
54 54
 		Scripts_Helper::enqueue_based_on_wordpress_version(
55 55
 			self::HANDLE,
56
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page',
57
-			array( 'react', 'react-dom', 'wp-polyfill' ),
56
+			plugin_dir_url(dirname(dirname(__DIR__))).'js/dist/vocabulary-term-page',
57
+			array('react', 'react-dom', 'wp-polyfill'),
58 58
 			true
59 59
 		);
60 60
 
61
-		wp_enqueue_style( self::HANDLE, plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page.full.css' );
61
+		wp_enqueue_style(self::HANDLE, plugin_dir_url(dirname(dirname(__DIR__))).'js/dist/vocabulary-term-page.full.css');
62 62
 
63
-		wp_localize_script( self::HANDLE, self::LOCALIZED_KEY, array(
63
+		wp_localize_script(self::HANDLE, self::LOCALIZED_KEY, array(
64 64
 			'termData'  => $term_data->get_data(),
65 65
 			'apiConfig' => Api_Config::get_api_config()
66
-		) );
66
+		));
67 67
 
68 68
 		echo "<tr class=\"form-field\">
69 69
 				<th>Match term</th>
Please login to merge, or discard this patch.
src/wordlift/vocabulary/hooks/class-tag-created-hook.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,23 +6,23 @@
 block discarded – undo
6 6
 
7 7
 class Tag_Created_Hook {
8 8
 
9
-	/**
10
-	 * @var $analysis_background_service Analysis_Background_Service
11
-	 */
12
-	private $analysis_background_service;
9
+    /**
10
+     * @var $analysis_background_service Analysis_Background_Service
11
+     */
12
+    private $analysis_background_service;
13 13
 
14
-	/**
15
-	 * Tag_Created_Hook constructor.
16
-	 *
17
-	 * @param $analysis_background_service Analysis_Background_Service
18
-	 */
19
-	public function __construct( $analysis_background_service ) {
20
-		$this->analysis_background_service = $analysis_background_service;
21
-		add_action( 'created_post_tag', array( $this, 'created_post_tag' ) );
22
-	}
14
+    /**
15
+     * Tag_Created_Hook constructor.
16
+     *
17
+     * @param $analysis_background_service Analysis_Background_Service
18
+     */
19
+    public function __construct( $analysis_background_service ) {
20
+        $this->analysis_background_service = $analysis_background_service;
21
+        add_action( 'created_post_tag', array( $this, 'created_post_tag' ) );
22
+    }
23 23
 
24
-	public function created_post_tag() {
25
-		$this->analysis_background_service->start();
26
-	}
24
+    public function created_post_tag() {
25
+        $this->analysis_background_service->start();
26
+    }
27 27
 
28 28
 }
29 29
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@
 block discarded – undo
16 16
 	 *
17 17
 	 * @param $analysis_background_service Analysis_Background_Service
18 18
 	 */
19
-	public function __construct( $analysis_background_service ) {
19
+	public function __construct($analysis_background_service) {
20 20
 		$this->analysis_background_service = $analysis_background_service;
21
-		add_action( 'created_post_tag', array( $this, 'created_post_tag' ) );
21
+		add_action('created_post_tag', array($this, 'created_post_tag'));
22 22
 	}
23 23
 
24 24
 	public function created_post_tag() {
Please login to merge, or discard this patch.