Passed
Push — master ( 2aa273...643aed )
by Thijs
15:11 queued 05:02
created

ManagesProjects   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 32
ccs 3
cts 3
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A projects() 0 5 1
A project() 0 5 1
1
<?php
2
3
namespace TestMonitor\DevOps\Actions;
4
5
use TestMonitor\DevOps\Resources\Project;
6
use TestMonitor\DevOps\Transforms\TransformsProjects;
7
8
trait ManagesProjects
9
{
10
    use TransformsProjects;
11
12
    /**
13
     * Get a single project.
14
     *
15
     * @param string $id
16
     *
17
     * @throws \TestMonitor\DevOps\Exceptions\InvalidDataException
18 11
     *
19
     * @return \TestMonitor\DevOps\Resources\Project
20 11
     */
21
    public function project(string $id): Project
22 1
    {
23
        $response = $this->get("_apis/projects/{$id}");
0 ignored issues
show
Bug introduced by
It seems like get() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        /** @scrutinizer ignore-call */ 
24
        $response = $this->get("_apis/projects/{$id}");
Loading history...
24
25
        return $this->fromDevOpsProject($response);
26
    }
27
28
    /**
29
     * Get a list of of projects.
30
     *
31
     * @throws \TestMonitor\DevOps\Exceptions\InvalidDataException
32
     *
33
     * @return \TestMonitor\DevOps\Resources\Project[]
34
     */
35
    public function projects()
36
    {
37
        $response = $this->get('_apis/projects');
38
39
        return $this->fromDevOpsProjects($response['value']);
40
    }
41
}
42