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

Sql   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A getResponse() 0 10 5
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