Conditions | 4 |
Paths | 6 |
Total Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
27 | public function getData(Options $options = null) |
||
28 | { |
||
29 | if ($options === null) { |
||
30 | // Take store global/default options |
||
31 | $options = $this->store->getOptions(); |
||
32 | } |
||
33 | |||
34 | $data = $this->store->getData($options); |
||
35 | $d = [ |
||
36 | 'success' => true, |
||
37 | 'total' => $data->getTotalRows(), |
||
38 | 'start' => $data->getSource()->getOptions()->getOffset(), |
||
39 | 'limit' => $data->getSource()->getOptions()->getLimit(), |
||
40 | 'data' => $data->toArray() |
||
41 | ]; |
||
42 | |||
43 | if ($this->options['debug']) { |
||
44 | $source = $data->getSource(); |
||
45 | if ($source instanceof QueryableSourceInterface) { |
||
46 | $d['query'] = $source->getQueryString(); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | $json = new ZendJsonModel($d); |
||
51 | |||
52 | return $json; |
||
53 | } |
||
54 | } |
||
55 |