Test Failed
Push — master ( 87b94d...f5025a )
by Mathieu
04:46
created

ClientSideDatatable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 17 3
1
<?php
2
3
namespace DoctrineDatatable;
4
5
/**
6
 * Class ServerSideDatatable.
7
 *
8
 * @author Mathieu Petrini <[email protected]>
9
 */
10
class ClientSideDatatable extends Datatable
11
{
12
    /**
13
     * PUBLIC METHODS.
14
     */
15
16
    /**
17
     * @author Mathieu Petrini <[email protected]>
18
     *
19
     * @param array $filters
20
     *
21
     * @return array
22
     *
23
     * @throws Exception\ResolveColumnNotHandle
24
     * @throws Exception\UnfilterableColumn
25
     * @throws Exception\WhereColumnNotHandle
26
     */
27
    public function get(array $filters): array
28
    {
29
        $query = $this->createQueryResult();
30
        $this->createFoundationQuery($query, $filters);
31
32
        $data = $this->result(
33
            $query,
34
            isset($filters['order']) ?
35
                $filters['order'][0]['column'] :
36
                0,
37
            isset($filters['order']) ?
38
                $filters['order'][0]['dir'] :
39
                'ASC'
40
        );
41
42
        return array(
43
            'data' => $data,
44
        );
45
    }
46
}
47