NatLibFi/Skosmos

View on GitHub

Showing 1,049 of 1,049 total issues

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

                        $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi;
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 'getCollections'.
Open

            $arrayClass = $arrayClassURI !== null ? EasyRdf\RdfNamespace::shorten($arrayClassURI) : 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 'dumpJsonLd'.
Open

            'skos' => EasyRdf\RdfNamespace::get("skos"),
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 'getReifiedPropertyValues'.
Open

            $prop = (EasyRdf\RdfNamespace::shorten($prop) !== null) ? EasyRdf\RdfNamespace::shorten($prop) : $prop;
Severity: Minor
Found in src/model/ConceptPropertyValue.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 getAlphabet uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $specials = true;
            }
Severity: Minor
Found in src/model/Vocabulary.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

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

    private function generateConceptInfoQuery($uris, $arrayClass, $vocabs)
    {
        $gcl = $this->graphClause;
        $fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
        $values = $this->formatValues('?uri', $uris, 'uri');
Severity: Minor
Found in src/model/sparql/GenericSparql.php by phpmd

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

            } else {
                $values[$row->conc->getURI()]['type'][] = $row->type->shorten();
            }
Severity: Minor
Found in src/model/sparql/GenericSparql.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

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

        } else {
            $retform = 'rdfxml';
            $serialiser = new EasyRdf\Serialiser\RdfXml();
        }
Severity: Minor
Found in src/model/Model.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 'getVocabularies'.
Open

                    if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) { // if not already defined
Severity: Minor
Found in src/model/Model.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 unused local variables such as '$filelist'.
Open

        foreach ($files as $plugin => $filelist) {
Severity: Minor
Found in src/model/PluginRegister.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

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

    public function getShowNotationAsProperty()
    {
        return $this->getBoolean('skosmos:showNotationAsProperty', true);
    }
Severity: Minor
Found in src/model/VocabularyConfig.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 'getHierarchyProperty'.
Open

                $prop = EasyRdf\RdfNamespace::shorten($prop);
Severity: Minor
Found in src/model/VocabularyConfig.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 resolve uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $res = new LinkedDataResource($this->model, $uri);
        }
Severity: Minor
Found in src/model/resolver/Resolver.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 'getVocabularies'.
Open

                        EasyRdf\RdfNamespace::set($prefix, $voc->getUriSpace());
Severity: Minor
Found in src/model/Model.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 filterPlugins uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        foreach ($files[$type] as $file) {
                            array_push($ret[$name], 'plugins/' . $name . '/' . $file);
                        }
                    }
Severity: Minor
Found in src/model/PluginRegister.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\Format' in method 'resolve'.
Open

        $jsonld = EasyRdf\Format::getFormat('jsonld');

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 querySuperProperties uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            // no result, return null
            return null;
        }
Severity: Minor
Found in src/model/sparql/GenericSparql.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 'getTypes'.
Open

                $shorteneduri = EasyRdf\RdfNamespace::shorten($uri);
Severity: Minor
Found in src/model/Model.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 __construct() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
Open

    public function __construct($model)
    {
        $this->model = $model;

        // Store GET parameters in a local array, so we can mock them in tests.
Severity: Minor
Found in src/model/Request.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 'Punic\Calendar' in method 'getInfo'.
Open

                        $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang);
Severity: Minor
Found in src/model/Vocabulary.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