Writing_On_GitHub_Api   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 56
ccs 0
cts 13
cp 0
rs 10
wmc 5

3 Methods

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