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

ResultSet::getMeta()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
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