Code Duplication    Length = 14-14 lines in 4 locations

src/Endpoint/Newsfeed.php 3 locations

@@ 9-22 (lines=14) @@
6
{
7
    const ENDPOINT = 'newsfeed';
8
9
    public function pipeline($pipelineKey, $detailLevel = null)
10
    {
11
        $options = [];
12
13
        if (null !== $detailLevel) {
14
            if (!in_array($detailLevel, ['ALL', 'CONDENSED'])) {
15
                throw new \InvalidArgumentException('Invalid detail field.');
16
            }
17
18
            $options['query'] = ['detailLevel' => $detailLevel];
19
        }
20
21
        return $this->client->get(sprintf('pipelines/%s/%s', $pipelineKey, self::ENDPOINT), $options);
22
    }
23
24
    public function box($boxKey, $detailLevel = null)
25
    {
@@ 24-37 (lines=14) @@
21
        return $this->client->get(sprintf('pipelines/%s/%s', $pipelineKey, self::ENDPOINT), $options);
22
    }
23
24
    public function box($boxKey, $detailLevel = null)
25
    {
26
        $options = [];
27
28
        if (null !== $detailLevel) {
29
            if (!in_array($detailLevel, ['ALL', 'CONDENSED'])) {
30
                throw new \InvalidArgumentException('Invalid detail field.');
31
            }
32
33
            $options['query'] = ['detailLevel' => $detailLevel];
34
        }
35
36
        return $this->client->get(sprintf('boxes/%s/%s', $boxKey, self::ENDPOINT), $options);
37
    }
38
39
    public function all($detailLevel = null)
40
    {
@@ 39-52 (lines=14) @@
36
        return $this->client->get(sprintf('boxes/%s/%s', $boxKey, self::ENDPOINT), $options);
37
    }
38
39
    public function all($detailLevel = null)
40
    {
41
        $options = [];
42
43
        if (null !== $detailLevel) {
44
            if (!in_array($detailLevel, ['ALL', 'CONDENSED'])) {
45
                throw new \InvalidArgumentException('Invalid detail field.');
46
            }
47
48
            $options['query'] = ['detailLevel' => $detailLevel];
49
        }
50
51
        return $this->client->get(self::ENDPOINT, $options);
52
    }
53
}
54

src/Endpoint/Pipeline.php 1 location

@@ 9-22 (lines=14) @@
6
{
7
    const ENDPOINT = 'pipelines';
8
9
    public function all($sortBy = null)
10
    {
11
        $options = [];
12
13
        if (null !== $sortBy) {
14
            if (!in_array($sortBy, ['creationTimestamp', 'lastUpdatedTimestamp'])) {
15
                throw new \InvalidArgumentException('Invalid sort field.');
16
            }
17
18
            $options['query'] = ['sortBy' => $sortBy];
19
        }
20
21
        return $this->client->get(self::ENDPOINT, $options);
22
    }
23
24
    public function find($pipelineKey)
25
    {