Completed
Push — master ( a83760...e914f9 )
by Mehmet
02:17
created
apps/elastico/controllers/es/type.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function app_content($request, $args){
3
+function app_content($request, $args) {
4 4
 
5 5
     global $ES;
6 6
     $index  = $args['index'];
@@ -16,24 +16,24 @@  discard block
 block discarded – undo
16 16
     $params['sort'] = $sort;
17 17
     $params['from'] = $from;
18 18
     $params['size'] = $size;
19
-    if (!empty($query)){
19
+    if (!empty($query)) {
20 20
         $body = json_decode($query);
21
-        if (json_last_error() == JSON_ERROR_NONE){
21
+        if (json_last_error() == JSON_ERROR_NONE) {
22 22
             $params['body'] = $body;
23 23
         } else {
24 24
             $params['q'] = $query;
25 25
         }
26 26
     }
27 27
     $results = $ES->search($params);
28
-    foreach($results['hits']['hits'] as $doc){
28
+    foreach ($results['hits']['hits'] as $doc) {
29 29
         $doc['_source']['_id'] = $doc['_id'];
30 30
         $documents[] = $doc['_source'];
31 31
     }
32 32
     $params['search_type'] = 'count';
33 33
     $count = $ES->search($params);
34 34
     $nof = 0;
35
-    if(isset($count['hits']['total'])){
36
-        $nof =  (int) $count['hits']['total'];
35
+    if (isset($count['hits']['total'])) {
36
+        $nof = (int) $count['hits']['total'];
37 37
     }
38
-    return ['app_title'=>$index."/".$type ,'data'=>['index' => $index, 'type' => $type, 'documents'=> $documents, 'from' => $from, 'nof'=>$nof, 'size' => $size,'sort'=>$sort, 'query'=>$query]];
38
+    return ['app_title'=>$index . "/" . $type, 'data'=>['index' => $index, 'type' => $type, 'documents'=> $documents, 'from' => $from, 'nof'=>$nof, 'size' => $size, 'sort'=>$sort, 'query'=>$query]];
39 39
 }
Please login to merge, or discard this patch.