The method get_table_data() has an NPath complexity of 792. The configured NPath complexity threshold is 200. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 '44', column '30'). Open
$this->datagen = new ResultsDataGenerator($evaluation, $results, true);
- 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 '195', column '26'). Open
$htmlTable = new HTML_Table(['class' => 'table table-hover table-striped data_table']);
- 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_table_data uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sorting |= ResultsDataGenerator::RDG_SORT_ASC;
}
- 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 build_edit_column uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$editColumn .= '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit')).'</a>';
}
- 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 build_edit_column uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$editColumn .= '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit')).'</a>';
}
- 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_table_data uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sorting = ResultsDataGenerator::RDG_SORT_FIRSTNAME;
}
- 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_table_data uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sorting = ResultsDataGenerator::RDG_SORT_LASTNAME;
}
- 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_table_data uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$row[] = $item['lastname'];
$row[] = $item['firstname'];
}
- 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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->set_header($column++, get_lang('Last name'));
$this->set_header($column++, get_lang('First name'));
}
- 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 '$column'. Open
$column = null,
- 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 '$perPage'. Open
$perPage = null,
- 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 '$sort'. Open
$sort = null
- 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 '$direction'. Open
$direction = null,
- 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 private fields such as '$allresults'. Open
private $allresults;
- Read upRead up
- Exclude checks
UnusedPrivateField
Since: 0.2
Detects when a private field is declared and/or assigned a value, but not used.
Example
class Something
{
private static $FOO = 2; // Unused
private $i = 5; // Unused
private $j = 6;
public function addOne()
{
return $this->j++;
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield
Method name "ResultTable::get_total_number_of_items" is not in camel caps format Open
public function get_total_number_of_items()
- Exclude checks
Method name "ResultTable::get_table_data" is not in camel caps format Open
public function get_table_data(
- Exclude checks
Expected 5 spaces after parameter type; 7 found Open
* @param ?array $addparams
- Exclude checks
Variable "col_adjust" is not in valid camel caps format Open
case 3 + $col_adjust:
- Exclude checks
Variable "data_array" is not in valid camel caps format Open
$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
- Exclude checks
Expected 1 spaces after parameter type; 3 found Open
* @param Evaluation $evaluation
- Exclude checks
Variable "col_adjust" is not in valid camel caps format Open
case 1 + $col_adjust:
- Exclude checks
Expected 6 spaces after parameter type; 8 found Open
* @param ?bool $forprint
- Exclude checks
Variable "col_adjust" is not in valid camel caps format Open
case 0 + $col_adjust:
- Exclude checks
Expected 5 spaces after parameter type; 7 found Open
* @param ?array $results
- Exclude checks
Expected 4 spaces after parameter type; 6 found Open
* @param ?string $iscourse
- Exclude checks
Variable "col_adjust" is not in valid camel caps format Open
$col_adjust = '1' == $this->iscourse ? 1 : 0;
- Exclude checks
Variable "col_adjust" is not in valid camel caps format Open
case 2 + $col_adjust:
- Exclude checks
Variable "per_page" is not in valid camel caps format Open
$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
- Exclude checks
Variable "sortable_data" is not in valid camel caps format Open
$sortable_data[] = $row;
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
$editColumn .= ' <a href="'.$doc_url.'" target="_blank">';
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
$doc_url = $link->get_view_url($item['id']);
- Exclude checks
Variable "locked_status" is not in valid camel caps format Open
if (api_is_allowed_to_edit(null, true) && 0 == $locked_status) {
- Exclude checks
Variable "sortable_data" is not in valid camel caps format Open
$sortable_data = [];
- Exclude checks
Variable "locked_status" is not in valid camel caps format Open
$locked_status = $this->evaluation->get_locked();
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
if (null != $doc_url) {
- Exclude checks
Variable "data_array" is not in valid camel caps format Open
foreach ($data_array as $item) {
- Exclude checks
Method name "ResultTable::build_edit_column" is not in camel caps format Open
private function build_edit_column($item)
- Exclude checks
Variable "sortable_data" is not in valid camel caps format Open
return $sortable_data;
- Exclude checks
The variable $locked_status is not named in camelCase. Open
private function build_edit_column($item)
{
$locked_status = $this->evaluation->get_locked();
$allowMultipleAttempts = ('true' === api_get_setting('gradebook.gradebook_multiple_evaluation_attempts'));
$baseUrl = api_get_self().'?selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq();
- 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 $col_adjust is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 $col_adjust is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 $doc_url is not named in camelCase. Open
private function build_edit_column($item)
{
$locked_status = $this->evaluation->get_locked();
$allowMultipleAttempts = ('true' === api_get_setting('gradebook.gradebook_multiple_evaluation_attempts'));
$baseUrl = api_get_self().'?selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq();
- 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 $col_adjust is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 $data_array is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 $data_array is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 $col_adjust is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 $doc_url is not named in camelCase. Open
private function build_edit_column($item)
{
$locked_status = $this->evaluation->get_locked();
$allowMultipleAttempts = ('true' === api_get_setting('gradebook.gradebook_multiple_evaluation_attempts'));
$baseUrl = api_get_self().'?selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq();
- 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 $locked_status is not named in camelCase. Open
private function build_edit_column($item)
{
$locked_status = $this->evaluation->get_locked();
$allowMultipleAttempts = ('true' === api_get_setting('gradebook.gradebook_multiple_evaluation_attempts'));
$baseUrl = api_get_self().'?selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq();
- 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 $sortable_data is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 $sortable_data is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 $col_adjust is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 $doc_url is not named in camelCase. Open
private function build_edit_column($item)
{
$locked_status = $this->evaluation->get_locked();
$allowMultipleAttempts = ('true' === api_get_setting('gradebook.gradebook_multiple_evaluation_attempts'));
$baseUrl = api_get_self().'?selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq();
- 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 $sortable_data is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 get_table_data is not named in camelCase. Open
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
- 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 build_edit_column is not named in camelCase. Open
private function build_edit_column($item)
{
$locked_status = $this->evaluation->get_locked();
$allowMultipleAttempts = ('true' === api_get_setting('gradebook.gradebook_multiple_evaluation_attempts'));
$baseUrl = api_get_self().'?selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq();
- 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_total_number_of_items is not named in camelCase. Open
public function get_total_number_of_items()
{
return $this->datagen->get_total_results_count();
}
- 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() {
}
}