Total Complexity | 5 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
17 | abstract class AbstractTerm { |
||
18 | |||
19 | /** |
||
20 | * Meta. |
||
21 | * |
||
22 | * @var MetaInterface |
||
23 | */ |
||
24 | protected $meta; |
||
25 | |||
26 | /** |
||
27 | * Construct. |
||
28 | * |
||
29 | * @param MetaInterface $meta Meta. |
||
30 | */ |
||
31 | public function __construct( MetaInterface $meta ) { |
||
32 | $this->meta = $meta; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Get term. |
||
37 | * |
||
38 | * @param integer $id Id. |
||
39 | * @return \WP_term |
||
40 | * @throws \InvalidArgumentException When $id param is empty. |
||
41 | */ |
||
42 | protected function get_term( int $id ) { |
||
43 | if ( empty( $id ) ) { |
||
44 | throw new \InvalidArgumentException( __( 'Termo vazio.', 'wpsteak' ) ); |
||
45 | } |
||
46 | |||
47 | return get_term( $id ); |
||
|
|||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Get terms. |
||
52 | * |
||
53 | * @param array $args Args. |
||
54 | * @return \WP_Term[] |
||
55 | * @throws \InvalidArgumentException When the passed taxonomy does not exists. |
||
56 | */ |
||
57 | protected function get_terms( array $args ) : array { |
||
65 | } |
||
66 | } |
||
67 |