Missing class import via use statement (line '93', column '27'). Open
$attendance = new Attendance();
- 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 getContent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$heightSize = $maxCounts * 40;
}
- 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 getContent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$attendances_faults_avg[$student['lastname']] = 0;
}
- 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 getContent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$maxCounts = max(count($usernames), count($faults));
if ($maxCounts < 5) {
$heightSize = 200;
} else {
- 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 getContent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$graph = '<p>'.api_convert_encoding(get_lang('Graphic not available'), 'UTF-8').'</p>';
}
- 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 local variables such as '$img_file'. Open
$img_file = '';
- 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 $user_id is not named in camelCase. Open
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_student_graph';
if ($this->is_block_visible_for_user($user_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
The parameter $user_id is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = false;
- 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
The property $user_id is not named in camelCase. Open
class BlockStudentGraph extends Block
{
private $user_id;
private $students;
private $permission = [DRH];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Variable "user_status" is not in valid camel caps format Open
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
- Exclude checks
Method name "BlockStudentGraph::is_block_visible_for_user" is not in camel caps format Open
public function is_block_visible_for_user($user_id)
- Exclude checks
Variable "is_block_visible_for_user" is not in valid camel caps format Open
$is_block_visible_for_user = false;
- Exclude checks
Variable "Antialias" is not in valid camel caps format Open
$myPicture->Antialias = false;
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
if ($this->is_block_visible_for_user($user_id)) {
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
public function is_block_visible_for_user($user_id)
- Exclude checks
Variable "user_info" is not in valid camel caps format Open
$user_info = api_get_user_info($user_id);
- Exclude checks
Variable "attendances_faults_avg" is not in valid camel caps format Open
$attendances_faults_avg[$student['lastname']] = $results_faults_avg['percent'];
- Exclude checks
Variable "attendances_faults_avg" is not in valid camel caps format Open
$faults[] = $attendances_faults_avg[$username];
- Exclude checks
Variable "results_faults_avg" is not in valid camel caps format Open
if (!empty($results_faults_avg)) {
- Exclude checks
Variable "student_id" is not in valid camel caps format Open
$results_faults_avg = $attendance->get_faults_average_inside_courses($student_id);
- Exclude checks
Variable "results_faults_avg" is not in valid camel caps format Open
$attendances_faults_avg[$student['lastname']] = $results_faults_avg['percent'];
- Exclude checks
Variable "is_block_visible_for_user" is not in valid camel caps format Open
$is_block_visible_for_user = true;
- Exclude checks
Variable "attendances_faults_avg" is not in valid camel caps format Open
$attendances_faults_avg = [];
- Exclude checks
Variable "attendances_faults_avg" is not in valid camel caps format Open
$attendances_faults_avg[$student['lastname']] = 0;
- Exclude checks
Variable "img_file" is not in valid camel caps format Open
$img_file = '';
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$user_info = api_get_user_info($user_id);
- Exclude checks
Variable "attendances_faults_avg" is not in valid camel caps format Open
arsort($attendances_faults_avg);
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$this->user_id = $user_id;
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
public function __construct($user_id)
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
- Exclude checks
Variable "attendances_faults_avg" is not in valid camel caps format Open
$usernames = array_keys($attendances_faults_avg);
- Exclude checks
Variable "user_status" is not in valid camel caps format Open
$user_status = $user_info['status'];
- Exclude checks
Variable "is_block_visible_for_user" is not in valid camel caps format Open
return $is_block_visible_for_user;
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$this->user_id = $user_id;
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT);
- Exclude checks
Method name "BlockStudentGraph::get_block" is not in camel caps format Open
public function get_block()
- Exclude checks
Variable "student_id" is not in valid camel caps format Open
$student_id = $student['user_id'];
- Exclude checks
Variable "results_faults_avg" is not in valid camel caps format Open
$results_faults_avg = $attendance->get_faults_average_inside_courses($student_id);
- Exclude checks
Variable "user_info" is not in valid camel caps format Open
$user_status = $user_info['status'];
- Exclude checks
Method name "BlockStudentGraph::get_number_of_students" is not in camel caps format Open
public function get_number_of_students()
- Exclude checks
The variable $user_id is not named in camelCase. Open
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_student_graph';
if ($this->is_block_visible_for_user($user_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 $user_info is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = 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
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = 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 $student_id is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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 $attendances_faults_avg is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_student_graph';
if ($this->is_block_visible_for_user($user_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 $user_id is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = 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 $results_faults_avg is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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_block_visible_for_user is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = 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 $is_block_visible_for_user is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = 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 $attendances_faults_avg is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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 $results_faults_avg is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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_block_visible_for_user is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = 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_status is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = 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_status is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = 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_info is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = 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 $student_id is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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 $attendances_faults_avg is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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 $attendances_faults_avg is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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 $attendances_faults_avg is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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 $img_file is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_student_graph';
if ($this->is_block_visible_for_user($user_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 $attendances_faults_avg is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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 $results_faults_avg is not named in camelCase. Open
public function getContent()
{
$students = $this->students;
$attendance = new Attendance();
- 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 method is_block_visible_for_user is not named in camelCase. Open
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = false;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method get_number_of_students is not named in camelCase. Open
public function get_number_of_students()
{
return count($this->students);
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method get_block is not named in camelCase. Open
public function get_block()
{
$column = 1;
$data = [];
$html = $this->getBlockCard(
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}