@@ -255,7 +255,7 @@ |
||
| 255 | 255 | * Adapted from https://github.com/MusikAnimal/pageviews |
| 256 | 256 | * @param array $params Associative array of params to pass to API |
| 257 | 257 | * @param string $project Project to query, e.g. en.wikipedia.org |
| 258 | - * @param string|func $dataKey The key for the main chunk of data, in the query hash |
|
| 258 | + * @param string $dataKey The key for the main chunk of data, in the query hash |
|
| 259 | 259 | * (e.g. 'categorymembers' for API:Categorymembers). |
| 260 | 260 | * If this is a function it is given the response data, |
| 261 | 261 | * and expected to return the data we want to concatentate. |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | public function groups($project, $username) |
| 66 | 66 | { |
| 67 | 67 | $this->setUp($project); |
| 68 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
| 68 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
| 69 | 69 | $query = new SimpleRequest('query', $params); |
| 70 | 70 | $result = []; |
| 71 | 71 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public function globalGroups($project, $username) |
| 92 | 92 | { |
| 93 | 93 | $this->setUp($project); |
| 94 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
| 94 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
| 95 | 95 | $query = new SimpleRequest('query', $params); |
| 96 | 96 | $result = []; |
| 97 | 97 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $groups[] = "B"; |
| 142 | 142 | } |
| 143 | 143 | if (in_array("steward", $admin["groups"])) { |
| 144 | - $groups[] = "S" ; |
|
| 144 | + $groups[] = "S"; |
|
| 145 | 145 | } |
| 146 | 146 | if (in_array("checkuser", $admin["groups"])) { |
| 147 | 147 | $groups[] = "CU"; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | if (in_array("bot", $admin["groups"])) { |
| 153 | 153 | $groups[] = "Bot"; |
| 154 | 154 | } |
| 155 | - $result[ $admin["name"] ] = [ |
|
| 155 | + $result[$admin["name"]] = [ |
|
| 156 | 156 | "groups" => implode('/', $groups) |
| 157 | 157 | ]; |
| 158 | 158 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $normalized = []; |
| 228 | 228 | if (isset($result['query']['normalized'])) { |
| 229 | 229 | array_map( |
| 230 | - function ($e) use (&$normalized) { |
|
| 230 | + function($e) use (&$normalized) { |
|
| 231 | 231 | $normalized[$e['to']] = $e['from']; |
| 232 | 232 | }, |
| 233 | 233 | $result['query']['normalized'] |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $query = FluentRequest::factory()->setAction('query')->setParams($requestData); |
| 313 | 313 | $innerPromise = $this->api->getRequestAsync($query); |
| 314 | 314 | |
| 315 | - $innerPromise->then(function ($result) use (&$data) { |
|
| 315 | + $innerPromise->then(function($result) use (&$data) { |
|
| 316 | 316 | // some failures come back as 200s, so we still resolve and let the outer function handle it |
| 317 | 317 | if (isset($result['error']) || !isset($result['query'])) { |
| 318 | 318 | return $data['promise']->resolve($data); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | * Get metadata about a single page from the API. |
| 18 | 18 | * @param Project $project The project to which the page belongs. |
| 19 | 19 | * @param string $pageTitle Page title. |
| 20 | - * @return string[] Array with some of the following keys: pageid, title, missing, displaytitle, |
|
| 20 | + * @return string|null Array with some of the following keys: pageid, title, missing, displaytitle, |
|
| 21 | 21 | * url. |
| 22 | 22 | */ |
| 23 | 23 | public function getPageInfo(Project $project, $pageTitle) |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | use Xtools\Page; |
| 11 | 11 | use Xtools\PagesRepository; |
| 12 | 12 | use Xtools\Project; |
| 13 | -use Xtools\ProjectRepository; |
|
| 14 | 13 | use Xtools\User; |
| 15 | 14 | |
| 16 | 15 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function getUrl($withTrailingSlash = true) |
| 92 | 92 | { |
| 93 | - return rtrim($this->getMetadata()['url'], '/') . ($withTrailingSlash ? '/' : ''); |
|
| 93 | + return rtrim($this->getMetadata()['url'], '/').($withTrailingSlash ? '/' : ''); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $metadata = $this->getRepository()->getMetadata($this->getUrl()); |
| 148 | 148 | return isset($metadata['general']['script']) |
| 149 | 149 | ? $metadata['general']['script'] |
| 150 | - : $this->getScriptPath() . '/index.php'; |
|
| 150 | + : $this->getScriptPath().'/index.php'; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function getApiUrl() |
| 159 | 159 | { |
| 160 | - return rtrim($this->getUrl(), '/') . $this->getRepository()->getApiPath(); |
|
| 160 | + return rtrim($this->getUrl(), '/').$this->getRepository()->getApiPath(); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function userOptInPage(User $user) |
| 191 | 191 | { |
| 192 | - $localPageName = 'User:' . $user->getUsername() . '/EditCounterOptIn.js'; |
|
| 192 | + $localPageName = 'User:'.$user->getUsername().'/EditCounterOptIn.js'; |
|
| 193 | 193 | return $localPageName; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | // 4. Lastly, see if they've opted in globally on the default project or Meta. |
| 226 | - $globalPageName = $user->getUsername() . '/EditCounterGlobalOptIn.js'; |
|
| 226 | + $globalPageName = $user->getUsername().'/EditCounterGlobalOptIn.js'; |
|
| 227 | 227 | $globalProject = $this->getRepository()->getGlobalProject(); |
| 228 | 228 | if ($globalProject instanceof Project) { |
| 229 | 229 | $globalExists = $globalProject->getRepository() |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public function hasPageAssessments() |
| 244 | 244 | { |
| 245 | - return (bool) $this->getRepository()->getAssessmentsConfig($this->getDomain()); |
|
| 245 | + return (bool)$this->getRepository()->getAssessmentsConfig($this->getDomain()); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | $config = $this->getRepository()->getAssessmentsConfig($this->getDomain()); |
| 256 | 256 | |
| 257 | 257 | if (isset($config['class'][$class])) { |
| 258 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config['class'][$class]['badge']; |
|
| 258 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config['class'][$class]['badge']; |
|
| 259 | 259 | } elseif (isset($config['class']['Unknown'])) { |
| 260 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config['class']['Unknown']['badge']; |
|
| 260 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config['class']['Unknown']['badge']; |
|
| 261 | 261 | } else { |
| 262 | 262 | return ""; |
| 263 | 263 | } |
@@ -235,7 +235,7 @@ |
||
| 235 | 235 | $classAttrs = $config['class']['Unknown']; |
| 236 | 236 | $assessment['class']['value'] = '???'; |
| 237 | 237 | $assessment['class']['category'] = $classAttrs['category']; |
| 238 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge']; |
|
| 238 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge']; |
|
| 239 | 239 | } else { |
| 240 | 240 | $classAttrs = $config['class'][$classValue]; |
| 241 | 241 | $assessment['class'] = [ |