Stage::findAll()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Streak\Endpoint;
4
5
class Stage extends PipelineEndpoint
6
{
7
    const ENDPOINT = 'stages';
8
9
    public function findAll()
10
    {
11
        return $this->client->get(sprintf('pipelines/%s/%s', $this->pipelineKey, self::ENDPOINT));
12
    }
13
14
    public function find($stageKey)
15
    {
16
        return $this->client->get(sprintf('pipelines/%s/%s/%s', $this->pipelineKey, self::ENDPOINT, $stageKey));
17
    }
18
19
    public function create($name)
20
    {
21
        return $this->client->put(sprintf('pipelines/%s/%s', $this->pipelineKey, self::ENDPOINT), [
22
            'form_params' => [
23
                'name' => $name,
24
            ],
25
        ]);
26
    }
27
28
    public function delete($stageKey)
29
    {
30
        return $this->client->delete(sprintf('pipelines/%s/%s/%s', $this->pipelineKey, self::ENDPOINT, $stageKey));
31
    }
32
33
    public function edit($stageKey, $name)
34
    {
35
        return $this->client->post(sprintf('pipelines/%s/%s/%s', $this->pipelineKey, self::ENDPOINT, $stageKey), [
36
            'json' => [
37
                'name' => $name,
38
            ],
39
        ]);
40
    }
41
}
42