Showing 158 of 158 total issues

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

        } else {
            foreach ( $this->arc2store->getErrors() as $error ) {
                throw new RDFIOARC2StoreWrapperException( $error );
            }
        }
Severity: Minor
Found in classes/RDFIO_ARC2StoreWrapper.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 'WikiPage' in method 'create'.
Open

            $pageObj = WikiPage::factory( $pageTitleObj );

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 'WikiPage' in method 'writeToPage'.
Open

        $mwArticleObj = WikiPage::factory( $mwTitleObj );
Severity: Minor
Found in classes/RDFIO_SMWPageWriter.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 'SMWDataValueFactory' in method 'changeTitle'.
Open

        $oldpage = SMWDataValueFactory::newTypeIDValue( '_wpg' );
Severity: Minor
Found in stores/SMW_ARC2Store.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 'SMWDIWikiPage' in method 'getURI'.
Open

            $wikiPageDI = SMWDIWikiPage::newFromTitle( $title );
Severity: Minor
Found in stores/SMW_ARC2Store.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 'ARC2' in method '__construct'.
Open

        $this->arc2store = ARC2::getStore( $arc2StoreConfig );
Severity: Minor
Found in stores/SMW_ARC2Store.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 'Html' in method 'execute'.
Open

                    Html::Hidden(  'rdfio-action', 'setup' ) .
Severity: Minor
Found in specials/SpecialRDFIOAdmin.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 'Title' in method 'create'.
Open

            $pageTitleObj = Title::newFromText( $pageTitle );

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 'ContentHandler' in method 'writeToPage'.
Open

        $mwArticleObj->doEditContent( ContentHandler::makeContent( $content, $mwTitleObj), $summary );
Severity: Minor
Found in classes/RDFIO_SMWPageWriter.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 'ARC2' in method 'execute'.
Open

            $triples = ARC2::getTriplesFromIndex( $index );
Severity: Minor
Found in maintenance/exportRdf.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 execute uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $this->infoMsg( 'Store is <b>not</b> set up' );
                $setupStoreForm = '
                <form method="post"
                    action=""
Severity: Minor
Found in specials/SpecialRDFIOAdmin.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 toEquivUrisInTriples uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $objEquivUris = $this->getEquivURIsForURI( $objUri );
                    if ( count( $objEquivUris ) > 0 ) {
                        $triples[$tripleidx]['o'] = $objEquivUris[0];
                        $equivUriCache[$objUri] = $objEquivUris[0];
Severity: Minor
Found in classes/RDFIO_ARC2StoreWrapper.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 'Title' in method 'getWikifiedTitle'.
Open

        $titleObj = Title::newFromText( $title, $wikiNamespace );
Severity: Minor
Found in classes/RDFIO_SMWPageWriter.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 convert() has 129 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function convert( $arc2Triples, $arc2ResourceIndex, $arc2NSPrefixes ) {
        // Instatiate wiki title converters (converting from URI and related RDF data to Wiki Title)
        $uriToTitleConv = new RDFIOURIToWikiTitleConverter( $arc2Triples, $arc2ResourceIndex, $arc2NSPrefixes );
        $uriToPropTitleConv = new RDFIOURIToPropertyTitleConverter( $arc2Triples, $arc2ResourceIndex, $arc2NSPrefixes );

Avoid using static access to class 'ARC2' in method 'execute'.
Open

                    $ser = ARC2::getRDFXMLSerializer();
Severity: Minor
Found in maintenance/exportRdf.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 'ARC2' in method 'importTurtle'.
Open

        $arc2turtleparser = ARC2::getTurtleParser( $importData );
Severity: Minor
Found in classes/RDFIO_RDFImporter.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 convert uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                // Separate handling for properties
                $propertyTitle = $uriToPropTitleConv->convert( $triple['p'] );
                // Add the property namespace to property title
                $propTitleWithNS = Title::makeTitleSafe( SMW_NS_PROPERTY, $propertyTitle )->getFullText();

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

        } else {
            $uriToTitleConv = new RDFIOURIToWikiTitleConverter( $this->arc2Triples, $this->arc2ResourceIndex, $this->arc2NSPrefixes );
            $propertyTitle = $uriToTitleConv->convert( $propertyURI );
        }

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 import() has 111 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function import( $wikiPages ) {

        // ----------------------------------------------------------------------
        //  1. Loop over wiki pages
        // ----------------------------------------------------------------------
Severity: Minor
Found in classes/RDFIO_SMWPageWriter.php by phpmd

Avoid using static access to class 'Title' in method 'getTextForPage'.
Open

        $titleObj = Title::newFromText( $title, $wikiNamespace );
Severity: Minor
Found in classes/RDFIO_SMWPageWriter.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