WordPress_GitHub_Sync_Api   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 58
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A fetch() 0 7 2
A persist() 0 7 2
1
<?php
2
/**
3
 * Interfaces with the GitHub API
4
 * @package WordPress_GitHub_Sync
5
 */
6
7
/**
8
 * Class WordPress_GitHub_Sync_Api
9
 */
10
class WordPress_GitHub_Sync_Api {
11
12
	/**
13
	 * Application container.
14
	 *
15
	 * @var WordPress_GitHub_Sync
16
	 */
17
	protected $app;
18
19
	/**
20
	 * GitHub fetch client.
21
	 *
22
	 * @var WordPress_GitHub_Sync_Fetch_Client
23
	 */
24
	protected $fetch;
25
26
	/**
27
	 * Github persist client.
28
	 *
29
	 * @var WordPress_GitHub_Sync_Persist_Client
30
	 */
31
	protected $persist;
32
33
	/**
34
	 * Instantiates a new Api object.
35
	 *
36
	 * @param WordPress_GitHub_Sync $app Application container.
37
	 */
38 2
	public function __construct( WordPress_GitHub_Sync $app ) {
39 2
		$this->app = $app;
40 2
	}
41
42
	/**
43
	 * Lazy-load fetch client.
44
	 *
45
	 * @return WordPress_GitHub_Sync_Fetch_Client
46
	 */
47 1
	public function fetch() {
48 1
		if ( ! $this->fetch ) {
49 1
			$this->fetch = new WordPress_GitHub_Sync_Fetch_Client( $this->app );
50 1
		}
51
52 1
		return $this->fetch;
53
	}
54
55
	/**
56
	 * Lazy-load persist client.
57
	 *
58
	 * @return WordPress_GitHub_Sync_Persist_Client
59
	 */
60 1
	public function persist() {
61 1
		if ( ! $this->persist ) {
62 1
			$this->persist = new WordPress_GitHub_Sync_Persist_Client( $this->app );
63 1
		}
64
65 1
		return $this->persist;
66
	}
67
}
68