Missing class import via use statement (line '23', column '30'). Open
$this->datagen = new UserDataGenerator($userid, $evals, $links);
- 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 |= UserDataGenerator::UDG_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
Avoid unused parameters such as '$perPage'. Open
public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $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
public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $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 '$sort'. Open
public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $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 '$column'. Open
public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $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
Variable "sortable_data" is not in valid camel caps format Open
$sortable_data = [];
- Exclude checks
Method name "UserTable::build_name_link" is not in camel caps format Open
private function build_name_link($item)
- Exclude checks
Method name "UserTable::get_table_data" is not in camel caps format Open
public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)
- Exclude checks
Variable "sortable_data" is not in valid camel caps format Open
return $sortable_data;
- 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
Variable "sortable_data" is not in valid camel caps format Open
$sortable_data[] = $row;
- Exclude checks
Method name "UserTable::get_total_number_of_items" is not in camel caps format Open
public function get_total_number_of_items()
- Exclude checks
Variable "data_array" is not in valid camel caps format Open
foreach ($data_array as $data) {
- 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
Method name "UserTable::build_type_column" is not in camel caps format Open
private function build_type_column($item)
- Exclude checks
The variable $sortable_data is not named in camelCase. Open
public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)
{
$scoredisplay = ScoreDisplay::instance();
// determine sorting type
- 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, $sort = null)
{
$scoredisplay = ScoreDisplay::instance();
// determine sorting type
- 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, $sort = null)
{
$scoredisplay = ScoreDisplay::instance();
// determine sorting type
- 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, $sort = null)
{
$scoredisplay = ScoreDisplay::instance();
// determine sorting type
- 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, $sort = null)
{
$scoredisplay = ScoreDisplay::instance();
// determine sorting type
- 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, $sort = null)
{
$scoredisplay = ScoreDisplay::instance();
// determine sorting type
- 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_items_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() {
}
}
Source
The method build_name_link is not named in camelCase. Open
private function build_name_link($item)
{
switch ($item->get_item_type()) {
// evaluation
case 'E':
- 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_type_column is not named in camelCase. Open
private function build_type_column($item)
{
return GradebookUtils::build_type_icon_tag($item->get_icon_name());
}
- 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() {
}
}