| @@ -2,16 +2,16 @@ discard block | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | |
| 5 | -function app_content( $request, $args ){ | |
| 5 | +function app_content($request, $args) { | |
| 6 | 6 | |
| 7 | 7 | global $ES; | 
| 8 | 8 | |
| 9 | 9 | $index = $args['index']; | 
| 10 | 10 | $type = $args['type']; | 
| 11 | 11 | $params = []; | 
| 12 | - $from = $request->getParam( 'from', 0 ); | |
| 13 | - $sort = $request->getParam( 'sort', '' ); | |
| 14 | - $search = $request->getParam( 'search', '' ); | |
| 12 | +    $from   = $request->getParam('from', 0); | |
| 13 | +    $sort   = $request->getParam('sort', ''); | |
| 14 | +    $search = $request->getParam('search', ''); | |
| 15 | 15 | $size = 25; | 
| 16 | 16 | |
| 17 | 17 | $documents = []; | 
| @@ -32,15 +32,15 @@ discard block | ||
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | 34 | $results = $ES->search($params); | 
| 35 | -    foreach ($results['hits']['hits'] as $doc){ | |
| 35 | +    foreach ($results['hits']['hits'] as $doc) { | |
| 36 | 36 | $doc['_source']['_id'] = $doc['_id']; | 
| 37 | - $documents[]=$doc['_source']; | |
| 37 | + $documents[] = $doc['_source']; | |
| 38 | 38 | } | 
| 39 | 39 | $params['search_type'] = 'count'; | 
| 40 | 40 | $count = $ES->search($params); | 
| 41 | 41 | $nof = 0; | 
| 42 | -    if( isset( $count['hits']['total'] ) ){ | |
| 43 | - $nof = (int) $count['hits']['total']; | |
| 42 | +    if (isset($count['hits']['total'])) { | |
| 43 | + $nof = (int) $count['hits']['total']; | |
| 44 | 44 | } | 
| 45 | - return ['app_title'=>$index."/".$type ,'data'=>[ 'index' => $index, 'type' => $type, 'documents'=> $documents, 'from' => $from, 'nof'=>$nof, 'size' => $size,'sort'=>$sort, 'search'=>$search]]; | |
| 45 | + return ['app_title'=>$index . "/" . $type, 'data'=>['index' => $index, 'type' => $type, 'documents'=> $documents, 'from' => $from, 'nof'=>$nof, 'size' => $size, 'sort'=>$sort, 'search'=>$search]]; | |
| 46 | 46 | } |