@@ -161,7 +161,7 @@ |
||
161 | 161 | */ |
162 | 162 | public function getTotalEditCount() |
163 | 163 | { |
164 | - return $this->data['deletedEditCount'] + $this->data['liveEditCount']; |
|
164 | + return $this->data['deletedEditCount']+$this->data['liveEditCount']; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $timeline = []; |
96 | 96 | $startObj = new DateTime($start); |
97 | 97 | $endObj = new DateTime($end); |
98 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
98 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
99 | 99 | $grandSum = 0; |
100 | 100 | |
101 | 101 | // Generate array of date labels |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | |
106 | 106 | foreach ($data as $entry) { |
107 | 107 | if (!isset($totals[$entry['tool']])) { |
108 | - $totals[$entry['tool']] = (int) $entry['count']; |
|
108 | + $totals[$entry['tool']] = (int)$entry['count']; |
|
109 | 109 | |
110 | 110 | // Create arrays for each tool, filled with zeros for each date in the timeline |
111 | 111 | $timeline[$entry['tool']] = array_fill(0, $numDays, 0); |
112 | 112 | } else { |
113 | - $totals[$entry['tool']] += (int) $entry['count']; |
|
113 | + $totals[$entry['tool']] += (int)$entry['count']; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $date = new DateTime($entry['date']); |
117 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
118 | - $timeline[$entry['tool']][$dateIndex] = (int) $entry['count']; |
|
117 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
118 | + $timeline[$entry['tool']][$dateIndex] = (int)$entry['count']; |
|
119 | 119 | |
120 | 120 | $grandSum += $entry['count']; |
121 | 121 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $timeline = []; |
153 | 153 | $startObj = new DateTime($start); |
154 | 154 | $endObj = new DateTime($end); |
155 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
155 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
156 | 156 | $grandSum = 0; |
157 | 157 | |
158 | 158 | // Generate array of date labels |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | |
163 | 163 | foreach ($data as $entry) { |
164 | 164 | if (!isset($totals[$entry['endpoint']])) { |
165 | - $totals[$entry['endpoint']] = (int) $entry['count']; |
|
165 | + $totals[$entry['endpoint']] = (int)$entry['count']; |
|
166 | 166 | |
167 | 167 | // Create arrays for each endpoint, filled with zeros for each date in the timeline |
168 | 168 | $timeline[$entry['endpoint']] = array_fill(0, $numDays, 0); |
169 | 169 | } else { |
170 | - $totals[$entry['endpoint']] += (int) $entry['count']; |
|
170 | + $totals[$entry['endpoint']] += (int)$entry['count']; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | $date = new DateTime($entry['date']); |
174 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
175 | - $timeline[$entry['endpoint']][$dateIndex] = (int) $entry['count']; |
|
174 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
175 | + $timeline[$entry['endpoint']][$dateIndex] = (int)$entry['count']; |
|
176 | 176 | |
177 | 177 | $grandSum += $entry['count']; |
178 | 178 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | $conn = $this->container->get('doctrine')->getManager('default')->getConnection(); |
222 | - $date = date('Y-m-d'); |
|
222 | + $date = date('Y-m-d'); |
|
223 | 223 | |
224 | 224 | // Increment count in timeline |
225 | 225 | $existsSql = "SELECT 1 FROM usage_timeline |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $this->page = $page; |
50 | 50 | |
51 | 51 | // Copy over supported attributes |
52 | - $this->id = (int) $attrs['id']; |
|
52 | + $this->id = (int)$attrs['id']; |
|
53 | 53 | |
54 | 54 | // Allow DateTime or string (latter assumed to be of format YmdHis) |
55 | 55 | if ($attrs['timestamp'] instanceof DateTime) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch); |
238 | 238 | |
239 | 239 | if ($isSection && isset($page)) { |
240 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
240 | + $pageUrl = $project->getUrl(false).str_replace( |
|
241 | 241 | '$1', |
242 | 242 | $page->getTitle($useUnnormalizedPageTitle), |
243 | 243 | $project->getArticlePath() |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | // Must have underscores for the link to properly go to the section. |
248 | 248 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
249 | 249 | |
250 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
251 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
250 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
251 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
252 | 252 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
253 | 253 | } |
254 | 254 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | ); |
263 | 263 | |
264 | 264 | // Use normalized page title (underscored, capitalized). |
265 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
265 | + $pageUrl = $project->getUrl(false).str_replace( |
|
266 | 266 | '$1', |
267 | 267 | ucfirst(str_replace(' ', '_', $wikiLinkPath)), |
268 | 268 | $project->getArticlePath() |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | public function getDiffUrl() |
301 | 301 | { |
302 | 302 | $project = $this->getProject(); |
303 | - $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath()); |
|
304 | - return rtrim($project->getUrl(), '/') . $path; |
|
303 | + $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath()); |
|
304 | + return rtrim($project->getUrl(), '/').$path; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | public function getPermaUrl() |
312 | 312 | { |
313 | 313 | $project = $this->getProject(); |
314 | - $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath()); |
|
315 | - return rtrim($project->getUrl(), '/') . $path; |
|
314 | + $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath()); |
|
315 | + return rtrim($project->getUrl(), '/').$path; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | public function isAutomated(Container $container) |
346 | 346 | { |
347 | - return (bool) $this->getTool($container); |
|
347 | + return (bool)$this->getTool($container); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | $rendered = str_replace('"', '\"', trim($rendered)); |
87 | 87 | |
88 | 88 | // Uglify temporary file. |
89 | - $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js'; |
|
89 | + $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js'; |
|
90 | 90 | $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && "; |
91 | - $script .= $this->get('kernel')->getRootDir() . |
|
92 | - "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " . |
|
91 | + $script .= $this->get('kernel')->getRootDir(). |
|
92 | + "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ". |
|
93 | 93 | "&& rm $tmpFile >/dev/null"; |
94 | 94 | $process = new Process($script); |
95 | 95 | $process->run(); |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | $rendered = str_replace('\"', '"', trim($rendered)); |
109 | 109 | |
110 | 110 | // Add comment after uglifying since it removes comments. |
111 | - $rendered = "/**\n * This code was automatically generated and should not " . |
|
112 | - "be manually edited.\n * For updates, please copy and paste from " . |
|
113 | - $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) . |
|
114 | - "\n * Released under GPL v3 license.\n */\n" . $rendered; |
|
111 | + $rendered = "/**\n * This code was automatically generated and should not ". |
|
112 | + "be manually edited.\n * For updates, please copy and paste from ". |
|
113 | + $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL). |
|
114 | + "\n * Released under GPL v3 license.\n */\n".$rendered; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $response = new \Symfony\Component\HttpFoundation\Response($rendered); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $data = [ |
220 | 220 | 'project' => $projectData->getDomain(), |
221 | 221 | 'page' => $page->getTitle(), |
222 | - 'watchers' => (int) $page->getWatchers(), |
|
222 | + 'watchers' => (int)$page->getWatchers(), |
|
223 | 223 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
224 | 224 | 'pageviews_offset' => $pageviewsOffset, |
225 | 225 | ]; |
@@ -237,18 +237,18 @@ discard block |
||
237 | 237 | if (isset($info)) { |
238 | 238 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
239 | 239 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
240 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
240 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
241 | 241 | |
242 | 242 | $data = array_merge($data, [ |
243 | - 'revisions' => (int) $info['num_edits'], |
|
244 | - 'editors' => (int) $info['num_editors'], |
|
243 | + 'revisions' => (int)$info['num_edits'], |
|
244 | + 'editors' => (int)$info['num_editors'], |
|
245 | 245 | 'author' => $info['author'], |
246 | - 'author_editcount' => (int) $info['author_editcount'], |
|
246 | + 'author_editcount' => (int)$info['author_editcount'], |
|
247 | 247 | 'created_at' => $creationDateTime->format('Y-m-d'), |
248 | 248 | 'created_rev_id' => $info['created_rev_id'], |
249 | 249 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
250 | 250 | 'secs_since_last_edit' => $secsSinceLastEdit, |
251 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
251 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
252 | 252 | ]); |
253 | 253 | } |
254 | 254 |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | { |
45 | 45 | $options = ['is_safe' => ['html']]; |
46 | 46 | return [ |
47 | - new \Twig_SimpleFunction('request_time', [ $this, 'requestTime' ], $options), |
|
48 | - new \Twig_SimpleFunction('memory_usage', [ $this, 'requestMemory' ], $options), |
|
49 | - new \Twig_SimpleFunction('year', [ $this, 'generateYear' ], $options), |
|
50 | - new \Twig_SimpleFunction('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options), |
|
51 | - new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options), |
|
52 | - new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options), |
|
53 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
54 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
55 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
56 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
57 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
58 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
59 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
60 | - new \Twig_SimpleFunction('releaseDate', [ $this, 'gitDate' ]), |
|
61 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
62 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
63 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
64 | - new \Twig_SimpleFunction('chartColor', [ $this, 'chartColor' ]), |
|
65 | - new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]), |
|
66 | - new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]), |
|
67 | - new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]), |
|
68 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
69 | - new \Twig_SimpleFunction('replag', [ $this, 'replag' ]), |
|
70 | - new \Twig_SimpleFunction('link', [ $this, 'link' ]), |
|
71 | - new \Twig_SimpleFunction('quote', [ $this, 'quote' ]), |
|
72 | - new \Twig_SimpleFunction('bugReportURL', [ $this, 'bugReportURL' ]), |
|
47 | + new \Twig_SimpleFunction('request_time', [$this, 'requestTime'], $options), |
|
48 | + new \Twig_SimpleFunction('memory_usage', [$this, 'requestMemory'], $options), |
|
49 | + new \Twig_SimpleFunction('year', [$this, 'generateYear'], $options), |
|
50 | + new \Twig_SimpleFunction('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options), |
|
51 | + new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options), |
|
52 | + new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options), |
|
53 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
54 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
55 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
56 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
57 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
58 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
59 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
60 | + new \Twig_SimpleFunction('releaseDate', [$this, 'gitDate']), |
|
61 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
62 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
63 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
64 | + new \Twig_SimpleFunction('chartColor', [$this, 'chartColor']), |
|
65 | + new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']), |
|
66 | + new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']), |
|
67 | + new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']), |
|
68 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
69 | + new \Twig_SimpleFunction('replag', [$this, 'replag']), |
|
70 | + new \Twig_SimpleFunction('link', [$this, 'link']), |
|
71 | + new \Twig_SimpleFunction('quote', [$this, 'quote']), |
|
72 | + new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']), |
|
73 | 73 | new \Twig_SimpleFunction('logged_in_user', [$this, 'functionLoggedInUser']), |
74 | 74 | new \Twig_SimpleFunction('isUserAnon', [$this, 'isUserAnon']), |
75 | 75 | new \Twig_SimpleFunction('nsName', [$this, 'nsName']), |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function requestTime() |
88 | 88 | { |
89 | 89 | if (!isset($this->requestTime)) { |
90 | - $this->requestTime = microtime(true) - $this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
90 | + $this->requestTime = microtime(true)-$this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $this->requestTime; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function intuitionMessage($message = "", $vars = []) |
162 | 162 | { |
163 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
163 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function getAllLangs() |
191 | 191 | { |
192 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
192 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
193 | 193 | |
194 | 194 | $languages = array_values(array_unique(array_map( |
195 | - function ($filename) { |
|
195 | + function($filename) { |
|
196 | 196 | return basename($filename, '.json'); |
197 | 197 | }, |
198 | 198 | $messageFiles |
@@ -540,9 +540,9 @@ discard block |
||
540 | 540 | public function getFilters() |
541 | 541 | { |
542 | 542 | return [ |
543 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
544 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
545 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
543 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
544 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
545 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
546 | 546 | new \Twig_SimpleFilter('num_format', [$this, 'numberFormat']), |
547 | 547 | new \Twig_SimpleFilter('date_format', [$this, 'dateFormatStd']), |
548 | 548 | new \Twig_SimpleFilter('date_localize', [$this, 'dateFormat']), |
@@ -631,10 +631,10 @@ discard block |
||
631 | 631 | if (!$denominator) { |
632 | 632 | $quotient = $numerator; |
633 | 633 | } else { |
634 | - $quotient = ( $numerator / $denominator ) * 100; |
|
634 | + $quotient = ($numerator / $denominator) * 100; |
|
635 | 635 | } |
636 | 636 | |
637 | - return $this->numberFormat($quotient, $precision) . '%'; |
|
637 | + return $this->numberFormat($quotient, $precision).'%'; |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | /** |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | list($val, $key) = $this->getDurationMessageKey($seconds); |
705 | 705 | |
706 | 706 | if ($translate) { |
707 | - return $this->numberFormat($val) . ' ' . $this->intuitionMessage("num-$key", [$val]); |
|
707 | + return $this->numberFormat($val).' '.$this->intuitionMessage("num-$key", [$val]); |
|
708 | 708 | } else { |
709 | 709 | return [$this->numberFormat($val), "num-$key"]; |
710 | 710 | } |
@@ -725,15 +725,15 @@ discard block |
||
725 | 725 | |
726 | 726 | if ($seconds >= 86400) { |
727 | 727 | // Over a day |
728 | - $val = (int) floor($seconds / 86400); |
|
728 | + $val = (int)floor($seconds / 86400); |
|
729 | 729 | $key = 'days'; |
730 | 730 | } elseif ($seconds >= 3600) { |
731 | 731 | // Over an hour, less than a day |
732 | - $val = (int) floor($seconds / 3600); |
|
732 | + $val = (int)floor($seconds / 3600); |
|
733 | 733 | $key = 'hours'; |
734 | 734 | } elseif ($seconds >= 60) { |
735 | 735 | // Over a minute, less than an hour |
736 | - $val = (int) floor($seconds / 60); |
|
736 | + $val = (int)floor($seconds / 60); |
|
737 | 737 | $key = 'minutes'; |
738 | 738 | } |
739 | 739 |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $info = $this->getPageInfo(); |
93 | 93 | $title = isset($info['title']) ? $info['title'] : $this->unnormalizedPageName; |
94 | 94 | $nsName = $this->getNamespaceName(); |
95 | - return str_replace($nsName . ':', '', $title); |
|
95 | + return str_replace($nsName.':', '', $title); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | { |
231 | 231 | // If a user is given, we will not cache the result via instance variable. |
232 | 232 | if ($user !== null) { |
233 | - return (int) $this->getRepository()->getNumRevisions($this, $user, $start, $end); |
|
233 | + return (int)$this->getRepository()->getNumRevisions($this, $user, $start, $end); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | // Return cached value, if present. |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->numRevisions = count($this->revisions); |
244 | 244 | } else { |
245 | 245 | // Otherwise do a COUNT in the event fetching all revisions is not desired. |
246 | - $this->numRevisions = (int) $this->getRepository()->getNumRevisions($this); |
|
246 | + $this->numRevisions = (int)$this->getRepository()->getNumRevisions($this); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | return $this->numRevisions; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | { |
276 | 276 | $content = $this->getRepository()->getPagesWikitext( |
277 | 277 | $this->getProject(), |
278 | - [ $this->getTitle() ] |
|
278 | + [$this->getTitle()] |
|
279 | 279 | ); |
280 | 280 | |
281 | 281 | return isset($content[$this->getTitle()]) |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | |
442 | 442 | $wikidataInfo = $this->getRepository()->getWikidataInfo($this); |
443 | 443 | |
444 | - $terms = array_map(function ($entry) { |
|
444 | + $terms = array_map(function($entry) { |
|
445 | 445 | return $entry['term']; |
446 | 446 | }, $wikidataInfo); |
447 | 447 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | 'prio' => 2, |
453 | 453 | 'name' => 'Wikidata', |
454 | 454 | 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n |
455 | - 'explanation' => "See: <a target='_blank' " . |
|
455 | + 'explanation' => "See: <a target='_blank' ". |
|
456 | 456 | "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>", |
457 | 457 | ]; |
458 | 458 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | 'prio' => 3, |
463 | 463 | 'name' => 'Wikidata', |
464 | 464 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
465 | - 'explanation' => "See: <a target='_blank' " . |
|
465 | + 'explanation' => "See: <a target='_blank' ". |
|
466 | 466 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
467 | 467 | ]; |
468 | 468 | } |
@@ -541,8 +541,8 @@ discard block |
||
541 | 541 | return 0; |
542 | 542 | } |
543 | 543 | |
544 | - return array_sum(array_map(function ($item) { |
|
545 | - return (int) $item['views']; |
|
544 | + return array_sum(array_map(function($item) { |
|
545 | + return (int)$item['views']; |
|
546 | 546 | }, $pageviews['items'])); |
547 | 547 | } |
548 | 548 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $datesConditions = self::createDatesConditions($start, $end); |
29 | 29 | |
30 | 30 | $sql = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current |
31 | - FROM " . $project->getTableName('revision') . " |
|
31 | + FROM " . $project->getTableName('revision')." |
|
32 | 32 | LEFT JOIN $userGroupsTable ON rev_user = ug_user |
33 | 33 | LEFT JOIN $userFormerGroupsTable ON rev_user = ufg_user |
34 | 34 | WHERE rev_page = :pageId AND (ug_group = 'bot' OR ufg_group = 'bot') $datesConditions |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp' |
58 | 58 | FROM $loggingTable |
59 | - WHERE log_namespace = '" . $page->getNamespace() . "' |
|
59 | + WHERE log_namespace = '".$page->getNamespace()."' |
|
60 | 60 | AND log_title = :title AND log_timestamp > 1 $datesConditions |
61 | 61 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
62 | 62 | $title = str_replace(' ', '_', $page->getTitle()); |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | $datesConditions = ''; |
81 | 81 | if (false !== $start) { |
82 | 82 | // Convert to YYYYMMDDHHMMSS. *who in the world thought of having time in BLOB of this format ;-;* |
83 | - $start = date('Ymd', $start) . '000000'; |
|
83 | + $start = date('Ymd', $start).'000000'; |
|
84 | 84 | $datesConditions .= " AND {$tableAlias}{$field} > '$start'"; |
85 | 85 | } |
86 | 86 | if (false !== $end) { |
87 | - $end = date('Ymd', $end) . '000000'; |
|
87 | + $end = date('Ymd', $end).'000000'; |
|
88 | 88 | $datesConditions .= " AND {$tableAlias}{$field} < '$end'"; |
89 | 89 | } |
90 | 90 |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | public function getMaxRevisions() |
185 | 185 | { |
186 | 186 | if (!isset($this->maxRevisions)) { |
187 | - $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions'); |
|
187 | + $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions'); |
|
188 | 188 | } |
189 | 189 | return $this->maxRevisions; |
190 | 190 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | if (false === $start) { |
410 | 410 | // Remember, YYYYMMDD format. |
411 | - $start = date('Ymd', time() - 60 * 60 * 24 * $defaultDays); |
|
411 | + $start = date('Ymd', time()-60 * 60 * 24 * $defaultDays); |
|
412 | 412 | } |
413 | 413 | if (false === $end) { |
414 | 414 | $end = date('Ymd', time()); |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | $this->yearMonthCounts[$editYear]['all']++; |
906 | 906 | $this->yearMonthCounts[$editYear]['months'][$editMonth]['all']++; |
907 | 907 | // This will ultimately be the size of the page by the end of the year |
908 | - $this->yearMonthCounts[$editYear]['size'] = (int) $edit->getLength(); |
|
908 | + $this->yearMonthCounts[$editYear]['size'] = (int)$edit->getLength(); |
|
909 | 909 | |
910 | 910 | // Keep track of which month had the most edits |
911 | 911 | $editsThisMonth = $this->yearMonthCounts[$editYear]['months'][$editMonth]['all']; |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | $editYear = $edit->getYear(); |
925 | 925 | |
926 | 926 | // Beginning of the month at 00:00:00. |
927 | - $firstEditTime = mktime(0, 0, 0, (int) $this->firstEdit->getMonth(), 1, $this->firstEdit->getYear()); |
|
927 | + $firstEditTime = mktime(0, 0, 0, (int)$this->firstEdit->getMonth(), 1, $this->firstEdit->getYear()); |
|
928 | 928 | |
929 | 929 | $this->yearMonthCounts[$editYear] = [ |
930 | 930 | 'all' => 0, |
@@ -1059,14 +1059,14 @@ discard block |
||
1059 | 1059 | $botData = $this->getRepository()->getBotData($this->page, $this->startDate, $this->endDate); |
1060 | 1060 | while ($bot = $botData->fetch()) { |
1061 | 1061 | $bots[$bot['username']] = [ |
1062 | - 'count' => (int) $bot['count'], |
|
1062 | + 'count' => (int)$bot['count'], |
|
1063 | 1063 | 'current' => $bot['current'] === 'bot', |
1064 | 1064 | ]; |
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | // Sort by edit count. |
1068 | - uasort($bots, function ($a, $b) { |
|
1069 | - return $b['count'] - $a['count']; |
|
1068 | + uasort($bots, function($a, $b) { |
|
1069 | + return $b['count']-$a['count']; |
|
1070 | 1070 | }); |
1071 | 1071 | |
1072 | 1072 | $this->bots = $bots; |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | |
1182 | 1182 | if ($info['all'] > 1) { |
1183 | 1183 | // Number of seconds/days between first and last edit. |
1184 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
1184 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
1185 | 1185 | $days = $secs / (60 * 60 * 24); |
1186 | 1186 | |
1187 | 1187 | // Average time between edits (in days). |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | |
1201 | 1201 | // First sort editors array by the amount of text they added. |
1202 | 1202 | $topTenEditorsByAdded = $this->editors; |
1203 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
1203 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
1204 | 1204 | if ($a['added'] === $b['added']) { |
1205 | 1205 | return 0; |
1206 | 1206 | } |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | // Then build a new array of top 10 editors by added text, |
1211 | 1211 | // in the data structure needed for the chart. |
1212 | - $this->topTenEditorsByAdded = array_map(function ($editor) { |
|
1212 | + $this->topTenEditorsByAdded = array_map(function($editor) { |
|
1213 | 1213 | $added = $this->editors[$editor]['added']; |
1214 | 1214 | return [ |
1215 | 1215 | 'label' => $editor, |