classes/RDFIO_SMWPageWriter.php

Summary

Maintainability
B
4 hrs
Test Coverage

Showing 14 of 14 total issues

Function import has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

public function import( $wikiPages ) {
 
// ----------------------------------------------------------------------
// 1. Loop over wiki pages
// ----------------------------------------------------------------------
Severity: Minor
Found in classes/RDFIO_SMWPageWriter.php - About 2 hrs to fix

Method import has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function import( $wikiPages ) {
 
// ----------------------------------------------------------------------
// 1. Loop over wiki pages
// ----------------------------------------------------------------------
Severity: Minor
Found in classes/RDFIO_SMWPageWriter.php - About 1 hr to fix

    Function updateTemplateCalls has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    private function updateTemplateCalls( $fact, $propTplIndex, $oldTemplateCalls, $wikiText ) {
    $prop = $fact['p'];
    $newVal = $fact['o'];
     
    if ( array_key_exists( $prop, $propTplIndex ) ) {
    Severity: Minor
    Found in classes/RDFIO_SMWPageWriter.php - About 35 mins to fix

    Function buildPropertyTemplateParamIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    private function buildPropertyTemplateParamIndex( $newFacts, $allTemplateFacts ) {
    // Build the index
    $propTplIndex = array();
    foreach ( $newFacts as $fact ) {
    $prop = $fact['p'];
    Severity: Minor
    Found in classes/RDFIO_SMWPageWriter.php - About 25 mins to fix

    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

    The method import() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
    Open

    public function import( $wikiPages ) {
     
    // ----------------------------------------------------------------------
    // 1. Loop over wiki pages
    // ----------------------------------------------------------------------
    Severity: Minor
    Found in classes/RDFIO_SMWPageWriter.php by phpmd

    Missing class import via use statement (line '22', column '15').
    Open

    throw new MWException( 'Could not import page: Title is empty!' );
    Severity: Minor
    Found in classes/RDFIO_SMWPageWriter.php by phpmd

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

    } else {
    $newTplCallText = str_replace('}}', '|' . $paramName . '=' . $newVal . "\n}}", $oldTplCallText);
    }
    Severity: Minor
    Found in classes/RDFIO_SMWPageWriter.php by phpmd

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

    $pageObj = WikiPage::factory( $titleObj );
    Severity: Minor
    Found in classes/RDFIO_SMWPageWriter.php by phpmd

    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

    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

    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

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

    $mwTitleObj = Title::newFromText( $wikiTitle );
    Severity: Minor
    Found in classes/RDFIO_SMWPageWriter.php by phpmd

    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

    There are no issues that match your filters.

    Category
    Status