Processor   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 18 8
1
<?php
2
3
namespace Magister\Services\Database\Query\Processors;
4
5
use Magister\Services\Database\Query\Builder;
6
7
/**
8
 * Class Processor.
9
 */
10
class Processor
11
{
12
    /**
13
     * Process the selected results.
14
     *
15
     * @param \Magister\Services\Database\Query\Builder $builder
16
     * @param array                                     $results
17
     *
18
     * @return array
19
     */
20
    public function process(Builder $builder, $results)
0 ignored issues
show
Unused Code introduced by
The parameter $builder is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
21
    {
22
        if (!isset($results) || is_string($results) || isset($results['Fouttype'])) {
23
            return [];
24
        }
25
26
        if (array_has($results, 'Items') || array_has($results, 'items')) {
27
            return reset($results);
28
        }
29
30
        foreach ($results as $result) {
31
            if (!is_array($result)) {
32
                return [$results];
33
            }
34
        }
35
36
        return $results;
37
    }
38
}
39