OrderConverter::convert()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 9.7998
c 0
b 0
f 0
cc 3
nc 3
nop 1
crap 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