WordPress_GitHub_Sync_Api::persist()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
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