src/Models/User.php

Summary

Maintainability
A
0 mins
Test Coverage

The class User has 13 public methods. Consider refactoring User to keep number of public methods under 10.
Open

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword, Notifiable;

    /**
Severity: Minor
Found in src/Models/User.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class User has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13.
Open

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword, Notifiable;

    /**
Severity: Minor
Found in src/Models/User.php by phpmd

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

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

The method login_history is not named in camelCase.
Open

    public function login_history()
    {

        return $this->hasMany(UserLoginHistory::class);
    }
Severity: Minor
Found in src/Models/User.php by phpmd

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 refresh_tokens is not named in camelCase.
Open

    public function refresh_tokens()
    {
        return $this->hasMany(RefreshToken::class);
    }
Severity: Minor
Found in src/Models/User.php by phpmd

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 all_characters is not named in camelCase.
Open

    public function all_characters()
    {

        return CharacterInfo::whereIn('character_id', RefreshToken::withTrashed()->where('user_id', $this->id)->pluck('character_id'))->get();
    }
Severity: Minor
Found in src/Models/User.php by phpmd

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 main_character is not named in camelCase.
Open

    public function main_character()
    {
        return $this->hasOne(CharacterInfo::class, 'character_id', 'main_character_id')
            ->withDefault();
    }
Severity: Minor
Found in src/Models/User.php by phpmd

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

There are no issues that match your filters.

Category
Status