ManagesProjects   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A projects() 0 7 2
A project() 0 5 1
1
<?php
2
3
namespace TestMonitor\DoneDone\Actions;
4
5
use TestMonitor\DoneDone\Resources\Project;
6
use TestMonitor\DoneDone\Transforms\TransformsProjects;
7
8
trait ManagesProjects
9
{
10
    use TransformsProjects;
11
12
    /**
13
     * Get a list of of projects.
14
     *
15
     * @param int $accountId
16
     * @return Project[]
17
     */
18 7
    public function projects(int $accountId): array
19
    {
20 7
        $result = $this->get("{$accountId}/internal-projects");
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

20
        /** @scrutinizer ignore-call */ 
21
        $result = $this->get("{$accountId}/internal-projects");
Loading history...
21
22 1
        return array_map(function ($project) {
23 1
            return $this->fromDoneDoneProject($project);
24 1
        }, is_array($result) ? $result : []);
25
    }
26
27
    /**
28
     * Get a single project.
29
     *
30
     * @param int $accountId
31
     * @param int $id
32
     * @return Project
33
     */
34 1
    public function project(int $accountId, int $id): Project
35
    {
36 1
        $result = $this->get("{$accountId}/internal-projects/{$id}");
37
38 1
        return $this->fromDoneDoneProject($result);
39
    }
40
}
41