testmonitor /
donedone-client
| 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
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 |