Firesphere/silverstripe-haveibeenpwnd

View on GitHub
src/models/HaveIBeenPwnedPage.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused private fields such as '$table_name'.
Open

    private static $table_name = 'HaveIBeenPwnedPage';
Severity: Minor
Found in src/models/HaveIBeenPwnedPage.php by phpmd

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

Remove this unused "$table_name" private field.
Invalid

    private static $table_name = 'HaveIBeenPwnedPage';
Severity: Major
Found in src/models/HaveIBeenPwnedPage.php by sonar-php

If a private field is declared but not used in the program, it can be considered dead code and should therefore be removed. This will improve maintainability because developers will not wonder what the variable is used for.

Noncompliant Code Example

class MyClass {
  private $foo = 4;                       //foo is unused

  public function compute($a) {
    return $a * 4;
  }
}

Compliant Solution

class MyClass {

  public function compute($a) {
    return $a * 4;
  }
}

See

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 18 and the first side effect is on line 11.
Open

<?php

The property $table_name is not named in camelCase.
Open

class HaveIBeenPwnedPage extends Page
{
    private static $table_name = 'HaveIBeenPwnedPage';

    /**
Severity: Minor
Found in src/models/HaveIBeenPwnedPage.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

There are no issues that match your filters.

Category
Status