AppStateESS/InternshipInventory

View on GitHub

Showing 6,675 of 6,675 total issues

The method projected_class uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        return 'SR';
    }
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

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 middle_name uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return $middle_name;
        }
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

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 middle_name uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        $middle_name = first_name();
        if ($middle_name == $first_name) {
            return middle_name($first_name);
        } else {
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

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 createSupervisor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    }else{
        return $id;
    }
Severity: Minor
Found in contrib/importInternships.php by phpmd

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 '$user_name'.
Open

    '$user_name',
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

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 method username uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        return $username;
    }
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

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 function connectToDB() contains an exit expression.
Open

        die('Could not connect to database.\n');
Severity: Minor
Found in contrib/dbConnect.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

Avoid unused local variables such as '$internship'.
Open

    $newContact = new EmergencyContact($internship, $name, $relation, $phone, $email);
Severity: Minor
Found in contrib/importInternships.php by phpmd

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

Avoid using static access to class '\Intern\DatabaseStorage' in method 'createEmergency'.
Open

    DatabaseStorage::save($newContact);
Severity: Minor
Found in contrib/importInternships.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid unused local variables such as '$student_id'.
Open

    '$student_id',
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

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 function last_name() has 158 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

function last_name()
{
    static $last_names = array(
        'Acula',
        'Achenbach',
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

Avoid unused local variables such as '$phone'.
Open

    $newContact = new EmergencyContact($internship, $name, $relation, $phone, $email);
Severity: Minor
Found in contrib/importInternships.php by phpmd

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 method createInternship uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

  }else{
      return false;
  }
Severity: Minor
Found in contrib/importInternships.php by phpmd

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 pref_name uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        return null;
    }
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

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 '$address'.
Open

    $address = address();
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

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 function first_name() has 172 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

function first_name()
{
    static $first_names = array(
        'Abigail',
        'Abigail',
Severity: Minor
Found in contrib/createFakeStudents.php by phpmd

Avoid unused local variables such as '$email'.
Open

    $newContact = new EmergencyContact($internship, $name, $relation, $phone, $email);
Severity: Minor
Found in contrib/importInternships.php by phpmd

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 method createHost uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

      }else{
          return $id;
      }
Severity: Minor
Found in contrib/importHost.php by phpmd

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 '$relation'.
Open

    $newContact = new EmergencyContact($internship, $name, $relation, $phone, $email);
Severity: Minor
Found in contrib/importInternships.php by phpmd

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

Avoid unused local variables such as '$name'.
Open

    $newContact = new EmergencyContact($internship, $name, $relation, $phone, $email);
Severity: Minor
Found in contrib/importInternships.php by phpmd

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

Severity
Category
Status
Source
Language