Missing class import via use statement (line '79', column '27'). Open
$fieldValue = new ExtraFieldValue('work');
- 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 get_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$status = Display::label('Ok', 'success');
}
- 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 get_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$first = Display::url($studentData['lastname'], $urlDetails);
$last = Display::url($studentData['firstname'], $urlDetails);
}
- 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 unused parameters such as '$direction'. Open
function get_users($from, $number_of_items, $column, $direction)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$column'. Open
function get_users($from, $number_of_items, $column, $direction)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused local variables such as '$lastConnectionDate'. Open
$lastConnectionDate = null;
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The parameter $number_of_items is not named in camelCase. Open
function get_users($from, $number_of_items, $column, $direction)
{
$consideredWorkingTime = api_get_setting('work.considered_working_time');
$courseId = api_get_course_int_id();
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Variable "is_western_name_order" is not in valid camel caps format Open
if ($is_western_name_order) {
- Exclude checks
Variable "number_of_items" is not in valid camel caps format Open
function get_users($from, $number_of_items, $column, $direction)
- Exclude checks
Variable "number_of_items" is not in valid camel caps format Open
$limit = 'LIMIT '.$from.','.$number_of_items;
- Exclude checks
Variable "all_datas" is not in valid camel caps format Open
$all_datas = [];
- Exclude checks
Consider putting global function "get_users" in a static class Open
function get_users($from, $number_of_items, $column, $direction)
- Exclude checks
Missing function doc comment Open
function get_users($from, $number_of_items, $column, $direction)
- Exclude checks
Variable "number_of_items" is not in valid camel caps format Open
$number_of_items = (int) $number_of_items;
- Exclude checks
Variable "is_western_name_order" is not in valid camel caps format Open
if ($is_western_name_order) {
- Exclude checks
Variable "sort_by_first_name" is not in valid camel caps format Open
($is_western_name_order xor $sort_by_first_name) ? 1 : 0,
- Exclude checks
Variable "number_of_items" is not in valid camel caps format Open
$number_of_items = (int) $number_of_items;
- Exclude checks
Variable "all_datas" is not in valid camel caps format Open
$all_datas[] = $row;
- Exclude checks
Variable "this_section" is not in valid camel caps format Open
$this_section = SECTION_TRACKING;
- Exclude checks
Missing function doc comment Open
function get_count_users()
- Exclude checks
Variable "is_western_name_order" is not in valid camel caps format Open
$is_western_name_order = api_is_western_name_order();
- Exclude checks
Variable "sort_by_first_name" is not in valid camel caps format Open
$sort_by_first_name = api_sort_by_first_name();
- Exclude checks
Variable "all_datas" is not in valid camel caps format Open
return $all_datas;
- Exclude checks
Consider putting global function "get_count_users" in a static class Open
function get_count_users()
- Exclude checks
Variable "is_western_name_order" is not in valid camel caps format Open
$is_western_name_order = api_is_western_name_order();
- Exclude checks
Variable "is_western_name_order" is not in valid camel caps format Open
($is_western_name_order xor $sort_by_first_name) ? 1 : 0,
- Exclude checks
The variable $is_western_name_order is not named in camelCase. Open
function get_users($from, $number_of_items, $column, $direction)
{
$consideredWorkingTime = api_get_setting('work.considered_working_time');
$courseId = api_get_course_int_id();
- 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_items is not named in camelCase. Open
function get_users($from, $number_of_items, $column, $direction)
{
$consideredWorkingTime = api_get_setting('work.considered_working_time');
$courseId = api_get_course_int_id();
- 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 $all_datas is not named in camelCase. Open
function get_users($from, $number_of_items, $column, $direction)
{
$consideredWorkingTime = api_get_setting('work.considered_working_time');
$courseId = api_get_course_int_id();
- 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 $is_western_name_order is not named in camelCase. Open
function get_users($from, $number_of_items, $column, $direction)
{
$consideredWorkingTime = api_get_setting('work.considered_working_time');
$courseId = api_get_course_int_id();
- 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_items is not named in camelCase. Open
function get_users($from, $number_of_items, $column, $direction)
{
$consideredWorkingTime = api_get_setting('work.considered_working_time');
$courseId = api_get_course_int_id();
- 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_items is not named in camelCase. Open
function get_users($from, $number_of_items, $column, $direction)
{
$consideredWorkingTime = api_get_setting('work.considered_working_time');
$courseId = api_get_course_int_id();
- 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 $all_datas is not named in camelCase. Open
function get_users($from, $number_of_items, $column, $direction)
{
$consideredWorkingTime = api_get_setting('work.considered_working_time');
$courseId = api_get_course_int_id();
- 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 $all_datas is not named in camelCase. Open
function get_users($from, $number_of_items, $column, $direction)
{
$consideredWorkingTime = api_get_setting('work.considered_working_time');
$courseId = api_get_course_int_id();
- 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();
}
}