Completed
Pull Request — develop (#1328)
by Naveen
02:55
created

Term_Data_Factory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get_term_data() 0 4 1
1
<?php
2
namespace Wordlift\Vocabulary\Data\Term_Data;
3
4
use Wordlift\Vocabulary\Analysis_Service;
5
6
class Term_Data_Factory {
7
	/**
8
	 * @var Analysis_Service
9
	 */
10
	private $analysis_service;
11
12
	/**
13
	 * @var Analysis_Service
14
	 */
15
	public function __construct( $analysis_service ) {
16
		$this->analysis_service = $analysis_service;
17
	}
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
	}
28
29
30
}