Completed
Pull Request — develop (#1282)
by David
02:58
created

Sync_Term_Adapter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A is_published() 0 3 1
A is_public() 0 5 1
1
<?php
2
3
namespace Wordlift\Dataset;
4
5
use Wordlift\Object_Type_Enum;
6
7
class Sync_Term_Adapter extends Abstract_Sync_Object_Adapter {
8
	/**
9
	 * @var int
10
	 */
11
	private $term_id;
12
13
	/**
14
	 * Sync_Term_Adapter constructor.
15
	 *
16
	 * @param int $term_id
17
	 *
18
	 * @throws \Exception
19
	 */
20
	function __construct( $term_id ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
21
		parent::__construct( Object_Type_Enum::TERM, $term_id );
22
23
		$this->term_id = $term_id;
24
	}
25
26
	function is_published() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
		return $this->is_public();
28
	}
29
30
	function is_public() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
31
		$term = get_term( $this->term_id );
32
33
		return get_taxonomy( $term->taxonomy )->public;
34
	}
35
36
}
37