includes/api/ApiAuthManagerHelper.php
File ApiAuthManagerHelper.php
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Copyright © 2016 Wikimedia Foundation and contributors
*
* This program is free software; you can redistribute it and/or modify
Method getStandardParams
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getStandardParams( $action, ...$wantedParams ) {
$params = [
'requests' => [
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_ISMULTI => true,
Method formatAuthenticationResponse
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function formatAuthenticationResponse( AuthenticationResponse $res ) {
$ret = [
'status' => $res->status,
];
Method formatRequests
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function formatRequests( array $reqs ) {
$params = $this->module->extractRequestParams();
$mergeFields = !empty( $params['mergerequestfields'] );
$ret = [ 'requests' => [] ];
Method loadAuthenticationRequests
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function loadAuthenticationRequests( $action ) {
$params = $this->module->extractRequestParams();
$reqs = $this->authManager->getAuthenticationRequests( $action, $this->module->getUser() );
Function formatAuthenticationResponse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
public function formatAuthenticationResponse( AuthenticationResponse $res ) {
$ret = [
'status' => $res->status,
];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function formatRequests
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function formatRequests( array $reqs ) {
$params = $this->module->extractRequestParams();
$mergeFields = !empty( $params['mergerequestfields'] );
$ret = [ 'requests' => [] ];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"