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

Default_Term_Data::get_data()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
1
<?php
2
/**
3
 * @since 3.30.0
4
 * @author Naveen Muthusamy <[email protected]>
5
 * This class constructs the term data structure from the analysis service.
6
 */
7
8
namespace Wordlift\Vocabulary\Data\Term_Data;
9
10
class Default_Term_Data implements Term_Data {
11
12
	/**
13
	 * @var array An array of entities bound to the term.
14
	 */
15
	private $entities;
16
	/**
17
	 * @var \WP_Term
18
	 */
19
	private $term;
20
21
	public function __construct( $term, $entities ) {
22
		$this->term     = $term;
23
		$this->entities = $entities;
24
	}
25
26
	public function get_data() {
27
28
		return array(
29
			'tagId'          => $this->term->term_id,
30
			'tagName'        => $this->term->name,
31
			'tagDescription' => $this->term->description,
32
			'tagLink'        => get_edit_tag_link( $this->term->term_id, 'post_tag' ),
33
			'tagPostCount'   => $this->term->count,
34
			'entities'       => $this->entities,
35
		);
36
	}
37
}