@@ -111,7 +111,7 @@ |
||
111 | 111 | * List top edits by this user for all pages in a particular namespace. |
112 | 112 | * @param User $user The User. |
113 | 113 | * @param Project $project The project. |
114 | - * @param integer|string $namespace The namespace ID or 'all' |
|
114 | + * @param integer $namespace The namespace ID or 'all' |
|
115 | 115 | * @return \Symfony\Component\HttpFoundation\Response |
116 | 116 | */ |
117 | 117 | protected function namespaceTopEdits(User $user, Project $project, $namespace) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | 'username' => $username, |
69 | 69 | ]); |
70 | 70 | } elseif ($project != "") { |
71 | - return $this->redirectToRoute("TopEditsResults", [ 'project'=>$project ]); |
|
71 | + return $this->redirectToRoute("TopEditsResults", ['project'=>$project]); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // set default wiki so we can populate the namespace selector |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | // Get page info about these 100 pages, so we can use their display title. |
146 | - $titles = array_map(function ($e) { |
|
146 | + $titles = array_map(function($e) { |
|
147 | 147 | return $e['page_title']; |
148 | 148 | }, $editData); |
149 | 149 | /** @var ApiHelper $apiHelper */ |
@@ -14,6 +14,9 @@ |
||
14 | 14 | /** @var string[] Basic metadata about the project */ |
15 | 15 | protected $metadata; |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $nameOrUrl |
|
19 | + */ |
|
17 | 20 | public function __construct($nameOrUrl) |
18 | 21 | { |
19 | 22 | $this->nameUnnormalized = $nameOrUrl; |
@@ -55,7 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | public function getUrl() |
57 | 57 | { |
58 | - return rtrim($this->getMetadata()['url'], '/') . '/'; |
|
58 | + return rtrim($this->getMetadata()['url'], '/').'/'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -16,37 +16,37 @@ discard block |
||
16 | 16 | { |
17 | 17 | $options = ['is_safe' => ['html']]; |
18 | 18 | return [ |
19 | - new \Twig_SimpleFunction('request_time', [ $this, 'requestTime' ], $options), |
|
20 | - new \Twig_SimpleFunction('memory_usage', [ $this, 'requestMemory' ], $options), |
|
21 | - new \Twig_SimpleFunction('year', [ $this, 'generateYear' ], $options), |
|
22 | - new \Twig_SimpleFunction('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options), |
|
23 | - new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options), |
|
24 | - new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options), |
|
25 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
26 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
27 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
28 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
29 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
30 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
31 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
32 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
33 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
34 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
35 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
36 | - new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]), |
|
37 | - new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]), |
|
38 | - new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]), |
|
39 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
40 | - new \Twig_SimpleFunction('replag', [ $this, 'replag' ]), |
|
41 | - new \Twig_SimpleFunction('link', [ $this, 'link' ]), |
|
42 | - new \Twig_SimpleFunction('quote', [ $this, 'quote' ]), |
|
19 | + new \Twig_SimpleFunction('request_time', [$this, 'requestTime'], $options), |
|
20 | + new \Twig_SimpleFunction('memory_usage', [$this, 'requestMemory'], $options), |
|
21 | + new \Twig_SimpleFunction('year', [$this, 'generateYear'], $options), |
|
22 | + new \Twig_SimpleFunction('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options), |
|
23 | + new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options), |
|
24 | + new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options), |
|
25 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
26 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
27 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
28 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
29 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
30 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
31 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
32 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
33 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
34 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
35 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
36 | + new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']), |
|
37 | + new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']), |
|
38 | + new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']), |
|
39 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
40 | + new \Twig_SimpleFunction('replag', [$this, 'replag']), |
|
41 | + new \Twig_SimpleFunction('link', [$this, 'link']), |
|
42 | + new \Twig_SimpleFunction('quote', [$this, 'quote']), |
|
43 | 43 | ]; |
44 | 44 | } |
45 | 45 | |
46 | 46 | public function requestTime($decimals = 3) |
47 | 47 | { |
48 | 48 | |
49 | - return number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
49 | + return number_format(microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function requestMemory() |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function linkToWiki($url, $page, $secondary = "") |
74 | 74 | { |
75 | - $link = $url . "/"; |
|
75 | + $link = $url."/"; |
|
76 | 76 | |
77 | 77 | if ($this->isWMFLabs()) { |
78 | 78 | $link .= "wiki/"; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | public function linkToWikiScript($url, $secondary) |
91 | 91 | { |
92 | - $link = $url . "/"; |
|
92 | + $link = $url."/"; |
|
93 | 93 | |
94 | 94 | if ($this->isWMFLabs()) { |
95 | 95 | $link .= "w/"; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | // TODO: refactor all intuition stuff so it can be used anywhere |
106 | 106 | public function intuitionMessageExists($message = "") |
107 | 107 | { |
108 | - return $this->getIntuition()->msgExists($message, [ "domain" => "xtools" ]); |
|
108 | + return $this->getIntuition()->msgExists($message, ["domain" => "xtools"]); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | public function intuitionMessagePrintExists($message = "", $vars = []) |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | public function intuitionMessage($message = "", $vars = []) |
126 | 126 | { |
127 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
127 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | public function getLang() |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function getAllLangs() |
147 | 147 | { |
148 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
148 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
149 | 149 | |
150 | 150 | $languages = array_values(array_unique(array_map( |
151 | - function ($filename) { |
|
151 | + function($filename) { |
|
152 | 152 | return basename($filename, '.json'); |
153 | 153 | }, |
154 | 154 | $messageFiles |
@@ -205,41 +205,41 @@ discard block |
||
205 | 205 | public static function getColorList($num = false) |
206 | 206 | { |
207 | 207 | $colors = [ |
208 | - 0 => '#Cc0000',# '#FF005A', #red '#FF5555', |
|
208 | + 0 => '#Cc0000', # '#FF005A', #red '#FF5555', |
|
209 | 209 | 1 => '#F7b7b7', |
210 | - 2 => '#5c8d20',# '#008800', #green'#55FF55', |
|
210 | + 2 => '#5c8d20', # '#008800', #green'#55FF55', |
|
211 | 211 | 3 => '#85eD82', |
212 | 212 | 4 => '#2E97E0', # blue |
213 | 213 | 5 => '#B9E3F9', |
214 | - 6 => '#e1711d', # orange |
|
214 | + 6 => '#e1711d', # orange |
|
215 | 215 | 7 => '#ffc04c', |
216 | 216 | 8 => '#FDFF98', # yellow |
217 | 217 | 9 => '#5555FF', |
218 | 218 | 10 => '#55FFFF', |
219 | - 11 => '#0000C0', # |
|
220 | - 12 => '#008800', # green |
|
219 | + 11 => '#0000C0', # |
|
220 | + 12 => '#008800', # green |
|
221 | 221 | 13 => '#00C0C0', |
222 | - 14 => '#FFAFAF', # rosé |
|
223 | - 15 => '#808080', # gray |
|
222 | + 14 => '#FFAFAF', # rosé |
|
223 | + 15 => '#808080', # gray |
|
224 | 224 | 16 => '#00C000', |
225 | 225 | 17 => '#404040', |
226 | - 18 => '#C0C000', # green |
|
226 | + 18 => '#C0C000', # green |
|
227 | 227 | 19 => '#C000C0', |
228 | - 100 => '#75A3D1', # blue |
|
229 | - 101 => '#A679D2', # purple |
|
228 | + 100 => '#75A3D1', # blue |
|
229 | + 101 => '#A679D2', # purple |
|
230 | 230 | 102 => '#660000', |
231 | 231 | 103 => '#000066', |
232 | - 104 => '#FAFFAF', # caramel |
|
232 | + 104 => '#FAFFAF', # caramel |
|
233 | 233 | 105 => '#408345', |
234 | 234 | 106 => '#5c8d20', |
235 | - 107 => '#e1711d', # red |
|
236 | - 108 => '#94ef2b', # light green |
|
237 | - 109 => '#756a4a', # brown |
|
235 | + 107 => '#e1711d', # red |
|
236 | + 108 => '#94ef2b', # light green |
|
237 | + 109 => '#756a4a', # brown |
|
238 | 238 | 110 => '#6f1dab', |
239 | 239 | 111 => '#301e30', |
240 | 240 | 112 => '#5c9d96', |
241 | - 113 => '#a8cd8c', # earth green |
|
242 | - 114 => '#f2b3f1', # light purple |
|
241 | + 113 => '#a8cd8c', # earth green |
|
242 | + 114 => '#f2b3f1', # light purple |
|
243 | 243 | 115 => '#9b5828', |
244 | 244 | 118 => '#99FFFF', |
245 | 245 | 119 => '#99BBFF', |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | 446 => '#06DCFB', |
261 | 261 | 447 => '#892EE4', |
262 | 262 | 460 => '#99FF66', |
263 | - 461 => '#99CC66', # green |
|
264 | - 470 => '#CCCC33', # ocker |
|
263 | + 461 => '#99CC66', # green |
|
264 | + 470 => '#CCCC33', # ocker |
|
265 | 265 | 471 => '#CCFF33', |
266 | 266 | 480 => '#6699FF', |
267 | 267 | 481 => '#66FFFF', |
@@ -276,18 +276,18 @@ discard block |
||
276 | 276 | 1198 => '#FF34B3', |
277 | 277 | 1199 => '#8B1C62', |
278 | 278 | |
279 | - '#61a9f3',# blue |
|
280 | - '#f381b9',# pink |
|
279 | + '#61a9f3', # blue |
|
280 | + '#f381b9', # pink |
|
281 | 281 | '#61E3A9', |
282 | 282 | '#D56DE2', |
283 | 283 | '#85eD82', |
284 | 284 | '#F7b7b7', |
285 | 285 | '#CFDF49', |
286 | 286 | '#88d8f2', |
287 | - '#07AF7B',# green |
|
287 | + '#07AF7B', # green |
|
288 | 288 | '#B9E3F9', |
289 | 289 | '#FFF3AD', |
290 | - '#EF606A',# red |
|
290 | + '#EF606A', # red |
|
291 | 291 | '#EC8833', |
292 | 292 | '#FFF100', |
293 | 293 | '#87C9A5', |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | public function getFilters() |
415 | 415 | { |
416 | 416 | return [ |
417 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
418 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
417 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
418 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
419 | 419 | ]; |
420 | 420 | } |
421 | 421 | |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | if (!$denominator) { |
443 | 443 | $quotient = $numerator; |
444 | 444 | } else { |
445 | - $quotient = ( $numerator / $denominator ) * 100; |
|
445 | + $quotient = ($numerator / $denominator) * 100; |
|
446 | 446 | } |
447 | 447 | |
448 | - return round($quotient, $precision) . '%'; |
|
448 | + return round($quotient, $precision).'%'; |
|
449 | 449 | } |
450 | 450 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Get this page's database ID. |
55 | - * @return int |
|
55 | + * @return \string|null |
|
56 | 56 | */ |
57 | 57 | public function getId() |
58 | 58 | { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | - * @return string |
|
78 | + * @return \string|null |
|
79 | 79 | */ |
80 | 80 | public function getUrl() |
81 | 81 | { |