The function check_system_version() has an NPath complexity of 800. The configured NPath complexity threshold is 200. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 '146', column '23'). Open
$client = new GuzzleHttp\Client();
- 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 '281', column '19'). Open
throw new Exception(get_lang('Deny access'));
- 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 '311', column '19'). Open
throw new Exception(get_lang('Deny access'));
- 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 '218', column '23'). Open
$client = new GuzzleHttp\Client();
- 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 check_system_version uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$output = '<span style="color:green">'.
get_lang('Your version is up-to-date').'<br />'.
get_lang('The latest version is').' <b>Chamilo '.$version.'</b>. <br />'.
get_lang('Your version is').' <b>Chamilo '.$system_version.$versionStatus.'</b>. <br />'.
- 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 version_check uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// site not registered. Call anyway
$return .= check_system_version();
}
- 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
Avoid using empty try-catch blocks in check_system_version. Open
} catch (Exception $e) {
}
- Read upRead up
- Exclude checks
EmptyCatchBlock
Since: 2.7.0
Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.
Example
class Foo {
public function bar()
{
try {
// ...
} catch (Exception $e) {} // empty catch block
}
}
Source https://phpmd.org/rules/design.html#emptycatchblock
Variable "system_version" is not in valid camel caps format Open
get_lang('Your version is').' <b>Chamilo '.$system_version.$versionStatus.'</b>. <br />'.
- Exclude checks
Variable "number_of_sessions" is not in valid camel caps format Open
'numberofsessions' => $number_of_sessions,
- Exclude checks
Variable "number_of_active_users" is not in valid camel caps format Open
'numberofactiveusers' => $number_of_active_users, // to sum up into non-personal statistics
- Exclude checks
Consider putting global function "getProSupport" in a static class Open
function getProSupport()
- Exclude checks
Variable "number_of_courses" is not in valid camel caps format Open
'numberofcourses' => $number_of_courses, // to sum up into non-personal statistics - see https://version.chamilo.org/stats/
- Exclude checks
Consider putting global function "check_system_version" in a static class Open
function check_system_version()
- Exclude checks
Variable "number_of_courses" is not in valid camel caps format Open
$number_of_courses = Statistics::countCourses();
- Exclude checks
Variable "number_of_users" is not in valid camel caps format Open
'numberofusers' => $number_of_users, // to sum up into non-personal statistics
- Exclude checks
Variable "url_id" is not in valid camel caps format Open
if (api_is_global_platform_admin() && 1 == $url_id) {
- Exclude checks
Variable "tbl_settings" is not in valid camel caps format Open
$tbl_settings = Database::get_main_table(TABLE_MAIN_SETTINGS);
- Exclude checks
Variable "system_version" is not in valid camel caps format Open
$system_version = '';
- Exclude checks
Add a single space around assignment operators Open
$versionFile =__DIR__.'/../../install/version.php';
- Exclude checks
Consider putting global function "version_check" in a static class Open
function version_check()
- Exclude checks
Consider putting global function "getLatestNews" in a static class Open
function getLatestNews()
- Exclude checks
Variable "number_of_sessions" is not in valid camel caps format Open
$number_of_sessions = SessionManager::count_sessions(api_get_current_access_url_id());
- Exclude checks
Variable "system_version" is not in valid camel caps format Open
get_lang('Your version is').' <b>Chamilo '.$system_version.$versionStatus.'</b>. <br />'.
- Exclude checks
Variable "number_of_active_users" is not in valid camel caps format Open
$number_of_active_users = Statistics::countUsers(
- Exclude checks
Variable "number_of_users" is not in valid camel caps format Open
$number_of_users = Statistics::countUsers();
- Exclude checks
Variable "system_version" is not in valid camel caps format Open
'version' => $system_version,
- Exclude checks
Variable "url_id" is not in valid camel caps format Open
$url_id = api_get_current_access_url_id();
- Exclude checks
Variable "system_version" is not in valid camel caps format Open
$system_version = trim($versionDetails['new_version']);
- Exclude checks
Variable "system_version" is not in valid camel caps format Open
if (version_compare($system_version, $version, '<')) {
- Exclude checks
Variable "tbl_settings" is not in valid camel caps format Open
$sql = 'SELECT selected_value FROM '.$tbl_settings.' WHERE variable = "registered" ';
- Exclude checks
There must be a comment when fall-through is intentional in a non-empty case body Open
case 'get_latest_news':
- Exclude checks
The variable $number_of_active_users is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $tbl_settings is not named in camelCase. Open
function version_check()
{
$tbl_settings = Database::get_main_table(TABLE_MAIN_SETTINGS);
$sql = 'SELECT selected_value FROM '.$tbl_settings.' WHERE variable = "registered" ';
$result = Database::query($sql);
- 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 $system_version is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $tbl_settings is not named in camelCase. Open
function version_check()
{
$tbl_settings = Database::get_main_table(TABLE_MAIN_SETTINGS);
$sql = 'SELECT selected_value FROM '.$tbl_settings.' WHERE variable = "registered" ';
$result = Database::query($sql);
- 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 $system_version is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $system_version is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $number_of_users is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $number_of_sessions is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $number_of_courses is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $number_of_courses is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $system_version is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $system_version is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $system_version is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $number_of_sessions is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $number_of_users is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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 $number_of_active_users is not named in camelCase. Open
function check_system_version()
{
// Check if curl is available.
if (!in_array('curl', get_loaded_extensions())) {
return '<span style="color:red">'.
- 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();
}
}