SegmentManager   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 28
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A query() 0 16 2
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 6
    public function query()
20
    {
21 6
        $url = '/segments';
22
23
        // Now make the request.
24 6
        $request = new Request('GET', $url);
25 6
        $data = $this->getResponseJson($request);
26
27
        // Get them as Segment objects
28 3
        $segments = [];
29 3
        foreach ($data as $dataItem) {
30 3
            $segments[] = new Segment($dataItem);
31 2
        }
32
33 3
        return $segments;
34
    }
35
}
36