OrderConverter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 17
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 14 3
1
<?php
2
3
namespace BigShark\SQLToBuilder\Converter;
4
5
class OrderConverter extends Converter implements ConverterInterface
6
{
7 15
    public function convert($order)
8
    {
9 15
        $result = [];
10 15
        foreach ($order as $item) {
11 12
            $args = [];
12 12
            $args[] = $this->getValueWithoutQuotes($item, 'base_expr');
13 12
            if ('ASC' !== strtoupper($item['direction'])) {
14 6
                $args[] = strtoupper($item['direction']);
15
            }
16 12
            $result[] = $this->format('orderBy', $args);
17
        }
18
19 15
        return $result;
20
    }
21
}
22