Completed
Push — master ( 7b6a9e...621ea2 )
by Nick
15:23
created

SegmentManager::query()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 8

Duplication

Lines 16
Ratio 100 %

Importance

Changes 0
Metric Value
dl 16
loc 16
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 0
1
<?php
2
3
namespace Acquia\LiftClient\Manager;
4
5
use Acquia\LiftClient\Entity\Segment;
6
use GuzzleHttp\Psr7\Request;
7
8
class SegmentManager extends ManagerBase
9
{
10
    /**
11
     * Get a list of Segments.
12
     *
13
     * @see http://docs.decision-api.acquia.com/#goals_get
14
     *
15
     * @throws \GuzzleHttp\Exception\RequestException
16
     *
17
     * @return \Acquia\LiftClient\Entity\Segment[]
18
     */
19 View Code Duplication
    public function query()
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        $url = '/segments';
22
23
        // Now make the request.
24
        $request = new Request('GET', $url);
25
        $data = $this->client->getResponseJson($request);
26
27
        // Get them as Segment objects
28
        $segments = [];
29
        foreach ($data as $dataItem) {
30
            $segments[] = new Segment($dataItem);
31
        }
32
33
        return $segments;
34
    }
35
}
36