Projects::merge()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Rs\VersionEye\Api;
4
5
/**
6
 * Projects API.
7
 *
8
 * @author Robert Schönthal <[email protected]>
9
 *
10
 * @see https://www.versioneye.com/api/v2/swagger_doc/projects
11
 */
12
class Projects extends BaseApi implements Api
13
{
14
    /**
15
     * shows user`s projects.
16
     *
17
     * @param string $orgaName
18
     * @param string $teamName
19
     *
20
     * @return array
21
     */
22 1
    public function all($orgaName, $teamName = null)
23
    {
24 1
        return $this->request('projects', 'GET', ['orga_name' => $orgaName, 'team_name' => $teamName]);
25
    }
26
27
    /**
28
     * shows the project's information.
29
     *
30
     * @param string $project
31
     *
32
     * @return array
33
     */
34 1
    public function show($project)
35
    {
36 1
        return $this->request('projects/' . $project);
37
    }
38
39
    /**
40
     * delete given project.
41
     *
42
     * @param string $project
43
     *
44
     * @return array
45
     */
46 1
    public function delete($project)
47
    {
48 1
        return $this->request('projects/' . $project, 'DELETE');
49
    }
50
51
    /**
52
     * upload project file.
53
     *
54
     * @param string $file
55
     *
56
     * @return array
57
     */
58 1
    public function create($file)
59
    {
60 1
        return $this->request('projects', 'POST', ['upload' => $file]);
61
    }
62
63
    /**
64
     * update project with new file.
65
     *
66
     * @param string $project
67
     * @param string $file
68
     *
69
     * @return array
70
     */
71 1
    public function update($project, $file)
72
    {
73 1
        return $this->request('projects/' . $project, 'POST', ['project_file' => $file]);
74
    }
75
76
    /**
77
     * get grouped view of licences for dependencies.
78
     *
79
     * @param string $project
80
     *
81
     * @return array
82
     */
83 1
    public function licenses($project)
84
    {
85 1
        return $this->request(sprintf('projects/%s/licenses', $project));
86
    }
87
88
    /**
89
     * merge two projects together.
90
     *
91
     * @param string $parent
92
     * @param string $child
93
     *
94
     * @return array
95
     */
96 1
    public function merge($parent, $child)
97
    {
98 1
        return $this->request(sprintf('projects/%s/merge/%s', $parent, $child));
99
    }
100
101
    /**
102
     * unmerge two projects.
103
     *
104
     * @param string $parent
105
     * @param string $child
106
     *
107
     * @return array
108
     */
109 1
    public function unmerge($parent, $child)
110
    {
111 1
        return $this->request(sprintf('projects/%s/unmerge/%s', $parent, $child));
112
    }
113
114
    /**
115
     * merge two projects together (only for maven projects).
116
     *
117
     * @param string $group
118
     * @param string $artifact
119
     * @param string $child
120
     *
121
     * @return array
122
     */
123 1
    public function mergeGa($group, $artifact, $child)
124
    {
125 1
        return $this->request(sprintf('projects/%s/%s/merge_ga/%s', $group, $artifact, $child));
126
    }
127
}
128