Completed
Pull Request — master (#623)
by Timo
27:48
created
Classes/Domain/Search/Statistics/StatisticsRepository.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -201,6 +201,7 @@
 block discarded – undo
201 201
      *
202 202
      * @param array $mergedRow
203 203
      * @param array $statisticsRow
204
+     * @param string $fieldName
204 205
      * @return float|int
205 206
      */
206 207
     protected function getAverageFromField(array &$mergedRow, array $statisticsRow,  $fieldName)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
     public function getSearchStatistics($rootPageId, $days = 30, $limit = 10)
47 47
     {
48 48
         $now = time();
49
-        $timeStart = (int) ($now - 86400 * intval($days)); // 86400 seconds/day
50
-        $rootPageId = (int) $rootPageId;
51
-        $limit = (int) $limit;
49
+        $timeStart = (int)($now - 86400 * intval($days)); // 86400 seconds/day
50
+        $rootPageId = (int)$rootPageId;
51
+        $limit = (int)$limit;
52 52
 
53 53
         $statisticsRows = $this->getDatabase()->exec_SELECTgetRows(
54 54
             'keywords, count(keywords) as count, num_found as hits',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             $sumCount += $statisticsRow['count'];
67 67
         }
68 68
 
69
-        $statisticsRows = array_map(function ($row) use ($sumCount) {
69
+        $statisticsRows = array_map(function($row) use ($sumCount) {
70 70
             $row['percent'] = $row['count'] * 100 / $sumCount;
71 71
 
72 72
             return $row;
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
      */
113 113
     protected function getTopKeyWordsWithOrWithoutHits($rootPageId, $days = 30, $limit, $withoutHits)
114 114
     {
115
-        $rootPageId = (int) $rootPageId;
116
-        $limit = (int) $limit;
117
-        $withoutHits = (bool) $withoutHits;
115
+        $rootPageId = (int)$rootPageId;
116
+        $limit = (int)$limit;
117
+        $withoutHits = (bool)$withoutHits;
118 118
 
119 119
         $now = time();
120 120
         $timeStart = $now - 86400 * intval($days); // 86400 seconds/day
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
                 // for the hits we need to take the average
161 161
             $avgHits = $this->getAverageFromField($mergedRow, $statisticsRow, 'hits');
162
-            $mergedRow['hits'] = (int) $avgHits;
162
+            $mergedRow['hits'] = (int)$avgHits;
163 163
 
164 164
                 // for the count we need to take the sum, because it's the sum of searches
165 165
             $mergedRow['count'] = $mergedRow['count'] + $statisticsRow['count'];
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * @param array $statisticsRow
204 204
      * @return float|int
205 205
      */
206
-    protected function getAverageFromField(array &$mergedRow, array $statisticsRow,  $fieldName)
206
+    protected function getAverageFromField(array &$mergedRow, array $statisticsRow, $fieldName)
207 207
     {
208 208
         // when this is the first row we can take it.
209 209
         if ($mergedRow['mergedrows'] === 1) {
Please login to merge, or discard this patch.