@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | // Query the db table |
59 | 59 | $stats = (new Query()) |
60 | - ->from(['{{%retour_stats}}']) |
|
60 | + ->from([ '{{%retour_stats}}' ]) |
|
61 | 61 | ->orderBy('hitCount DESC') |
62 | 62 | ->limit(Retour::$settings->statsDisplayLimit) |
63 | 63 | ->all(); |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | public function getRecentStatistics($days = 1, $handled = false): array |
77 | 77 | { |
78 | 78 | // Ensure is an int |
79 | - $handledInt = (int)$handled; |
|
79 | + $handledInt = (int) $handled; |
|
80 | 80 | // Query the db table |
81 | 81 | $stats = (new Query()) |
82 | - ->from(['{{%retour_stats}}']) |
|
82 | + ->from([ '{{%retour_stats}}' ]) |
|
83 | 83 | ->where("hitLastTime >= ( CURDATE() - INTERVAL '{$days}' DAY )") |
84 | 84 | ->andWhere("handledByRetour = {$handledInt}") |
85 | 85 | ->orderBy('hitLastTime DESC') |
@@ -131,21 +131,21 @@ discard block |
||
131 | 131 | $stats->validate(); |
132 | 132 | // Find any existing retour_stats record |
133 | 133 | $statsConfig = (new Query()) |
134 | - ->from(['{{%retour_stats}}']) |
|
135 | - ->where(['redirectSrcUrl' => $stats->redirectSrcUrl]) |
|
134 | + ->from([ '{{%retour_stats}}' ]) |
|
135 | + ->where([ 'redirectSrcUrl' => $stats->redirectSrcUrl ]) |
|
136 | 136 | ->one(); |
137 | 137 | // If no record is found, initialize some values |
138 | 138 | if ($statsConfig === null) { |
139 | 139 | $stats->id = 0; |
140 | 140 | $stats->hitCount = 0; |
141 | 141 | } else { |
142 | - $stats->id = $statsConfig['id']; |
|
143 | - $stats->hitCount = $statsConfig['hitCount']; |
|
142 | + $stats->id = $statsConfig[ 'id' ]; |
|
143 | + $stats->hitCount = $statsConfig[ 'hitCount' ]; |
|
144 | 144 | } |
145 | 145 | // Merge in the updated info |
146 | 146 | $stats->referrerUrl = $referrer; |
147 | 147 | $stats->hitLastTime = Db::prepareDateForDb(new \DateTime()); |
148 | - $stats->handledByRetour = (int)$handled; |
|
148 | + $stats->handledByRetour = (int) $handled; |
|
149 | 149 | $stats->hitCount++; |
150 | 150 | $statsConfig = $stats->getAttributes(); |
151 | 151 | // Record the updated statistics |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | Craft::t( |
193 | 193 | 'retour', |
194 | 194 | 'Trimmed {rows} from retour_stats table', |
195 | - ['rows' => $affectedRows] |
|
195 | + [ 'rows' => $affectedRows ] |
|
196 | 196 | ), |
197 | 197 | __METHOD__ |
198 | 198 | ); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | Craft::t( |
212 | 212 | 'retour', |
213 | 213 | 'Error validating statistics {id}: {errors}', |
214 | - ['id' => $stats->id, 'errors' => print_r($stats->getErrors(), true)] |
|
214 | + [ 'id' => $stats->id, 'errors' => print_r($stats->getErrors(), true) ] |
|
215 | 215 | ), |
216 | 216 | __METHOD__ |
217 | 217 | ); |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | // Get the validated model attributes and save them to the db |
222 | 222 | $statsConfig = $stats->getAttributes(); |
223 | 223 | $db = Craft::$app->getDb(); |
224 | - if ($statsConfig['id'] !== 0) { |
|
224 | + if ($statsConfig[ 'id' ] !== 0) { |
|
225 | 225 | // Update the existing record |
226 | 226 | try { |
227 | 227 | $result = $db->createCommand()->update( |
228 | 228 | '{{%retour_stats}}', |
229 | 229 | $statsConfig, |
230 | 230 | [ |
231 | - 'id' => $statsConfig['id'], |
|
231 | + 'id' => $statsConfig[ 'id' ], |
|
232 | 232 | ] |
233 | 233 | )->execute(); |
234 | 234 | } catch (Exception $e) { |