EscolaLMS/topic-types

View on GitHub
src/Models/TopicContent/H5P.php

Summary

Maintainability
A
0 mins
Test Coverage
B
86%

Avoid using static access to class '\Illuminate\Support\Facades\App' in method 'fixAssetPaths'.
Open

        $contentRepository = App::make(H5PContentRepositoryContract::class);
Severity: Minor
Found in src/Models/TopicContent/H5P.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 using static access to class '\Illuminate\Support\Facades\Config' in method 'getLengthAttribute'.
Open

            $keys = Config::get('topic-h5p');
Severity: Minor
Found in src/Models/TopicContent/H5P.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 using static access to class '\Illuminate\Support\Facades\App' in method 'getLibraryNameAttribute'.
Open

            $contentRepository = App::make(H5PContentRepositoryContract::class);
Severity: Minor
Found in src/Models/TopicContent/H5P.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 using static access to class '\Illuminate\Support\Facades\Storage' in method 'fixAssetPaths'.
Open

        return [[$filepath, Storage::path($destination)]];
Severity: Minor
Found in src/Models/TopicContent/H5P.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 using static access to class '\Illuminate\Support\Arr' in method 'getLengthAttribute'.
Open

            return isset($lengthKey['length_key']) ? count(Arr::get($parameters, $lengthKey['length_key'])) : $lengthKey['default_length'];
Severity: Minor
Found in src/Models/TopicContent/H5P.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 using static access to class '\Illuminate\Support\Facades\Storage' in method 'fixAssetPaths'.
Open

            Storage::delete($destination);
Severity: Minor
Found in src/Models/TopicContent/H5P.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 using static access to class '\Illuminate\Support\Facades\Storage' in method 'fixAssetPaths'.
Open

        if (Storage::exists($destination)) {
Severity: Minor
Found in src/Models/TopicContent/H5P.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 using static access to class '\Illuminate\Support\Facades\Storage' in method 'fixAssetPaths'.
Open

        $filepath = file_exists($filepath) ? $filepath : Storage::path($filepath);
Severity: Minor
Found in src/Models/TopicContent/H5P.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 using static access to class '\Illuminate\Support\Facades\App' in method 'getLengthAttribute'.
Open

            $contentRepository = App::make(H5PContentRepositoryContract::class);
Severity: Minor
Found in src/Models/TopicContent/H5P.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 using static access to class '\EscolaLms\TopicTypes\Database\Factories\TopicContent\H5PFactory' in method 'newFactory'.
Open

        return H5PFactory::new();
Severity: Minor
Found in src/Models/TopicContent/H5P.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

Line exceeds 120 characters; contains 139 characters
Open

            return isset($lengthKey['length_key']) ? count(Arr::get($parameters, $lengthKey['length_key'])) : $lengthKey['default_length'];

There are no issues that match your filters.

Category
Status