Passed
Push — master ( c49c5c...b9f447 )
by
unknown
02:38
created

Sql::getResponse()   A

Complexity

Conditions 5
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 5
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 10
rs 9.6111
1
<?php
2
3
namespace Manticoresearch\Response;
4
5
use Manticoresearch\Response;
6
7
class Sql extends Response
8
{
9
    public function getResponse()
10
    {
11
        $response = parent::getResponse();
12
        // workaround for the change in Manticore Search made in 4.2.1, after
13
        // which any query in mode=raw returns an array
14
        if (is_array($response) and count($response) === 1 and isset($response[0]['total'], $response[0]['error'], $response[0]['warning'])) {
15
            foreach ($response[0] as $k=>$v) $response[$k] = $v;
16
            unset($response[0]);
17
        }
18
        return $response;
19
    }
20
}
21