Github::repos()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 5
crap 1
1
<?php
2
3
namespace Rs\VersionEye\Api;
4
5
/**
6
 * Github Api.
7
 *
8
 * @author Robert Schönthal <[email protected]>
9
 *
10
 * @see https://www.versioneye.com/api/v2/swagger_doc/github
11
 */
12
class Github extends BaseApi implements Api
13
{
14
    /**
15
     * lists your's github repos.
16
     *
17
     * @param string $language
18
     * @param bool   $private
19
     * @param string $organization
20
     * @param string $type
21
     * @param bool   $imported
22
     *
23
     * @return array
24
     */
25 1
    public function repos($language = null, $private = null, $organization = null, $type = null, $imported = null)
26
    {
27 1
        return $this->request(sprintf('github?lang=%s&private=%b&org_name=%s&org_type=%s&page=%d&only_imported=%b',
28 1
            $language, $private, $organization, $type, 1, $imported
29
        ));
30
    }
31
32
    /**
33
     * re-load github data.
34
     *
35
     * @return array
36
     */
37 1
    public function sync()
38
    {
39 1
        return $this->request('github/sync');
40
    }
41
42
    /**
43
     * shows the detailed information for the repository.
44
     *
45
     * @param string $repository
46
     *
47
     * @return array
48
     */
49 1
    public function show($repository)
50
    {
51 1
        return $this->request('github/' . $this->transform($repository));
52
    }
53
54
    /**
55
     * imports project file from github.
56
     *
57
     * @param string $repository
58
     * @param string $branch
59
     * @param string $file
60
     *
61
     * @return array
62
     */
63 1
    public function import($repository, $branch = null, $file = null)
64
    {
65 1
        return $this->request(sprintf('github/%s?branch=%s&file=%s', $this->transform($repository), $branch, $file), 'POST');
66
    }
67
68
    /**
69
     * remove imported project.
70
     *
71
     * @param string $repository
72
     * @param string $branch
73
     * @param string $file
74
     *
75
     * @return array
76
     */
77 1
    public function delete($repository, $branch = null, $file = null)
78
    {
79 1
        return $this->request(sprintf('github/%s?branch=%s&file=%s', $this->transform($repository), $branch, $file), 'DELETE');
80
    }
81
82
    /**
83
     * GitHub Hook.
84
     *
85
     * @param string $project
86
     *
87
     * @return array
88
     */
89 1
    public function hook($project)
90
    {
91 1
        return $this->request(sprintf('github/hook/%s', $project), 'POST');
92
    }
93
}
94