Firesphere/silverstripe-solr-compatibility

View on GitHub
src/Extensions/FulltextSearchExtension.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Method search has 5 arguments (exceeds 4 allowed). Consider refactoring.
Wontfix

    public function search($query, $start = 0, $limit = 10, $params = [], $spellcheck = null)
Severity: Minor
Found in src/Extensions/FulltextSearchExtension.php - About 35 mins to fix

    The method addFulltextFields has a boolean flag argument $includeSubclasses, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function addFulltextFields($includeSubclasses = true)

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Avoid using static access to class '\SilverStripe\Dev\Debug' in method 'initToYml'.
    Open

                Debug::dump(yaml_emit($result));

    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 '\SilverStripe\View\ArrayData' in method 'updateSearchResults'.
    Open

            $results = ArrayData::create($data);

    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 parameters such as '$includeSubclasses'.
    Open

        public function addFulltextFields($includeSubclasses = true)

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    There are no issues that match your filters.

    Category
    Status