testmonitor /
devops-client
| 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 | * |
||
| 19 | * @return \TestMonitor\DevOps\Resources\Project |
||
| 20 | */ |
||
| 21 | 4 | public function project(string $id): Project |
|
| 22 | { |
||
| 23 | 4 | $response = $this->get("_apis/projects/{$id}"); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 24 | |||
| 25 | 1 | 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 | 7 | public function projects() |
|
| 36 | { |
||
| 37 | 7 | $response = $this->get('_apis/projects'); |
|
| 38 | |||
| 39 | 1 | return $this->fromDevOpsProjects($response['value']); |
|
| 40 | } |
||
| 41 | } |
||
| 42 |