The function updateUsers() has an NPath complexity of 23224322. The configured NPath complexity threshold is 200. Open
function updateUsers(
$users,
$resetPassword = false,
$sendEmail = false)
{
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The function validate_data() has an NPath complexity of 757. The configured NPath complexity threshold is 200. Open
function validate_data($users)
{
global $defined_auth_sources;
$errors = [];
$usernames = [];
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
Missing class import via use statement (line '230', column '19'). Open
throw new Exception(get_lang('NoDataAvailable'));
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '28', column '22'). Open
$usergroup = new UserGroupModel();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '238', column '23'). Open
throw new Exception(get_lang('ThisFieldIsRequired').': UserName');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '96', column '22'). Open
$usergroup = new UserGroupModel();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method updateUsers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (isset($user['Password'])) {
$changePassMethod = 2;
$password = $user['Password'];
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method validate_data uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$classExistList[] = $info['id'];
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Variable "defined_auth_sources" is not in valid camel caps format Open
global $defined_auth_sources;
- Exclude checks
Variable "defined_auth_sources" is not in valid camel caps format Open
if (!in_array($user['AuthSource'], $defined_auth_sources)) {
- Exclude checks
Consider putting global function "updateUsers" in a static class Open
function updateUsers(
- Exclude checks
Variable "extra_fields" is not in valid camel caps format Open
global $extra_fields;
- Exclude checks
The closing parenthesis of a multi-line function declaration must be on a new line Open
$sendEmail = false)
- Exclude checks
Variable "purification_option_for_usernames" is not in valid camel caps format Open
$purification_option_for_usernames = false;
- Exclude checks
Consider putting global function "parse_csv_data" in a static class Open
function parse_csv_data($file)
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
{
- Exclude checks
Variable "extra_fields" is not in valid camel caps format Open
foreach ($extra_fields as $extras) {
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$user_id,
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$userUpdated = api_get_user_info($user_id);
- Exclude checks
Consider putting global function "parse_xml_data" in a static class Open
function parse_xml_data($file)
- Exclude checks
Missing function doc comment Open
function parse_xml_data($file)
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$user_id = $userInfo['user_id'];
- Exclude checks
Consider putting global function "validate_data" in a static class Open
function validate_data($users)
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$user_id,
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
[$user_id],
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
CourseManager::subscribeUser($user_id, $courseInfo['real_id'], $user['Status']);
- Exclude checks
Variable "count_fields" is not in valid camel caps format Open
if ($count_fields > 0) {
- Exclude checks
Variable "list_reponse" is not in valid camel caps format Open
$list_reponse[] = 'xxx';
- Exclude checks
Variable "result_xml" is not in valid camel caps format Open
$result_xml .= $spaces.'<'.$extra[1].'>xxx</'.$extra[1].'>';
- Exclude checks
Variable "list_reponse" is not in valid camel caps format Open
if (count($list_reponse) > 0) {
- Exclude checks
Variable "this_section" is not in valid camel caps format Open
$this_section = SECTION_PLATFORM_ADMIN;
- Exclude checks
Variable "defined_auth_sources" is not in valid camel caps format Open
$defined_auth_sources = array_merge($defined_auth_sources, array_keys($extAuthSource));
- Exclude checks
Variable "list_reponse" is not in valid camel caps format Open
$content .= implode(';', $list_reponse).';';
- Exclude checks
Variable "count_fields" is not in valid camel caps format Open
if ($i != $count_fields - 1) {
- Exclude checks
Variable "defined_auth_sources" is not in valid camel caps format Open
$defined_auth_sources[] = PLATFORM_AUTH_SOURCE;
- Exclude checks
Variable "tool_name" is not in valid camel caps format Open
Display::display_header($tool_name);
- Exclude checks
Variable "count_fields" is not in valid camel caps format Open
$count_fields = count($extra_fields);
- Exclude checks
Variable "tool_name" is not in valid camel caps format Open
$form->addHeader($tool_name);
- Exclude checks
Variable "list_reponse" is not in valid camel caps format Open
$list_reponse = [];
- Exclude checks
Variable "extra_fields" is not in valid camel caps format Open
$count_fields = count($extra_fields);
- Exclude checks
Variable "defined_auth_sources" is not in valid camel caps format Open
$defined_auth_sources = array_merge($defined_auth_sources, array_keys($extAuthSource));
- Exclude checks
Variable "extra_fields" is not in valid camel caps format Open
$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
- Exclude checks
Variable "result_xml" is not in valid camel caps format Open
$result_xml = '';
- Exclude checks
Variable "extra_fields" is not in valid camel caps format Open
foreach ($extra_fields as $extra) {
- Exclude checks
Variable "result_xml" is not in valid camel caps format Open
$result_xml .= '<br/>';
- Exclude checks
Variable "tool_name" is not in valid camel caps format Open
$tool_name = get_lang('UpdateUserListXMLCSV');
- Exclude checks
The variable $user_id is not named in camelCase. Open
function updateUsers(
$users,
$resetPassword = false,
$sendEmail = false)
{
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $extra_fields is not named in camelCase. Open
function updateUsers(
$users,
$resetPassword = false,
$sendEmail = false)
{
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_id is not named in camelCase. Open
function updateUsers(
$users,
$resetPassword = false,
$sendEmail = false)
{
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $extra_fields is not named in camelCase. Open
function updateUsers(
$users,
$resetPassword = false,
$sendEmail = false)
{
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_id is not named in camelCase. Open
function updateUsers(
$users,
$resetPassword = false,
$sendEmail = false)
{
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $defined_auth_sources is not named in camelCase. Open
function validate_data($users)
{
global $defined_auth_sources;
$errors = [];
$usernames = [];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_id is not named in camelCase. Open
function updateUsers(
$users,
$resetPassword = false,
$sendEmail = false)
{
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $defined_auth_sources is not named in camelCase. Open
function validate_data($users)
{
global $defined_auth_sources;
$errors = [];
$usernames = [];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_id is not named in camelCase. Open
function updateUsers(
$users,
$resetPassword = false,
$sendEmail = false)
{
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_id is not named in camelCase. Open
function updateUsers(
$users,
$resetPassword = false,
$sendEmail = false)
{
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}