| Total Complexity | 5 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 4 | class ResultHandlers { |
||
| 5 | |||
| 6 | public static function getDBHandler($db) |
||
| 7 | { |
||
| 8 | return function($query, $args) use ($db) { |
||
| 9 | $q = $db->prepare('select * from nodes where '.$query); |
||
| 10 | $result = $q->execute($args); |
||
|
|
|||
| 11 | $dataset = []; |
||
| 12 | while ( $data = $q->fetch(\PDO::FETCH_ASSOC) ) { |
||
| 13 | $value = (object) $data; |
||
| 14 | $value->data = json_decode($value->data); |
||
| 15 | $value->ctime = strtotime($value->ctime); |
||
| 16 | $value->mtime = strtotime($value->mtime); |
||
| 17 | $path = $value->parent.$value->name.'/'; |
||
| 18 | $dataset[$path] = $value; |
||
| 19 | } |
||
| 20 | return $dataset; |
||
| 21 | }; |
||
| 22 | } |
||
| 23 | |||
| 24 | public static function getDBGeneratorHandler($db) |
||
| 41 | } |
||
| 42 | }; |
||
| 44 | } |