EscolaLMS/Webinar

View on GitHub
database/seeders/WebinarsPermissionSeeder.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\Spatie\Permission\Models\Role' in method 'run'.
Open

        $admin = Role::findOrCreate(UserRole::ADMIN, 'api');

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 using static access to class '\Spatie\Permission\Models\Role' in method 'run'.
Open

        $tutor = Role::findOrCreate(UserRole::TUTOR, 'api');

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 using static access to class '\Spatie\Permission\Models\Permission' in method 'run'.
Open

            Permission::findOrCreate($permission, 'api');

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 using static access to class '\EscolaLms\Webinar\Enum\WebinarPermissionsEnum' in method 'run'.
Open

        foreach (WebinarPermissionsEnum::getValues() as $permission) {

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

Class extends undeclared class \Illuminate\Database\Seeder
Open

class WebinarsPermissionSeeder extends Seeder

Call to method findOrCreate from undeclared class \Spatie\Permission\Models\Role
Open

        $admin = Role::findOrCreate(UserRole::ADMIN, 'api');

Call to method findOrCreate from undeclared class \Spatie\Permission\Models\Role
Open

        $tutor = Role::findOrCreate(UserRole::TUTOR, 'api');

Call to method findOrCreate from undeclared class \Spatie\Permission\Models\Permission
Open

            Permission::findOrCreate($permission, 'api');

Reference to constant TUTOR from undeclared class \EscolaLms\Core\Enums\UserRole
Open

        $tutor = Role::findOrCreate(UserRole::TUTOR, 'api');

Reference to constant ADMIN from undeclared class \EscolaLms\Core\Enums\UserRole
Open

        $admin = Role::findOrCreate(UserRole::ADMIN, 'api');

Static call to undeclared method \EscolaLms\Webinar\Enum\WebinarPermissionsEnum::getValues
Open

        foreach (WebinarPermissionsEnum::getValues() as $permission) {

There are no issues that match your filters.

Category
Status