NatLibFi/Skosmos

View on GitHub

Showing 1,049 of 1,049 total issues

Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'initializeNamespaces'.
Open

            if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) { // if not already defined
Severity: Minor
Found in src/model/GlobalConfig.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

The 'getCollationEnabled()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getCollationEnabled()
    {
        return $this->getBoolean('skosmos:sparqlCollationEnabled', false);
    }
Severity: Minor
Found in src/model/GlobalConfig.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'getMappingProperties'.
Open

                $prop = $sprop = EasyRdf\RdfNamespace::shorten($prop);
Severity: Minor
Found in src/model/Concept.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

The method getDate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $ret .= ' ' . ucfirst($this->model->getText('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getLang()));
                }
Severity: Minor
Found in src/model/Concept.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'getMappingProperties'.
Open

            if (EasyRdf\RdfNamespace::shorten($prop) !== null) {
Severity: Minor
Found in src/model/Concept.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 'EasyRdf\RdfNamespace' in method 'getProperties'.
Open

            if (EasyRdf\RdfNamespace::shorten($prop) !== null) {
Severity: Minor
Found in src/model/Concept.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 'Punic\Calendar' in method 'getDate'.
Open

                    $ret .= ', ' . $this->model->getText('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getLang()));
Severity: Minor
Found in src/model/Concept.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

The method getCollections() has an NPath complexity of 201. The configured NPath complexity threshold is 200.
Open

    private function getCollections($includeArrays)
    {
        $groups = array();
        $collections = $this->graph->resourcesMatching('skos:member', $this->resource);
        if (isset($collections)) {
Severity: Minor
Found in src/model/Concept.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'dumpJsonLd'.
Open

            'owl' => EasyRdf\RdfNamespace::get("owl"),
Severity: Minor
Found in src/model/Concept.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

The 'getUiLanguageDropdown()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getUiLanguageDropdown()
    {
        return $this->getBoolean('skosmos:uiLanguageDropdown', false);
    }
Severity: Minor
Found in src/model/GlobalConfig.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'isGroup'.
Open

            $groupClass = EasyRdf\RdfNamespace::shorten($groupClass) !== null ? EasyRdf\RdfNamespace::shorten($groupClass) : $groupClass;
Severity: Minor
Found in src/model/Concept.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 'Punic\Calendar' in method 'getDate'.
Open

                    $ret .= ' ' . ucfirst($this->model->getText('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getLang()));
Severity: Minor
Found in src/model/Concept.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

The method getCollectionMembers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $collLabel = $coll->getUri();
        }
Severity: Minor
Found in src/model/Concept.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Avoid using static access to class 'Punic\Calendar' in method 'getLabel'.
Open

                return Punic\Calendar::formatDate($val, 'short');

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

The method getProperties() has 185 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function getProperties()
    {
        $properties = array();
        $narrowersByUri = array();
        $inCollection = array();
Severity: Minor
Found in src/model/Concept.php by phpmd

Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'getProperties'.
Open

                $prop = $sprop = EasyRdf\RdfNamespace::shorten($prop);
Severity: Minor
Found in src/model/Concept.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

The method getProperties uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                // EasyRdf requires full URIs to be in angle brackets
                $sprop = "<$prop>";
            }
Severity: Minor
Found in src/model/Concept.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'getProperties'.
Open

                    $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop;
Severity: Minor
Found in src/model/Concept.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

The method addExternalTriplesToGraph uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            foreach ($props as $prop) {
                if ($res->hasProperty($prop)) {
                    $this->addPropertyValues($res, $prop, $seen);
                }
Severity: Minor
Found in src/model/Concept.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Avoid using static access to class 'Normalizer' in method 'getSearchTerm'.
Open

        $term = Normalizer::normalize($term, Normalizer::FORM_C); //Normalize decomposed unicode characters #1184
Severity: Minor
Found in src/model/ConceptSearchParameters.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

Severity
Category
Status
Source
Language