EscolaLMS/topic-types

View on GitHub
src/EscolaLmsTopicTypesServiceProvider.php

Summary

Maintainability
A
2 hrs
Test Coverage
A
91%

Method boot has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function boot()
    {
        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
        $this->mergeConfigFrom(__DIR__ . '/../config/topic-h5p.php', 'topic-h5p');
        if ($this->app->runningInConsole()) {
Severity: Major
Found in src/EscolaLmsTopicTypesServiceProvider.php - About 2 hrs to fix

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

    class EscolaLmsTopicTypesServiceProvider extends ServiceProvider
    {
        public $singletons = [
            TopicTypeServiceContract::class => TopicTypeService::class,
        ];

    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

    Avoid using static access to class '\EscolaLms\Courses\Facades\Topic' in method 'boot'.
    Open

            Topic::registerResourceClasses(Image::class, [
                'client' => ClientImageResource::class,
                'admin' => AdminImageResource::class,
                'export' => ExportImageResource::class,
            ]);

    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\Courses\Facades\Topic' in method 'boot'.
    Open

                Topic::registerResourceClasses(Cmi5Au::class, [
                    'client' => ClientCmi5AuResource::class,
                    'admin' => AdminCmi5AuResource::class,
                    'export' => ExportCmi5AuResource::class,
                ]);

    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\Courses\Facades\Topic' in method 'boot'.
    Open

            Topic::registerResourceClasses(OEmbed::class, [
                'client' => ClientOEmbedResource::class,
                'admin' => AdminOEmbedResource::class,
                'export' => ExportOEmbedResource::class,
            ]);

    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\Courses\Facades\Topic' in method 'boot'.
    Open

                Topic::registerContentClasses([
                    Cmi5Au::class
                ]);

    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\Courses\Facades\Topic' in method 'boot'.
    Open

            Topic::registerResourceClasses(Audio::class, [
                'client' => ClientAudioResource::class,
                'admin' => AdminAudioResource::class,
                'export' => ExportAudioResource::class,
            ]);

    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\Courses\Facades\Topic' in method 'boot'.
    Open

            Topic::registerResourceClasses(RichText::class, [
                'client' => ClientRichTextResource::class,
                'admin' => AdminRichTextResource::class,
                'export' => ExportRichTextResource::class,
            ]);

    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\HeadlessH5P\Repositories\H5PContentRepository' in method 'register'.
    Open

            H5PContentRepository::extendQueryGroupBy(
                fn () => [
                    'hh5p_contents.id',
                    'hh5p_contents.uuid',
                    'hh5p_contents.library_id',

    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\Courses\Facades\Topic' in method 'boot'.
    Open

            Topic::registerResourceClasses(Video::class, [
                'client' => ClientVideoResource::class,
                'admin' => AdminVideoResource::class,
                'export' => ExportVideoResource::class,
            ]);

    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\HeadlessH5P\Repositories\H5PContentRepository' in method 'register'.
    Open

            H5PContentRepository::extendQuerySelect(
                fn () => DB::raw("COUNT(topic_h5ps.value) as count_h5p"),
                'topic_h5ps'
            );

    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\Courses\Facades\Topic' in method 'boot'.
    Open

            Topic::registerResourceClasses(PDF::class, [
                'client' => ClientPDFResource::class,
                'admin' => AdminPDFResource::class,
                'export' => ExportPDFResource::class,
            ]);

    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\HeadlessH5P\Http\Resources\ContentIndexResource' in method 'register'.
    Open

            ContentIndexResource::extend(fn ($thisObj) => [
                'count_h5p' => $thisObj->count_h5p,
            ]);

    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\DB' in method 'register'.
    Open

                    DB::Connection() instanceof PostgresConnection ? 'hh5p_contents.parameters::jsonb' : 'hh5p_contents.parameters',

    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\Courses\Facades\Topic' in method 'boot'.
    Open

            Topic::registerResourceClasses(H5P::class, [
                'client' => ClientH5PResource::class,
                'admin' => AdminH5PResource::class,
                'export' => ExportH5PResource::class,
            ]);

    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\Courses\Facades\Topic' in method 'boot'.
    Open

            Topic::registerResourceClasses(ScormSco::class, [
                'client' => ClientScormScoResource::class,
                'admin' => AdminScormScoResource::class,
                'export' => ExportScormScoResource::class,
            ]);

    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\DB' in method 'register'.
    Open

                fn () => DB::raw("COUNT(topic_h5ps.value) as count_h5p"),

    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\Courses\Facades\Topic' in method 'boot'.
    Open

            Topic::registerContentClasses([
                Audio::class,
                Video::class,
                Image::class,
                RichText::class,

    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\HeadlessH5P\Repositories\H5PContentRepository' in method 'register'.
    Open

            H5PContentRepository::extendQueryJoin(
                fn () => [['topic_h5ps.value', 'hh5p_contents.id']],
                'topic_h5ps'
            );

    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

    Only one argument is allowed per line in a multi-line function call
    Open

                fn () => [['topic_h5ps.value', 'hh5p_contents.id']],

    Line exceeds 120 characters; contains 128 characters
    Open

                    DB::Connection() instanceof PostgresConnection ? 'hh5p_contents.parameters::jsonb' : 'hh5p_contents.parameters',

    Space before opening parenthesis of function call prohibited
    Open

                fn () => DB::raw("COUNT(topic_h5ps.value) as count_h5p"),

    Space before opening parenthesis of function call prohibited
    Open

                fn () => [

    Space before opening parenthesis of function call prohibited
    Open

                fn () => [['topic_h5ps.value', 'hh5p_contents.id']],

    Multi-line function call not indented correctly; expected 12 spaces but found 16
    Open

                    'hh5p_contents.uuid',

    Multi-line function call not indented correctly; expected 12 spaces but found 16
    Open

                    DB::Connection() instanceof PostgresConnection ? 'hh5p_contents.parameters::jsonb' : 'hh5p_contents.parameters',

    Multi-line function call not indented correctly; expected 12 spaces but found 16
    Open

                    'hh5p_contents.library_id',

    Multi-line function call not indented correctly; expected 12 spaces but found 16
    Open

                    'hh5p_contents.user_id',

    Multi-line function call not indented correctly; expected 12 spaces but found 16
    Open

                    'hh5p_contents.author',

    Multi-line function call not indented correctly; expected 12 spaces but found 16
    Open

                    'hh5p_contents.created_at',

    Multi-line function call not indented correctly; expected 12 spaces but found 16
    Open

                    'hh5p_contents.id',

    Space before opening parenthesis of function call prohibited
    Open

            ContentIndexResource::extend(fn ($thisObj) => [

    There are no issues that match your filters.

    Category
    Status