Completed
Pull Request — master (#111)
by MusikAnimal
02:23
created
src/AppBundle/Controller/TopEditsController.php 2 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -11,12 +11,8 @@
 block discarded – undo
11 11
 use Symfony\Component\HttpFoundation\RedirectResponse;
12 12
 use Symfony\Component\HttpFoundation\Request;
13 13
 use Symfony\Component\HttpFoundation\Response;
14
-use Xtools\Page;
15
-use Xtools\PagesRepository;
16 14
 use Xtools\Project;
17
-use Xtools\ProjectRepository;
18 15
 use Xtools\User;
19
-use Xtools\UserRepository;
20 16
 use Xtools\TopEdits;
21 17
 use Xtools\TopEditsRepository;
22 18
 use Xtools\Edit;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@
 block discarded – undo
191 191
         // Send all to the template.
192 192
         return $this->render('topedits/result_article.html.twig', [
193 193
             'xtPage' => 'topedits',
194
-            'xtTitle' => $user->getUsername() . ' - ' . $page->getTitle(),
194
+            'xtTitle' => $user->getUsername().' - '.$page->getTitle(),
195 195
             'project' => $project,
196 196
             'user' => $user,
197 197
             'page' => $page,
Please login to merge, or discard this patch.
src/AppBundle/Controller/AdminScoreController.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,6 @@
 block discarded – undo
65 65
     /**
66 66
      * Display the AdminScore results.
67 67
      * @Route("/adminscore/{project}/{username}", name="AdminScoreResult")
68
-     * @param string $project The project name.
69
-     * @param string $username The username.
70 68
      * @return Response
71 69
      * @todo Move SQL to a model.
72 70
      * @codeCoverageIgnore
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -10,10 +10,7 @@
 block discarded – undo
10 10
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
11 11
 use Symfony\Component\HttpFoundation\Request;
12 12
 use Symfony\Component\HttpFoundation\Response;
13
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
14 13
 use DateTime;
15
-use Xtools\ProjectRepository;
16
-use Xtools\UserRepository;
17 14
 
18 15
 /**
19 16
  * The AdminScoreController serves the search form and results page of the AdminScore tool
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -92,20 +92,20 @@  discard block
 block discarded – undo
92 92
 
93 93
         // MULTIPLIERS (to review)
94 94
         $multipliers = [
95
-            'account-age-mult' => 1.25,             # 0 if = 365 jours
96
-            'edit-count-mult' => 1.25,              # 0 if = 10 000
97
-            'user-page-mult' => 0.1,                # 0 if =
98
-            'patrols-mult' => 1,                    # 0 if =
99
-            'blocks-mult' => 1.4,                   # 0 if = 10
95
+            'account-age-mult' => 1.25, # 0 if = 365 jours
96
+            'edit-count-mult' => 1.25, # 0 if = 10 000
97
+            'user-page-mult' => 0.1, # 0 if =
98
+            'patrols-mult' => 1, # 0 if =
99
+            'blocks-mult' => 1.4, # 0 if = 10
100 100
             'afd-mult' => 1.15,
101
-            'recent-activity-mult' => 0.9,          # 0 if =
101
+            'recent-activity-mult' => 0.9, # 0 if =
102 102
             'aiv-mult' => 1.15,
103
-            'edit-summaries-mult' => 0.8,           # 0 if =
104
-            'namespaces-mult' => 1.0,               # 0 if =
105
-            'pages-created-live-mult' => 1.4,       # 0 if =
106
-            'pages-created-deleted-mult' => 1.4,    # 0 if =
107
-            'rpp-mult' => 1.15,                     # 0 if =
108
-            'user-rights-mult' => 0.75,             # 0 if =
103
+            'edit-summaries-mult' => 0.8, # 0 if =
104
+            'namespaces-mult' => 1.0, # 0 if =
105
+            'pages-created-live-mult' => 1.4, # 0 if =
106
+            'pages-created-deleted-mult' => 1.4, # 0 if =
107
+            'rpp-mult' => 1.15, # 0 if =
108
+            'user-rights-mult' => 0.75, # 0 if =
109 109
         ];
110 110
 
111 111
         // Grab the connection to the replica database (which is separate from the above)
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
                 $now = new DateTime();
189 189
                 $date = new DateTime($value);
190 190
                 $diff = $date->diff($now);
191
-                $formula = 365 * $diff->format('%y') + 30 * $diff->format('%m') + $diff->format('%d');
192
-                $value = $formula - 365;
191
+                $formula = 365 * $diff->format('%y')+30 * $diff->format('%m')+$diff->format('%d');
192
+                $value = $formula-365;
193 193
             }
194 194
 
195 195
             if ($key === 'id') {
196 196
                 $id = $value;
197 197
             } else {
198
-                $multiplierKey = $row['source'] . '-mult';
198
+                $multiplierKey = $row['source'].'-mult';
199 199
                 $multiplier = isset($multipliers[$multiplierKey]) ? $multipliers[$multiplierKey] : 1;
200 200
                 $score = max(min($value * $multiplier, 100), -100);
201 201
                 $master[$key]['mult'] = $multiplier;
Please login to merge, or discard this patch.
src/AppBundle/Controller/XtoolsController.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,6 @@  discard block
 block discarded – undo
24 24
      * counterparts (e.g. 'lang' and 'wiki').
25 25
      *
26 26
      * @param  Request $request
27
-     * @param  string $project
28 27
      * @return string[] Normalized parameters (no legacy params).
29 28
      */
30 29
     public function parseQueryParams(Request $request)
@@ -80,7 +79,7 @@  discard block
 block discarded – undo
80 79
      * given project string is invalid.
81 80
      *
82 81
      * @param  string[] $params Query params.
83
-     * @return Project
82
+     * @return \Xtools\Project
84 83
      */
85 84
     public function getProjectFromQuery($params)
86 85
     {
@@ -108,6 +107,7 @@  discard block
 block discarded – undo
108 107
     /**
109 108
      * If the given project and user are valid, Project and User instances are returned.
110 109
      * Otherwise a redirect is returned that goes back to the index page.
110
+     * @param string $tooHighEditCountAction
111 111
      * @return RedirectResponse|Project|User
112 112
      */
113 113
     public function validateProjectAndUser(Request $request, $tooHighEditCountAction = null)
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
     /**
149 149
      * Get a Page instance from the given page title, and validate that it exists.
150
-     * @param  Project $project
150
+     * @param  \Xtools\Project $project
151 151
      * @param  string $pageTitle
152 152
      * @return Page|RedirectResponse Page or redirect back to index if page doesn't exist.
153 153
      */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $params = $this->parseLegacyParams($request, $params);
37 37
 
38 38
         // Remove blank values.
39
-        return array_filter($params, function ($param) {
39
+        return array_filter($params, function($param) {
40 40
             // 'namespace' or 'username' could be '0'.
41 41
             return $param !== null && $param !== '';
42 42
         });
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         ];
183 183
 
184 184
         // Remove blank values.
185
-        return array_filter($params, function ($param) {
185
+        return array_filter($params, function($param) {
186 186
             // 'namespace' or 'username' could be '0'.
187 187
             return $param !== null && $param !== '';
188 188
         });
Please login to merge, or discard this patch.