Completed
Push — master ( 97dfc1...bb1c5d )
by Konstantin
14:18
created

ResultSet::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 11
ccs 8
cts 8
cp 1
rs 9.4286
cc 2
eloc 6
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Brouzie\Sphinxy\Query;
4
5
class ResultSet extends SimpleResultSet
6
{
7
    protected $meta;
8
9 3
    public function __construct(array $result, array $rawMeta)
10
    {
11 3
        parent::__construct($result);
12
13 3
        $meta = array();
14 3
        foreach ($rawMeta as $row) {
15 3
            $meta[$row['Variable_name']] = $row['Value'];
16 3
        }
17
18 3
        $this->meta = $meta;
19 3
    }
20
21
    public function getMeta()
22
    {
23
        return $this->meta;
24
    }
25
26
    public function getAllowedCount()
27
    {
28
        return (int)$this->meta['total'];
29
    }
30
31
    public function getTotalCount()
32
    {
33
        return (int)$this->meta['total_found'];
34
    }
35
}
36