Completed
Push — devel ( b12ffb...aaf4bd )
by Alexey
02:13
created
src/Bardex/Elastic/Script.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,6 @@
 block discarded – undo
27 27
 
28 28
     /**
29 29
      * Создать новый скрипт
30
-     * @param string $language=painless
31 30
      */
32 31
     public function __construct($language='painless')
33 32
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      * Создать новый скрипт
30 30
      * @param string $language=painless
31 31
      */
32
-    public function __construct($language='painless')
32
+    public function __construct($language = 'painless')
33 33
     {
34 34
         $this->language = $language;
35 35
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,9 @@
 block discarded – undo
85 85
         ];
86 86
 
87 87
         // because ES
88
-        if (empty($script['script']['params'])) unset($script['script']['params']);
88
+        if (empty($script['script']['params'])) {
89
+            unset($script['script']['params']);
90
+        }
89 91
 
90 92
         return $script;
91 93
     }
Please login to merge, or discard this patch.
src/Bardex/Elastic/SearchQuery.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace Bardex\Elastic;
4 4
 
5
-use Bardex\Elastic\SearchResult;
6
-
7 5
 
8 6
 /**
9 7
  * Fluent interface for ElasticSearch
Please login to merge, or discard this patch.
src/Bardex/Elastic/Query.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
         $query = $this->getQuery();
72 72
 
73 73
         // send query to elastic
74
-        $start  = microtime(1);
74
+        $start = microtime(1);
75 75
 
76 76
         try {
77 77
             $result = $this->executeQuery($query);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,8 +78,7 @@
 block discarded – undo
78 78
             $time   = round((microtime(1) - $start) * 1000);
79 79
             $this->triggerSuccess($query, $result, $time);
80 80
             return $result;
81
-        }
82
-        catch (\Exception $e) {
81
+        } catch (\Exception $e) {
83 82
             $this->triggerError($query, $e);
84 83
             throw $e;
85 84
         }
Please login to merge, or discard this patch.
src/Bardex/Elastic/Listener/Logger.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @var bool логировать все запросы
17 17
      */
18
-    protected $logAllQueries=true;
18
+    protected $logAllQueries = true;
19 19
 
20 20
     /**
21 21
      * @var bool логировать запросы с ошибками
22 22
      */
23
-    protected $logErrorQueries=true;
23
+    protected $logErrorQueries = true;
24 24
 
25 25
     /**
26 26
      * @var bool логировать медленные запросы
27 27
      */
28
-    protected $logSlowQueries=true;
28
+    protected $logSlowQueries = true;
29 29
 
30 30
     /**
31 31
      * @var int лимит времени выполнения запроса после которого он считается медленным (мс)
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function __construct(
44 44
         LoggerInterface $logger,
45
-        $logAllQueries=true,
46
-        $logErrorQueries=true,
47
-        $logSlowQueries=true,
48
-        $slowQueryLimitMs=1000)
45
+        $logAllQueries = true,
46
+        $logErrorQueries = true,
47
+        $logSlowQueries = true,
48
+        $slowQueryLimitMs = 1000)
49 49
     {
50 50
         $this->logger = $logger;
51 51
         $this->logAllQueries = $logAllQueries;
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -145,12 +145,26 @@
 block discarded – undo
145 145
 
146 146
     protected function getTimeRange($time)
147 147
     {
148
-        if ($time <= 10)   return '0-10 ms';
149
-        if ($time <= 30)   return '10-30 ms';
150
-        if ($time <= 50)   return '30-50 ms';
151
-        if ($time <= 100)  return '50-100 ms';
152
-        if ($time <= 500)  return '100-500 ms';
153
-        if ($time <= 1000) return '500-1000 ms';
154
-        if ($time > 1000)  return '> 1000 ms';
148
+        if ($time <= 10) {
149
+            return '0-10 ms';
150
+        }
151
+        if ($time <= 30) {
152
+            return '10-30 ms';
153
+        }
154
+        if ($time <= 50) {
155
+            return '30-50 ms';
156
+        }
157
+        if ($time <= 100) {
158
+            return '50-100 ms';
159
+        }
160
+        if ($time <= 500) {
161
+            return '100-500 ms';
162
+        }
163
+        if ($time <= 1000) {
164
+            return '500-1000 ms';
165
+        }
166
+        if ($time > 1000) {
167
+            return '> 1000 ms';
168
+        }
155 169
     }
156 170
 }
157 171
\ No newline at end of file
Please login to merge, or discard this patch.
src/Bardex/Elastic/Where.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
     }
116 116
 
117 117
 
118
-    protected function range($params, $dateFormat=null)
118
+    protected function range($params, $dateFormat = null)
119 119
     {
120 120
         if ($dateFormat) $params['format'] = $dateFormat;
121 121
         $this->query->addFilter('range', [$this->field => $params]);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,9 @@
 block discarded – undo
117 117
 
118 118
     protected function range($params, $dateFormat=null)
119 119
     {
120
-        if ($dateFormat) $params['format'] = $dateFormat;
120
+        if ($dateFormat) {
121
+            $params['format'] = $dateFormat;
122
+        }
121 123
         $this->query->addFilter('range', [$this->field => $params]);
122 124
         return $this->query;
123 125
     }
Please login to merge, or discard this patch.