Completed
Push — master ( 6730cd...13507f )
by J.D.
03:41
created

WordPoints_Entity_Context_Site   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get_current_id() 0 13 3
1
<?php
2
3
/**
4
 * Site entity context class.
5
 *
6
 * @package wordpoints-hooks-api
7
 * @since   1.0.0
8
 */
9
10
/**
11
 * Represents the site context.
12
 *
13
 * On multisite installs there are many "sites" on a "network".
14
 *
15
 * @since 1.0.0
16
 */
17
class WordPoints_Entity_Context_Site extends WordPoints_Entity_Context {
18
19
	/**
20
	 * @since 1.0.0
21
	 */
22
	public function get_current_id() {
23
24
		if ( ! is_multisite() ) {
25
			return 1;
26
		}
27
28
		// Todo special handling for Ajax, ect.
29
		if ( is_network_admin() ) {
30
			return false;
31
		}
32
33
		return get_current_blog_id();
34
	}
35
}
36
37
// EOF
38