@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function loginAction(Request $request, SessionInterface $session): RedirectResponse |
95 | 95 | { |
96 | 96 | try { |
97 | - [ $next, $token ] = $this->getOauthClient($request)->initiate(); |
|
97 | + [$next, $token] = $this->getOauthClient($request)->initiate(); |
|
98 | 98 | } catch (Exception $oauthException) { |
99 | 99 | throw $oauthException; |
100 | 100 | // @TODO Make this work. |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | . '?title=Special:OAuth'; |
176 | 176 | $conf = new ClientConfig($endpoint); |
177 | 177 | $consumerKey = $this->getParameter('oauth_key'); |
178 | - $consumerSecret = $this->getParameter('oauth_secret'); |
|
178 | + $consumerSecret = $this->getParameter('oauth_secret'); |
|
179 | 179 | $conf->setConsumer(new Consumer($consumerKey, $consumerSecret)); |
180 | 180 | $this->oauthClient = new Client($conf); |
181 | 181 |
@@ -197,7 +197,7 @@ |
||
197 | 197 | |
198 | 198 | // Number the quotes, since they somehow have significance. |
199 | 199 | foreach ($quotes as $index => $quote) { |
200 | - $numberedQuotes[(string)($index + 1)] = $quote; |
|
200 | + $numberedQuotes[(string)($index+1)] = $quote; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return new JsonResponse($numberedQuotes, Response::HTTP_OK); |
@@ -128,7 +128,7 @@ |
||
128 | 128 | // 'Category:', which sometimes is used cross-wiki (because it still works). |
129 | 129 | $normalized = false; |
130 | 130 | $nsName = $this->project->getNamespaces()[14].':'; |
131 | - $this->categories = array_map(function ($category) use ($nsName, &$normalized) { |
|
131 | + $this->categories = array_map(function($category) use ($nsName, &$normalized) { |
|
132 | 132 | if (0 === strpos($category, $nsName) || 0 === strpos($category, 'Category:')) { |
133 | 133 | $normalized = true; |
134 | 134 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $timeline = []; |
102 | 102 | $startObj = new DateTime($start); |
103 | 103 | $endObj = new DateTime($end); |
104 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
104 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
105 | 105 | $grandSum = 0; |
106 | 106 | |
107 | 107 | // Generate array of date labels |
@@ -111,17 +111,17 @@ discard block |
||
111 | 111 | |
112 | 112 | foreach ($data as $entry) { |
113 | 113 | if (!isset($totals[$entry['tool']])) { |
114 | - $totals[$entry['tool']] = (int) $entry['count']; |
|
114 | + $totals[$entry['tool']] = (int)$entry['count']; |
|
115 | 115 | |
116 | 116 | // Create arrays for each tool, filled with zeros for each date in the timeline |
117 | 117 | $timeline[$entry['tool']] = array_fill(0, $numDays, 0); |
118 | 118 | } else { |
119 | - $totals[$entry['tool']] += (int) $entry['count']; |
|
119 | + $totals[$entry['tool']] += (int)$entry['count']; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | $date = new DateTime($entry['date']); |
123 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
124 | - $timeline[$entry['tool']][$dateIndex] = (int) $entry['count']; |
|
123 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
124 | + $timeline[$entry['tool']][$dateIndex] = (int)$entry['count']; |
|
125 | 125 | |
126 | 126 | $grandSum += $entry['count']; |
127 | 127 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $timeline = []; |
160 | 160 | $startObj = new DateTime($start); |
161 | 161 | $endObj = new DateTime($end); |
162 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
162 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
163 | 163 | $grandSum = 0; |
164 | 164 | |
165 | 165 | // Generate array of date labels |
@@ -169,17 +169,17 @@ discard block |
||
169 | 169 | |
170 | 170 | foreach ($data as $entry) { |
171 | 171 | if (!isset($totals[$entry['endpoint']])) { |
172 | - $totals[$entry['endpoint']] = (int) $entry['count']; |
|
172 | + $totals[$entry['endpoint']] = (int)$entry['count']; |
|
173 | 173 | |
174 | 174 | // Create arrays for each endpoint, filled with zeros for each date in the timeline |
175 | 175 | $timeline[$entry['endpoint']] = array_fill(0, $numDays, 0); |
176 | 176 | } else { |
177 | - $totals[$entry['endpoint']] += (int) $entry['count']; |
|
177 | + $totals[$entry['endpoint']] += (int)$entry['count']; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $date = new DateTime($entry['date']); |
181 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
182 | - $timeline[$entry['endpoint']][$dateIndex] = (int) $entry['count']; |
|
181 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
182 | + $timeline[$entry['endpoint']][$dateIndex] = (int)$entry['count']; |
|
183 | 183 | |
184 | 184 | $grandSum += $entry['count']; |
185 | 185 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | /** @var Connection $conn */ |
233 | 233 | $conn = $this->container->get('doctrine')->getManager('default')->getConnection(); |
234 | - $date = date('Y-m-d'); |
|
234 | + $date = date('Y-m-d'); |
|
235 | 235 | |
236 | 236 | // Tool name needs to be lowercase. |
237 | 237 | $tool = strtolower($tool); |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | |
113 | 113 | // Construct the page name |
114 | 114 | if (!isset($this->getParameter('rfx')[$domain]['pages'][$type])) { |
115 | - $pageTitle= ''; |
|
115 | + $pageTitle = ''; |
|
116 | 116 | } else { |
117 | - $pageTitle= $this->getParameter('rfx')[$domain]['pages'][$type]; |
|
117 | + $pageTitle = $this->getParameter('rfx')[$domain]['pages'][$type]; |
|
118 | 118 | } |
119 | 119 | |
120 | - $pageTitle.= '/'.$this->user->getUsername(); |
|
120 | + $pageTitle .= '/'.$this->user->getUsername(); |
|
121 | 121 | $page = new Page($this->project, $pageTitle); |
122 | 122 | $pageRepo = new PageRepository(); |
123 | 123 | $pageRepo->setContainer($this->container); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $neutral = $rfx->getSection('neutral'); |
146 | 146 | $dup = $rfx->getDuplicates(); |
147 | 147 | |
148 | - $total = count($support) + count($oppose) + count($neutral); |
|
148 | + $total = count($support)+count($oppose)+count($neutral); |
|
149 | 149 | |
150 | 150 | if (0 === $total) { |
151 | 151 | $this->addFlashMessage('notice', 'no-result', [$pageTitle]); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Controller; |
5 | 5 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $this->project = $defaultProject; |
192 | 192 | |
193 | 193 | $results = $globalContribs->globalEdits(); |
194 | - $results = array_map(function (Edit $edit) { |
|
194 | + $results = array_map(function(Edit $edit) { |
|
195 | 195 | return $edit->getForJson(true, true); |
196 | 196 | }, array_values($results)); |
197 | 197 | $results = $this->addFullPageTitlesAndContinue('globalcontribs', [], $results); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the ArticleInfoRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Repository; |
9 | 9 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp' |
99 | 99 | FROM $loggingTable |
100 | - WHERE log_namespace = '" . $page->getNamespace() . "' |
|
100 | + WHERE log_namespace = '".$page->getNamespace()."' |
|
101 | 101 | AND log_title = :title AND log_timestamp > 1 $datesConditions |
102 | 102 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
103 | 103 | $title = str_replace(' ', '_', $page->getTitle()); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $time2 = time(); |
280 | 280 | |
281 | 281 | // If it took over 5 seconds, cache the result for 20 minutes. |
282 | - if ($time2 - $time1 > 5) { |
|
282 | + if ($time2-$time1 > 5) { |
|
283 | 283 | $this->setCache($cacheKey, $result, 'PT20M'); |
284 | 284 | } |
285 | 285 |
@@ -330,9 +330,9 @@ |
||
330 | 330 | { |
331 | 331 | $pageTable = $this->getTableName($project->getDatabaseName(), 'page'); |
332 | 332 | $query = "SELECT page_id " |
333 | - . " FROM $pageTable " |
|
334 | - . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 " |
|
335 | - . " LIMIT 1"; |
|
333 | + . " FROM $pageTable " |
|
334 | + . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 " |
|
335 | + . " LIMIT 1"; |
|
336 | 336 | $params = [ |
337 | 337 | 'ns' => $namespaceId, |
338 | 338 | 'title' => str_replace(' ', '_', $pageTitle), |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the ProjectRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Repository; |
9 | 9 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | if ($this->container->hasParameter("database_meta_table")) { |
126 | - $table = $this->container->getParameter('database_meta_name') . '.' . |
|
126 | + $table = $this->container->getParameter('database_meta_name').'.'. |
|
127 | 127 | $this->container->getParameter('database_meta_table'); |
128 | 128 | } else { |
129 | 129 | $table = "meta_p.wiki"; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | || $projMetadata['url'] == "https://$project" |
172 | 172 | || $projMetadata['url'] == "https://$project.org" |
173 | 173 | || $projMetadata['url'] == "https://www.$project") { |
174 | - $this->log->debug(__METHOD__ . " Using cached data for $project"); |
|
174 | + $this->log->debug(__METHOD__." Using cached data for $project"); |
|
175 | 175 | return $projMetadata; |
176 | 176 | } |
177 | 177 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | if ($this->container->hasParameter("database_meta_table")) { |
185 | - $table = $this->container->getParameter('database_meta_name') . '.' . |
|
185 | + $table = $this->container->getParameter('database_meta_name').'.'. |
|
186 | 186 | $this->container->getParameter('database_meta_table'); |
187 | 187 | } else { |
188 | 188 | $table = "meta_p.wiki"; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $optedIn = $this->container->getParameter('opted_in'); |
327 | 327 | // In case there's just one given. |
328 | 328 | if (!is_array($optedIn)) { |
329 | - $optedIn = [ $optedIn ]; |
|
329 | + $optedIn = [$optedIn]; |
|
330 | 330 | } |
331 | 331 | return $optedIn; |
332 | 332 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | ]])->getBody()->getContents(), true); |
396 | 396 | |
397 | 397 | $extensions = $res['query']['extensions'] ?? []; |
398 | - return array_map(function ($extension) { |
|
398 | + return array_map(function($extension) { |
|
399 | 399 | return $extension['name']; |
400 | 400 | }, $extensions); |
401 | 401 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Repository; |
5 | 5 |