Stage   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 37
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A findAll() 0 4 1
A find() 0 4 1
A delete() 0 4 1
A create() 0 8 1
A edit() 0 8 1
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