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

ResultSet   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 57.14%

Importance

Changes 6
Bugs 0 Features 2
Metric Value
wmc 5
c 6
b 0
f 2
lcom 1
cbo 1
dl 0
loc 31
ccs 8
cts 14
cp 0.5714
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getMeta() 0 4 1
A getAllowedCount() 0 4 1
A getTotalCount() 0 4 1
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