Completed
Pull Request — develop (#1698)
by
unknown
01:26
created
src/wordlift/analysis/class-v1-analysis-service.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
  */
13 13
 class V1_Analysis_Service extends Abstract_Analysis_Service {
14 14
 
15
-	// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
16
-	public function get_analysis_response( $data, $content_type, $post_id ) {
17
-		return $this->api_service->post_custom_content_type( 'analysis/single', $data, $content_type );
18
-	}
15
+    // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
16
+    public function get_analysis_response( $data, $content_type, $post_id ) {
17
+        return $this->api_service->post_custom_content_type( 'analysis/single', $data, $content_type );
18
+    }
19 19
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 class V1_Analysis_Service extends Abstract_Analysis_Service {
14 14
 
15 15
 	// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
16
-	public function get_analysis_response( $data, $content_type, $post_id ) {
17
-		return $this->api_service->post_custom_content_type( 'analysis/single', $data, $content_type );
16
+	public function get_analysis_response($data, $content_type, $post_id) {
17
+		return $this->api_service->post_custom_content_type('analysis/single', $data, $content_type);
18 18
 	}
19 19
 }
Please login to merge, or discard this patch.
src/wordlift/analysis/response/class-analysis-response-ops-factory.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -13,68 +13,68 @@
 block discarded – undo
13 13
 use Wordlift_Entity_Uri_Service;
14 14
 
15 15
 class Analysis_Response_Ops_Factory {
16
-	/**
17
-	 * @var Wordlift_Entity_Uri_Service
18
-	 */
19
-	private $entity_uri_service;
16
+    /**
17
+     * @var Wordlift_Entity_Uri_Service
18
+     */
19
+    private $entity_uri_service;
20 20
 
21
-	/**
22
-	 * @var Entity_Helper
23
-	 */
24
-	private $entity_helper;
21
+    /**
22
+     * @var Entity_Helper
23
+     */
24
+    private $entity_helper;
25 25
 
26
-	/**
27
-	 * Analysis_Response_Ops constructor.
28
-	 *
29
-	 * @param Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service}.
30
-	 * @param Entity_Helper               $entity_helper The {@link Entity_Helper}.
31
-	 *
32
-	 * @since 3.25.1
33
-	 */
34
-	protected function __construct( $entity_uri_service, $entity_helper ) {
26
+    /**
27
+     * Analysis_Response_Ops constructor.
28
+     *
29
+     * @param Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service}.
30
+     * @param Entity_Helper               $entity_helper The {@link Entity_Helper}.
31
+     *
32
+     * @since 3.25.1
33
+     */
34
+    protected function __construct( $entity_uri_service, $entity_helper ) {
35 35
 
36
-		$this->entity_uri_service = $entity_uri_service;
37
-		$this->entity_helper      = $entity_helper;
36
+        $this->entity_uri_service = $entity_uri_service;
37
+        $this->entity_helper      = $entity_helper;
38 38
 
39
-	}
39
+    }
40 40
 
41
-	private static $instance;
41
+    private static $instance;
42 42
 
43
-	public static function get_instance() {
44
-		if ( ! isset( self::$instance ) ) {
45
-			self::$instance = new self( Wordlift_Entity_Uri_Service::get_instance(), Entity_Helper::get_instance() );
46
-		}
43
+    public static function get_instance() {
44
+        if ( ! isset( self::$instance ) ) {
45
+            self::$instance = new self( Wordlift_Entity_Uri_Service::get_instance(), Entity_Helper::get_instance() );
46
+        }
47 47
 
48
-		return self::$instance;
49
-	}
48
+        return self::$instance;
49
+    }
50 50
 
51
-	public function create( $json, $post_id ) {
52
-		return new Analysis_Response_Ops(
53
-			$this->entity_uri_service,
54
-			$this->entity_helper,
55
-			$json,
56
-			$post_id
57
-		);
58
-	}
51
+    public function create( $json, $post_id ) {
52
+        return new Analysis_Response_Ops(
53
+            $this->entity_uri_service,
54
+            $this->entity_helper,
55
+            $json,
56
+            $post_id
57
+        );
58
+    }
59 59
 
60
-	/**
61
-	 * Create an Analysis_Response_Ops instance given the provided http response.
62
-	 *
63
-	 * @param array $response {
64
-	 *
65
-	 * @type string $body The response body.
66
-	 * }
67
-	 *
68
-	 * @return Analysis_Response_Ops A new Analysis_Response_Ops instance.
69
-	 * @throws \Exception if the provided response doesn't contain a `body` element.
70
-	 */
71
-	public function create_with_response( $response, $post_id ) {
60
+    /**
61
+     * Create an Analysis_Response_Ops instance given the provided http response.
62
+     *
63
+     * @param array $response {
64
+     *
65
+     * @type string $body The response body.
66
+     * }
67
+     *
68
+     * @return Analysis_Response_Ops A new Analysis_Response_Ops instance.
69
+     * @throws \Exception if the provided response doesn't contain a `body` element.
70
+     */
71
+    public function create_with_response( $response, $post_id ) {
72 72
 
73
-		if ( ! isset( $response['body'] ) ) {
74
-			throw new \Exception( '`body` is required in response.' );
75
-		}
73
+        if ( ! isset( $response['body'] ) ) {
74
+            throw new \Exception( '`body` is required in response.' );
75
+        }
76 76
 
77
-		return $this->create( json_decode( $response['body'] ), $post_id );
78
-	}
77
+        return $this->create( json_decode( $response['body'] ), $post_id );
78
+    }
79 79
 
80 80
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @since 3.25.1
33 33
 	 */
34
-	protected function __construct( $entity_uri_service, $entity_helper ) {
34
+	protected function __construct($entity_uri_service, $entity_helper) {
35 35
 
36 36
 		$this->entity_uri_service = $entity_uri_service;
37 37
 		$this->entity_helper      = $entity_helper;
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	private static $instance;
42 42
 
43 43
 	public static function get_instance() {
44
-		if ( ! isset( self::$instance ) ) {
45
-			self::$instance = new self( Wordlift_Entity_Uri_Service::get_instance(), Entity_Helper::get_instance() );
44
+		if ( ! isset(self::$instance)) {
45
+			self::$instance = new self(Wordlift_Entity_Uri_Service::get_instance(), Entity_Helper::get_instance());
46 46
 		}
47 47
 
48 48
 		return self::$instance;
49 49
 	}
50 50
 
51
-	public function create( $json, $post_id ) {
51
+	public function create($json, $post_id) {
52 52
 		return new Analysis_Response_Ops(
53 53
 			$this->entity_uri_service,
54 54
 			$this->entity_helper,
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 	 * @return Analysis_Response_Ops A new Analysis_Response_Ops instance.
69 69
 	 * @throws \Exception if the provided response doesn't contain a `body` element.
70 70
 	 */
71
-	public function create_with_response( $response, $post_id ) {
71
+	public function create_with_response($response, $post_id) {
72 72
 
73
-		if ( ! isset( $response['body'] ) ) {
74
-			throw new \Exception( '`body` is required in response.' );
73
+		if ( ! isset($response['body'])) {
74
+			throw new \Exception('`body` is required in response.');
75 75
 		}
76 76
 
77
-		return $this->create( json_decode( $response['body'] ), $post_id );
77
+		return $this->create(json_decode($response['body']), $post_id);
78 78
 	}
79 79
 
80 80
 }
Please login to merge, or discard this patch.
src/wordlift/vocabulary/class-analysis-background-service.php 2 patches
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -4,136 +4,136 @@
 block discarded – undo
4 4
 
5 5
 class Analysis_Background_Service {
6 6
 
7
-	const ANALYSIS_DONE_FLAG        = '_wl_cmkg_analysis_complete_for_term_options_cache';
8
-	const TERMS_COUNT_TRANSIENT     = '_wl_cmkg_analysis_background_service_terms_count';
9
-	const ENTITIES_PRESENT_FOR_TERM = '_wl_cmkg_analysis_entities_present_for_term_options_cache';
10
-
11
-	/**
12
-	 * @var Analysis_Service
13
-	 */
14
-	private $analysis_service;
15
-	/**
16
-	 * @var Analysis_Background_Process
17
-	 */
18
-	private $analysis_background_process;
19
-
20
-	/**
21
-	 * @var \Wordlift_Log_Service
22
-	 */
23
-	private $log;
24
-
25
-	public function __construct( $analysis_service ) {
26
-
27
-		$this->analysis_service = $analysis_service;
28
-
29
-		$this->analysis_background_process = new Analysis_Background_Process( $this );
30
-
31
-		$this->log = \Wordlift_Log_Service::get_logger( get_class() );
32
-	}
33
-
34
-	public function start() {
35
-		$this->analysis_background_process->start();
36
-	}
37
-
38
-	public function cancel() {
39
-		$this->analysis_background_process->cancel();
40
-	}
41
-
42
-	public function stop() {
43
-		$this->analysis_background_process->cancel();
44
-		$this->analysis_background_process->request_cancel();
45
-	}
46
-
47
-	/**
48
-	 * A list of term ids.
49
-	 *
50
-	 * @return int|\WP_Error|\WP_Term[]
51
-	 */
52
-	public function next() {
53
-
54
-		return Terms_Compat::get_terms(
55
-			Terms_Compat::get_public_taxonomies(),
56
-			array(
57
-				'fields'                             => 'ids',
58
-				'hide_empty'                         => false,
59
-				'number'                             => $this->get_batch_size(),
60
-				// 'offset'     => $state->index,
61
-										'meta_query' => array(
62
-											array(
63
-												'key'     => self::ANALYSIS_DONE_FLAG,
64
-												'compare' => 'NOT EXISTS',
65
-											),
66
-										),
67
-			)
68
-		);
69
-	}
70
-
71
-	public function count() {
72
-
73
-		$count = count(
74
-			Terms_Compat::get_terms(
75
-				Terms_Compat::get_public_taxonomies(),
76
-				array(
77
-					'fields'     => 'ids',
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
-		);
90
-
91
-		$this->log->debug( "Count returned as $count" );
92
-
93
-		return $count;
94
-	}
95
-
96
-	public function get_batch_size() {
97
-		return 10;
98
-	}
99
-
100
-	public function info() {
101
-		return Analysis_Background_Process::get_state();
102
-	}
103
-
104
-	/**
105
-	 * @param $term_ids
106
-	 *
107
-	 * @return bool
108
-	 */
109
-	public function perform_analysis_for_terms( $term_ids ) {
110
-
111
-		foreach ( $term_ids as $term_id ) {
112
-
113
-			$tag = get_term( $term_id );
114
-
115
-			// This adds the entities to ttl cache
116
-			$result = $this->analysis_service->get_entities( $tag );
117
-
118
-			// then set the analysis complete flag.
119
-			update_term_meta( $term_id, self::ANALYSIS_DONE_FLAG, 1 );
120
-
121
-			if ( false !== $result ) {
122
-				if ( count( $result ) > 0 ) {
123
-					update_term_meta( $term_id, self::ENTITIES_PRESENT_FOR_TERM, 1 );
124
-				}
125
-			}
126
-		}
127
-
128
-		/**
129
-		 * This action fires when the analysis is complete for the current batch
130
-		 *
131
-		 * @since 3.30.0
132
-		 */
133
-		do_action( 'wordlift_vocabulary_analysis_complete_for_terms_batch' );
134
-
135
-		return true;
136
-
137
-	}
7
+    const ANALYSIS_DONE_FLAG        = '_wl_cmkg_analysis_complete_for_term_options_cache';
8
+    const TERMS_COUNT_TRANSIENT     = '_wl_cmkg_analysis_background_service_terms_count';
9
+    const ENTITIES_PRESENT_FOR_TERM = '_wl_cmkg_analysis_entities_present_for_term_options_cache';
10
+
11
+    /**
12
+     * @var Analysis_Service
13
+     */
14
+    private $analysis_service;
15
+    /**
16
+     * @var Analysis_Background_Process
17
+     */
18
+    private $analysis_background_process;
19
+
20
+    /**
21
+     * @var \Wordlift_Log_Service
22
+     */
23
+    private $log;
24
+
25
+    public function __construct( $analysis_service ) {
26
+
27
+        $this->analysis_service = $analysis_service;
28
+
29
+        $this->analysis_background_process = new Analysis_Background_Process( $this );
30
+
31
+        $this->log = \Wordlift_Log_Service::get_logger( get_class() );
32
+    }
33
+
34
+    public function start() {
35
+        $this->analysis_background_process->start();
36
+    }
37
+
38
+    public function cancel() {
39
+        $this->analysis_background_process->cancel();
40
+    }
41
+
42
+    public function stop() {
43
+        $this->analysis_background_process->cancel();
44
+        $this->analysis_background_process->request_cancel();
45
+    }
46
+
47
+    /**
48
+     * A list of term ids.
49
+     *
50
+     * @return int|\WP_Error|\WP_Term[]
51
+     */
52
+    public function next() {
53
+
54
+        return Terms_Compat::get_terms(
55
+            Terms_Compat::get_public_taxonomies(),
56
+            array(
57
+                'fields'                             => 'ids',
58
+                'hide_empty'                         => false,
59
+                'number'                             => $this->get_batch_size(),
60
+                // 'offset'     => $state->index,
61
+                                        'meta_query' => array(
62
+                                            array(
63
+                                                'key'     => self::ANALYSIS_DONE_FLAG,
64
+                                                'compare' => 'NOT EXISTS',
65
+                                            ),
66
+                                        ),
67
+            )
68
+        );
69
+    }
70
+
71
+    public function count() {
72
+
73
+        $count = count(
74
+            Terms_Compat::get_terms(
75
+                Terms_Compat::get_public_taxonomies(),
76
+                array(
77
+                    'fields'     => 'ids',
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
+        );
90
+
91
+        $this->log->debug( "Count returned as $count" );
92
+
93
+        return $count;
94
+    }
95
+
96
+    public function get_batch_size() {
97
+        return 10;
98
+    }
99
+
100
+    public function info() {
101
+        return Analysis_Background_Process::get_state();
102
+    }
103
+
104
+    /**
105
+     * @param $term_ids
106
+     *
107
+     * @return bool
108
+     */
109
+    public function perform_analysis_for_terms( $term_ids ) {
110
+
111
+        foreach ( $term_ids as $term_id ) {
112
+
113
+            $tag = get_term( $term_id );
114
+
115
+            // This adds the entities to ttl cache
116
+            $result = $this->analysis_service->get_entities( $tag );
117
+
118
+            // then set the analysis complete flag.
119
+            update_term_meta( $term_id, self::ANALYSIS_DONE_FLAG, 1 );
120
+
121
+            if ( false !== $result ) {
122
+                if ( count( $result ) > 0 ) {
123
+                    update_term_meta( $term_id, self::ENTITIES_PRESENT_FOR_TERM, 1 );
124
+                }
125
+            }
126
+        }
127
+
128
+        /**
129
+         * This action fires when the analysis is complete for the current batch
130
+         *
131
+         * @since 3.30.0
132
+         */
133
+        do_action( 'wordlift_vocabulary_analysis_complete_for_terms_batch' );
134
+
135
+        return true;
136
+
137
+    }
138 138
 
139 139
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	private $log;
24 24
 
25
-	public function __construct( $analysis_service ) {
25
+	public function __construct($analysis_service) {
26 26
 
27 27
 		$this->analysis_service = $analysis_service;
28 28
 
29
-		$this->analysis_background_process = new Analysis_Background_Process( $this );
29
+		$this->analysis_background_process = new Analysis_Background_Process($this);
30 30
 
31
-		$this->log = \Wordlift_Log_Service::get_logger( get_class() );
31
+		$this->log = \Wordlift_Log_Service::get_logger(get_class());
32 32
 	}
33 33
 
34 34
 	public function start() {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			)
89 89
 		);
90 90
 
91
-		$this->log->debug( "Count returned as $count" );
91
+		$this->log->debug("Count returned as $count");
92 92
 
93 93
 		return $count;
94 94
 	}
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return bool
108 108
 	 */
109
-	public function perform_analysis_for_terms( $term_ids ) {
109
+	public function perform_analysis_for_terms($term_ids) {
110 110
 
111
-		foreach ( $term_ids as $term_id ) {
111
+		foreach ($term_ids as $term_id) {
112 112
 
113
-			$tag = get_term( $term_id );
113
+			$tag = get_term($term_id);
114 114
 
115 115
 			// This adds the entities to ttl cache
116
-			$result = $this->analysis_service->get_entities( $tag );
116
+			$result = $this->analysis_service->get_entities($tag);
117 117
 
118 118
 			// then set the analysis complete flag.
119
-			update_term_meta( $term_id, self::ANALYSIS_DONE_FLAG, 1 );
119
+			update_term_meta($term_id, self::ANALYSIS_DONE_FLAG, 1);
120 120
 
121
-			if ( false !== $result ) {
122
-				if ( count( $result ) > 0 ) {
123
-					update_term_meta( $term_id, self::ENTITIES_PRESENT_FOR_TERM, 1 );
121
+			if (false !== $result) {
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
 		 *
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/menu/badge/class-badge-generator.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,38 +10,38 @@
 block discarded – undo
10 10
  */
11 11
 class Badge_Generator {
12 12
 
13
-	/**
14
-	 * Returns the term count which needs to be shown on ui.
15
-	 *
16
-	 * @param $number
17
-	 *
18
-	 * @return int
19
-	 */
20
-	public static function get_ui_count( $number ) {
21
-
22
-		$number = (int) $number;
23
-
24
-		if ( $number < 100 ) {
25
-			return $number;
26
-		}
27
-
28
-		return 100;
29
-	}
30
-
31
-	public static function generate_html( $number ) {
32
-		$count_string = self::get_formatted_count_string( $number );
33
-		return "<span class=\"wl-admin-menu-badge\">$count_string</span>";
34
-	}
35
-
36
-	/**
37
-	 * @param $number
38
-	 *
39
-	 * @return string
40
-	 */
41
-	public static function get_formatted_count_string( $number ) {
42
-		$round = self::get_ui_count( $number );
43
-
44
-		return $round < 100 ? "$round" : "$round+";
45
-	}
13
+    /**
14
+     * Returns the term count which needs to be shown on ui.
15
+     *
16
+     * @param $number
17
+     *
18
+     * @return int
19
+     */
20
+    public static function get_ui_count( $number ) {
21
+
22
+        $number = (int) $number;
23
+
24
+        if ( $number < 100 ) {
25
+            return $number;
26
+        }
27
+
28
+        return 100;
29
+    }
30
+
31
+    public static function generate_html( $number ) {
32
+        $count_string = self::get_formatted_count_string( $number );
33
+        return "<span class=\"wl-admin-menu-badge\">$count_string</span>";
34
+    }
35
+
36
+    /**
37
+     * @param $number
38
+     *
39
+     * @return string
40
+     */
41
+    public static function get_formatted_count_string( $number ) {
42
+        $round = self::get_ui_count( $number );
43
+
44
+        return $round < 100 ? "$round" : "$round+";
45
+    }
46 46
 
47 47
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@  discard block
 block discarded – undo
17 17
 	 *
18 18
 	 * @return int
19 19
 	 */
20
-	public static function get_ui_count( $number ) {
20
+	public static function get_ui_count($number) {
21 21
 
22 22
 		$number = (int) $number;
23 23
 
24
-		if ( $number < 100 ) {
24
+		if ($number < 100) {
25 25
 			return $number;
26 26
 		}
27 27
 
28 28
 		return 100;
29 29
 	}
30 30
 
31
-	public static function generate_html( $number ) {
32
-		$count_string = self::get_formatted_count_string( $number );
31
+	public static function generate_html($number) {
32
+		$count_string = self::get_formatted_count_string($number);
33 33
 		return "<span class=\"wl-admin-menu-badge\">$count_string</span>";
34 34
 	}
35 35
 
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return string
40 40
 	 */
41
-	public static function get_formatted_count_string( $number ) {
42
-		$round = self::get_ui_count( $number );
41
+	public static function get_formatted_count_string($number) {
42
+		$round = self::get_ui_count($number);
43 43
 
44 44
 		return $round < 100 ? "$round" : "$round+";
45 45
 	}
Please login to merge, or discard this patch.
src/wordlift/vocabulary/pages/class-match-terms.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -12,54 +12,54 @@
 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
-		remove_submenu_page( 'wl_admin_menu', 'wl_admin_menu' );
43
-	}
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
+        remove_submenu_page( 'wl_admin_menu', 'wl_admin_menu' );
43
+    }
44 44
 
45
-	public function submenu_page_callback() {
45
+    public function submenu_page_callback() {
46 46
 
47
-		Scripts_Helper::enqueue_based_on_wordpress_version(
48
-			'wl-vocabulary-reconcile-script',
49
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary',
50
-			array( 'react', 'react-dom', 'wp-i18n', 'wp-polyfill' ),
51
-			true
52
-		);
47
+        Scripts_Helper::enqueue_based_on_wordpress_version(
48
+            'wl-vocabulary-reconcile-script',
49
+            plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary',
50
+            array( 'react', 'react-dom', 'wp-i18n', 'wp-polyfill' ),
51
+            true
52
+        );
53 53
 
54
-		wp_enqueue_style(
55
-			'wl-vocabulary-reconcile-script',
56
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary.full.css',
57
-			array(),
58
-			WORDLIFT_VERSION
59
-		);
60
-		wp_localize_script( 'wl-vocabulary-reconcile-script', '_wlVocabularyMatchTermsConfig', Api_Config::get_api_config() );
61
-		echo "<div id='wl_cmkg_reconcile_progress' class='wrap'></div>";
62
-		echo "<div id='wl_cmkg_table' class='wrap'></div>";
63
-	}
54
+        wp_enqueue_style(
55
+            'wl-vocabulary-reconcile-script',
56
+            plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary.full.css',
57
+            array(),
58
+            WORDLIFT_VERSION
59
+        );
60
+        wp_localize_script( 'wl-vocabulary-reconcile-script', '_wlVocabularyMatchTermsConfig', Api_Config::get_api_config() );
61
+        echo "<div id='wl_cmkg_reconcile_progress' class='wrap'></div>";
62
+        echo "<div id='wl_cmkg_table' class='wrap'></div>";
63
+    }
64 64
 
65 65
 }
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,31 +33,31 @@  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
-		remove_submenu_page( 'wl_admin_menu', 'wl_admin_menu' );
42
+		remove_submenu_page('wl_admin_menu', 'wl_admin_menu');
43 43
 	}
44 44
 
45 45
 	public function submenu_page_callback() {
46 46
 
47 47
 		Scripts_Helper::enqueue_based_on_wordpress_version(
48 48
 			'wl-vocabulary-reconcile-script',
49
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary',
50
-			array( 'react', 'react-dom', 'wp-i18n', 'wp-polyfill' ),
49
+			plugin_dir_url(dirname(dirname(__DIR__))).'js/dist/vocabulary',
50
+			array('react', 'react-dom', 'wp-i18n', 'wp-polyfill'),
51 51
 			true
52 52
 		);
53 53
 
54 54
 		wp_enqueue_style(
55 55
 			'wl-vocabulary-reconcile-script',
56
-			plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary.full.css',
56
+			plugin_dir_url(dirname(dirname(__DIR__))).'js/dist/vocabulary.full.css',
57 57
 			array(),
58 58
 			WORDLIFT_VERSION
59 59
 		);
60
-		wp_localize_script( 'wl-vocabulary-reconcile-script', '_wlVocabularyMatchTermsConfig', Api_Config::get_api_config() );
60
+		wp_localize_script('wl-vocabulary-reconcile-script', '_wlVocabularyMatchTermsConfig', Api_Config::get_api_config());
61 61
 		echo "<div id='wl_cmkg_reconcile_progress' class='wrap'></div>";
62 62
 		echo "<div id='wl_cmkg_table' class='wrap'></div>";
63 63
 	}
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/term-data/class-term-data-factory.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,26 +4,26 @@
 block discarded – undo
4 4
 use Wordlift\Vocabulary\Analysis_Service;
5 5
 
6 6
 class Term_Data_Factory {
7
-	/**
8
-	 * @var Analysis_Service
9
-	 */
10
-	private $analysis_service;
7
+    /**
8
+     * @var Analysis_Service
9
+     */
10
+    private $analysis_service;
11 11
 
12
-	/**
13
-	 * @var Analysis_Service
14
-	 */
15
-	public function __construct( $analysis_service ) {
16
-		$this->analysis_service = $analysis_service;
17
-	}
12
+    /**
13
+     * @var Analysis_Service
14
+     */
15
+    public function __construct( $analysis_service ) {
16
+        $this->analysis_service = $analysis_service;
17
+    }
18 18
 
19
-	/**
20
-	 * @param $term \WP_Term
21
-	 *
22
-	 * @return Term_Data
23
-	 */
24
-	public function get_term_data( $term ) {
25
-		$entities = $this->analysis_service->get_entities( $term );
26
-		return new Default_Term_Data( $term, $entities );
27
-	}
19
+    /**
20
+     * @param $term \WP_Term
21
+     *
22
+     * @return Term_Data
23
+     */
24
+    public function get_term_data( $term ) {
25
+        $entities = $this->analysis_service->get_entities( $term );
26
+        return new Default_Term_Data( $term, $entities );
27
+    }
28 28
 
29 29
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	/**
13 13
 	 * @var Analysis_Service
14 14
 	 */
15
-	public function __construct( $analysis_service ) {
15
+	public function __construct($analysis_service) {
16 16
 		$this->analysis_service = $analysis_service;
17 17
 	}
18 18
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @return Term_Data
23 23
 	 */
24
-	public function get_term_data( $term ) {
25
-		$entities = $this->analysis_service->get_entities( $term );
26
-		return new Default_Term_Data( $term, $entities );
24
+	public function get_term_data($term) {
25
+		$entities = $this->analysis_service->get_entities($term);
26
+		return new Default_Term_Data($term, $entities);
27 27
 	}
28 28
 
29 29
 }
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/term-data/class-term-data.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 
9 9
 interface Term_Data {
10 10
 
11
-	/**
12
-	 * Should return an array which can be used by ui components.
13
-	 *
14
-	 * @return array
15
-	 */
16
-	public function get_data();
11
+    /**
12
+     * Should return an array which can be used by ui components.
13
+     *
14
+     * @return array
15
+     */
16
+    public function get_data();
17 17
 
18 18
 }
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/entity-list/class-entity-list-utils.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -12,52 +12,52 @@
 block discarded – undo
12 12
  */
13 13
 class Entity_List_Utils {
14 14
 
15
-	/**
16
-	 * @param $term_id int Term id.
17
-	 * @param $entities array An array of entities
18
-	 *
19
-	 * @return array<array> An Array of entities with isActive filter.
20
-	 */
21
-	public static function mark_is_active_for_entities( $term_id, $entities ) {
22
-
23
-		$active_entities = self::get_active_entities( $term_id );
24
-
25
-		if ( ! is_array( $entities ) ) {
26
-			return $entities;
27
-		}
28
-
29
-		foreach ( $entities as &$entity ) {
30
-			$entity_id          = $entity['entityId'];
31
-			$entity['isActive'] = in_array( $entity_id, $active_entities, true );
32
-		}
33
-
34
-		return $entities;
35
-	}
36
-
37
-	/**
38
-	 * @param $term_id
39
-	 *
40
-	 * @return array<string> An array of Entity URIs
41
-	 */
42
-	public static function get_active_entities( $term_id ) {
43
-
44
-		// retrieve jsonld data.
45
-		$entity = Entity_List_Factory::get_instance( $term_id );
46
-
47
-		$entity_data_list = $entity->get_jsonld_data();
48
-
49
-		$active_entity_ids = array();
50
-
51
-		foreach ( $entity_data_list as $item ) {
52
-			$sameas = $item['sameAs'];
53
-			if ( is_array( $sameas ) && count( $sameas ) > 0 ) {
54
-				// The entity id is stored on last position, so
55
-				// we get the entity id from there.
56
-				$active_entity_ids[] = array_pop( $sameas );
57
-			}
58
-		}
59
-
60
-		return $active_entity_ids;
61
-	}
15
+    /**
16
+     * @param $term_id int Term id.
17
+     * @param $entities array An array of entities
18
+     *
19
+     * @return array<array> An Array of entities with isActive filter.
20
+     */
21
+    public static function mark_is_active_for_entities( $term_id, $entities ) {
22
+
23
+        $active_entities = self::get_active_entities( $term_id );
24
+
25
+        if ( ! is_array( $entities ) ) {
26
+            return $entities;
27
+        }
28
+
29
+        foreach ( $entities as &$entity ) {
30
+            $entity_id          = $entity['entityId'];
31
+            $entity['isActive'] = in_array( $entity_id, $active_entities, true );
32
+        }
33
+
34
+        return $entities;
35
+    }
36
+
37
+    /**
38
+     * @param $term_id
39
+     *
40
+     * @return array<string> An array of Entity URIs
41
+     */
42
+    public static function get_active_entities( $term_id ) {
43
+
44
+        // retrieve jsonld data.
45
+        $entity = Entity_List_Factory::get_instance( $term_id );
46
+
47
+        $entity_data_list = $entity->get_jsonld_data();
48
+
49
+        $active_entity_ids = array();
50
+
51
+        foreach ( $entity_data_list as $item ) {
52
+            $sameas = $item['sameAs'];
53
+            if ( is_array( $sameas ) && count( $sameas ) > 0 ) {
54
+                // The entity id is stored on last position, so
55
+                // we get the entity id from there.
56
+                $active_entity_ids[] = array_pop( $sameas );
57
+            }
58
+        }
59
+
60
+        return $active_entity_ids;
61
+    }
62 62
 
63 63
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return array<array> An Array of entities with isActive filter.
20 20
 	 */
21
-	public static function mark_is_active_for_entities( $term_id, $entities ) {
21
+	public static function mark_is_active_for_entities($term_id, $entities) {
22 22
 
23
-		$active_entities = self::get_active_entities( $term_id );
23
+		$active_entities = self::get_active_entities($term_id);
24 24
 
25
-		if ( ! is_array( $entities ) ) {
25
+		if ( ! is_array($entities)) {
26 26
 			return $entities;
27 27
 		}
28 28
 
29
-		foreach ( $entities as &$entity ) {
29
+		foreach ($entities as &$entity) {
30 30
 			$entity_id          = $entity['entityId'];
31
-			$entity['isActive'] = in_array( $entity_id, $active_entities, true );
31
+			$entity['isActive'] = in_array($entity_id, $active_entities, true);
32 32
 		}
33 33
 
34 34
 		return $entities;
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return array<string> An array of Entity URIs
41 41
 	 */
42
-	public static function get_active_entities( $term_id ) {
42
+	public static function get_active_entities($term_id) {
43 43
 
44 44
 		// retrieve jsonld data.
45
-		$entity = Entity_List_Factory::get_instance( $term_id );
45
+		$entity = Entity_List_Factory::get_instance($term_id);
46 46
 
47 47
 		$entity_data_list = $entity->get_jsonld_data();
48 48
 
49 49
 		$active_entity_ids = array();
50 50
 
51
-		foreach ( $entity_data_list as $item ) {
51
+		foreach ($entity_data_list as $item) {
52 52
 			$sameas = $item['sameAs'];
53
-			if ( is_array( $sameas ) && count( $sameas ) > 0 ) {
53
+			if (is_array($sameas) && count($sameas) > 0) {
54 54
 				// The entity id is stored on last position, so
55 55
 				// we get the entity id from there.
56
-				$active_entity_ids[] = array_pop( $sameas );
56
+				$active_entity_ids[] = array_pop($sameas);
57 57
 			}
58 58
 		}
59 59
 
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/entity-list/class-entity-list-factory.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
  */
8 8
 class Entity_List_Factory {
9 9
 
10
-	public static function get_instance( $term_id ) {
11
-		return new Default_Entity_List( $term_id, new Legacy_Entity_List( $term_id ) );
12
-	}
10
+    public static function get_instance( $term_id ) {
11
+        return new Default_Entity_List( $term_id, new Legacy_Entity_List( $term_id ) );
12
+    }
13 13
 
14 14
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
  */
8 8
 class Entity_List_Factory {
9 9
 
10
-	public static function get_instance( $term_id ) {
11
-		return new Default_Entity_List( $term_id, new Legacy_Entity_List( $term_id ) );
10
+	public static function get_instance($term_id) {
11
+		return new Default_Entity_List($term_id, new Legacy_Entity_List($term_id));
12 12
 	}
13 13
 
14 14
 }
Please login to merge, or discard this patch.