Completed
Push — master ( 7e8e79...1f43e8 )
by Hung
02:20 queued 20s
created

ResultSet   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 59
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getResultObject() 0 4 1
A getConnection() 0 4 1
A getMysqliConnection() 0 4 1
1
<?php
2
3
namespace Foolz\SphinxQL\Drivers\Mysqli;
4
5
use Foolz\SphinxQL\Exception\ConnectionException;
6
use Foolz\SphinxQL\Drivers\ResultSetBase;
7
8
class ResultSet extends ResultSetBase
9
{
10
    /**
11
     * @var Connection
12
     */
13
    protected $connection;
14
15
    /**
16
     * @var \mysqli_result
17
     */
18
    protected $result;
19
20
    /**
21
     * @param Connection $connection
22
     * @param null|\mysqli_result $result
23
     */
24
    public function __construct(Connection $connection, $result = null)
25
    {
26
        $this->connection = $connection;
27
        $this->adapter = new ResultSetAdapter($connection, $result);
28
        $this->result = $result;
29
        $this->init();
30
    }
31
32
    /**
33
     * Get the result object returned by PHP's MySQLi
34
     *
35
     * @return \mysqli_result
36
     *
37
     * @codeCoverageIgnore
38
     */
39
    public function getResultObject()
40
    {
41
        return $this->result;
42
    }
43
44
    /**
45
     * Get the MySQLi connection wrapper object
46
     *
47
     * @return Connection
48
     *
49
     * @codeCoverageIgnore
50
     */
51
    public function getConnection()
52
    {
53
        return $this->connection;
54
    }
55
56
    /**
57
     * Get the PHP MySQLi object
58
     *
59
     * @return \mysqli
60
     * @throws ConnectionException
61
     */
62
    public function getMysqliConnection()
63
    {
64
        return $this->connection->getConnection();
65
    }
66
}
67