Completed
Push — develop ( c2f74a...ca0510 )
by David
04:36
created

Wordlift_AMP_Service   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A register_entity_cpt_with_amp_plugin() 0 7 2
1
<?php
2
/**
3
 * Services: AMP Services.
4
 *
5
 * The file defines a class for AMP related manipulations.
6
 *
7
 * @link       https://wordlift.io
8
 *
9
 * @since      3.12.0
10
 *
11
 * @package    Wordlift
12
 * @subpackage Wordlift/public
13
 */
14
15
/**
16
 * Handles AMP related manipulation in the generated HTML of entity pages
17
 *
18
 * @since      3.12.0
19
 * @package    Wordlift
20
 * @subpackage Wordlift/public
21
 */
22
class Wordlift_AMP_Service {
23
24
	/**
25
	 * @inheritdoc
26
	 */
27
	function __construct() {
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...
28
29
		// Integrate with automattic's AMP plugin if it is available
30
		if ( defined( 'AMP__VERSION' ) ) {
31
			add_action( 'amp_init', array(
32
				$this,
33
				'register_entity_cpt_with_amp_plugin',
34
			) );
35
		}
36
37
	}
38
39
	/**
40
	 * Register the `entity` post type with the AMP plugin.
41
	 *
42
	 * @since 3.12.0
43
	 */
44
	function register_entity_cpt_with_amp_plugin() {
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...
45
46
		if ( defined( 'AMP_QUERY_VAR' ) ) {
47
			add_post_type_support( 'entity', AMP_QUERY_VAR );
48
		}
49
50
	}
51
52
}
53