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 '$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 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
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 {
$content = $this->table_data;
}
- 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_total_number_of_items uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (!empty($this->table_data)) {
return count($this->table_data);
}
- 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 parameter $get_total_number_function is not named in camelCase. Open
public function __construct(
$table_data,
$default_column = 1,
$default_items_per_page = 20,
$tableName = 'tablename',
- 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 $table_data is not named in camelCase. Open
public function __construct(
$table_data,
$default_column = 1,
$default_items_per_page = 20,
$tableName = 'tablename',
- 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 $table_data is not named in camelCase. Open
class SortableTableFromArray extends SortableTable
{
/**
* The array containing all data for this table.
*/
- 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
The parameter $default_items_per_page is not named in camelCase. Open
public function __construct(
$table_data,
$default_column = 1,
$default_items_per_page = 20,
$tableName = 'tablename',
- 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 $default_column is not named in camelCase. Open
public function __construct(
$table_data,
$default_column = 1,
$default_items_per_page = 20,
$tableName = 'tablename',
- 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 "table_data" is not in valid camel caps format Open
return count($this->table_data);
- Exclude checks
Variable "default_items_per_page" is not in valid camel caps format Open
$default_items_per_page,
- Exclude checks
Method name "SortableTableFromArray::get_table_data" is not in camel caps format Open
public function get_table_data(
- Exclude checks
Variable "get_total_number_function" is not in valid camel caps format Open
$get_total_number_function,
- Exclude checks
Variable "table_data" is not in valid camel caps format Open
$this->table_data = $table_data;
- Exclude checks
Method name "SortableTableFromArray::get_total_number_of_items" is not in camel caps format Open
public function get_total_number_of_items()
- Exclude checks
Variable "per_page" is not in valid camel caps format Open
return array_slice($content, $from, $this->per_page);
- Exclude checks
Variable "table_data" is not in valid camel caps format Open
if (!empty($this->table_data)) {
- Exclude checks
Variable "get_total_number_function" is not in valid camel caps format Open
$get_total_number_function = null,
- Exclude checks
Variable "table_data" is not in valid camel caps format Open
$this->table_data,
- Exclude checks
Variable "default_items_per_page" is not in valid camel caps format Open
$default_items_per_page = 20,
- Exclude checks
Variable "table_data" is not in valid camel caps format Open
$this->table_data = $table_data;
- Exclude checks
Variable "total_number_of_items" is not in valid camel caps format Open
if (isset($this->total_number_of_items) && !empty($this->total_number_of_items)) {
- Exclude checks
Variable "default_column" is not in valid camel caps format Open
$default_column = 1,
- Exclude checks
Variable "table_data" is not in valid camel caps format Open
$content = $this->table_data;
- Exclude checks
Variable "total_number_of_items" is not in valid camel caps format Open
return $this->total_number_of_items;
- Exclude checks
Member variable "table_data" is not in valid camel caps format Open
public $table_data;
- Exclude checks
Variable "table_data" is not in valid camel caps format Open
$table_data,
- Exclude checks
Variable "default_column" is not in valid camel caps format Open
$default_column,
- Exclude checks
Variable "total_number_of_items" is not in valid camel caps format Open
if (isset($this->total_number_of_items) && !empty($this->total_number_of_items)) {
- Exclude checks
The variable $get_total_number_function is not named in camelCase. Open
public function __construct(
$table_data,
$default_column = 1,
$default_items_per_page = 20,
$tableName = 'tablename',
- 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 $default_items_per_page is not named in camelCase. Open
public function __construct(
$table_data,
$default_column = 1,
$default_items_per_page = 20,
$tableName = 'tablename',
- 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 $default_column is not named in camelCase. Open
public function __construct(
$table_data,
$default_column = 1,
$default_items_per_page = 20,
$tableName = 'tablename',
- 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 $table_data is not named in camelCase. Open
public function __construct(
$table_data,
$default_column = 1,
$default_items_per_page = 20,
$tableName = 'tablename',
- 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 get_total_number_of_items is not named in camelCase. Open
public function get_total_number_of_items()
{
if (isset($this->total_number_of_items) && !empty($this->total_number_of_items)) {
return $this->total_number_of_items;
} else {
- 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() {
}
}