CapturesResponse::getMatchedSegments()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 10
loc 10
ccs 7
cts 7
cp 1
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Acquia\LiftClient\Entity;
4
5
class CapturesResponse extends CaptureBase
6
{
7
    /**
8
     * Gets the 'status' parameter.
9
     *
10
     * @return LiftError[]|null The errors, if there were any
11
     */
12 9 View Code Duplication
    public function getErrors()
13
    {
14 9
        $ret = [];
15 9
        $errors = $this->getEntityValue('errors', []);
16 9
        if (empty($errors)) {
17 3
            return null;
18
        }
19 6
        foreach ($errors as $error) {
20 6
            $ret[] = new Error($error);
21 4
        }
22
23 6
        return $ret;
24
    }
25
26
    /**
27
     * Gets the 'matched_segments' parameter.
28
     *
29
     * @return Segment[]
30
     */
31 6 View Code Duplication
    public function getMatchedSegments()
32
    {
33 6
        $ret = [];
34 6
        $segments = $this->getEntityValue('matched_segments', []);
35 6
        foreach ($segments as $segment) {
36 6
            $ret[] = new Segment($segment);
37 4
        }
38
39 6
        return $ret;
40
    }
41
}
42