Code Duplication    Length = 12-12 lines in 3 locations

src/Endpoint/Pipeline.php 1 location

@@ 45-56 (lines=12) @@
42
        return $this->client->delete(sprintf('%s/%s', self::ENDPOINT, $pipelineKey));
43
    }
44
45
    public function edit($pipelineKey, array $pipeline)
46
    {
47
        foreach ($pipeline as $field => $value) {
48
            if (!in_array($field, ['name', 'description', 'stageOrder', 'orgWide', 'aclEntries'])) {
49
                throw new \InvalidArgumentException('Not allowed field.');
50
            }
51
        }
52
53
        return $this->client->post(sprintf('%s/%s', self::ENDPOINT, $pipelineKey), [
54
            'json' => $pipeline,
55
        ]);
56
    }
57
}
58

src/Endpoint/Task.php 1 location

@@ 34-45 (lines=12) @@
31
        return $this->client->delete(sprintf('api/v2/%s/%s', self::ENDPOINT, $taskKey));
32
    }
33
34
    public function edit($taskKey, array $task)
35
    {
36
        foreach ($task as $field => $value) {
37
            if (!in_array($field, ['text', 'dueDate', 'assignedToSharingEntries'])) {
38
                throw new \InvalidArgumentException('Not allowed field.');
39
            }
40
        }
41
42
        return $this->client->post(sprintf('/api/v2/%s/%s', self::ENDPOINT, $taskKey), [
43
            'json' => $task,
44
        ]);
45
    }
46
}
47

src/Endpoint/Box.php 1 location

@@ 60-71 (lines=12) @@
57
        return $this->client->delete(sprintf('%s/%s', self::ENDPOINT, $boxKey));
58
    }
59
60
    public function edit($boxKey, array $box)
61
    {
62
        foreach ($box as $field => $value) {
63
            if (!in_array($field, ['name', 'notes', 'stageKey', 'followerKeys', 'fields'])) {
64
                throw new \InvalidArgumentException('Not allowed field.');
65
            }
66
        }
67
68
        return $this->client->post(sprintf('%s/%s', self::ENDPOINT, $boxKey), [
69
            'json' => $box,
70
        ]);
71
    }
72
73
    public function find($boxKey)
74
    {