NatLibFi/Skosmos

View on GitHub
src/model/VocabularyConfig.php

Summary

Maintainability
F
3 days
Test Coverage
A
95%

File VocabularyConfig.php has 498 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * VocabularyConfig provides access to the vocabulary configuration defined in config.ttl.
 */
Severity: Minor
Found in src/model/VocabularyConfig.php - About 7 hrs to fix

    VocabularyConfig has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class VocabularyConfig extends BaseConfig
    {
        private $globalPlugins;
        private $pluginRegister;
        private $pluginParameters = array();
    Severity: Minor
    Found in src/model/VocabularyConfig.php - About 6 hrs to fix

      The class VocabularyConfig has an overall complexity of 124 which is very high. The configured complexity threshold is 50.
      Open

      class VocabularyConfig extends BaseConfig
      {
          private $globalPlugins;
          private $pluginRegister;
          private $pluginParameters = array();
      Severity: Minor
      Found in src/model/VocabularyConfig.php by phpmd

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

          public function getDataURLs()
          {
              $ret = array();
              $urls = $this->resource->allResources("void:dataDump");
              foreach ($urls as $url) {
      Severity: Minor
      Found in src/model/VocabularyConfig.php - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function getPluginArray has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getPluginArray(): array
          {
              $this->setParameterizedPlugins();
              $pluginArray = array();
              $vocabularyPlugins = $this->resource->getResource('skosmos:vocabularyPlugins');
      Severity: Minor
      Found in src/model/VocabularyConfig.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method getDataURLs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getDataURLs()
          {
              $ret = array();
              $urls = $this->resource->allResources("void:dataDump");
              foreach ($urls as $url) {
      Severity: Minor
      Found in src/model/VocabularyConfig.php - About 1 hr to fix

        Method getPluginArray has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getPluginArray(): array
            {
                $this->setParameterizedPlugins();
                $pluginArray = array();
                $vocabularyPlugins = $this->resource->getResource('skosmos:vocabularyPlugins');
        Severity: Minor
        Found in src/model/VocabularyConfig.php - About 1 hr to fix

          Function setParameterizedPlugins has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function setParameterizedPlugins(): void
              {
                  $this->pluginParameters = array();
          
                  $vocabularyPlugins = $this->resource->getResource('skosmos:vocabularyPlugins');
          Severity: Minor
          Found in src/model/VocabularyConfig.php - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function getLanguageOrder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getLanguageOrder($clang)
              {
                  if (array_key_exists($clang, $this->languageOrderCache)) {
                      return $this->languageOrderCache[$clang];
                  }
          Severity: Minor
          Found in src/model/VocabularyConfig.php - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function getPropertyOrder()
              {
                  $order = $this->getResource()->getResource('skosmos:propertyOrder');
                  if ($order === null) {
                      return self::DEFAULT_PROPERTY_ORDER;
          Severity: Minor
          Found in src/model/VocabularyConfig.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Avoid too many return statements within this method.
          Open

                  return self::DEFAULT_PROPERTY_ORDER;
          Severity: Major
          Found in src/model/VocabularyConfig.php - About 30 mins to fix

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

                public function getSidebarViews()
                {
                    $views = $this->resource->getResource('skosmos:sidebarViews');
                    if ($views) {
                        $viewsArray = array();
            Severity: Minor
            Found in src/model/VocabularyConfig.php - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                private function setPluginParameters(Easyrdf\Resource $pluginResource): void
                {
                    $pluginName = $pluginResource->getLiteral('skosmos:usePlugin')->getValue();
                    $this->pluginParameters[$pluginName] = array();
            
            
            Severity: Minor
            Found in src/model/VocabularyConfig.php - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                public function getDefaultSidebarView()
                {
                    $defview = $this->resource->getLiteral('skosmos:defaultSidebarView');
                    $sidebarViews = $this->getSidebarViews();
                    if ($defview) {
            Severity: Minor
            Found in src/model/VocabularyConfig.php - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                public function getDefaultConceptSidebarView()
                {
                    $defview = $this->resource->getLiteral('skosmos:defaultConceptSidebarView');
                    $sidebarViews = $this->getSidebarViews();
                    if ($defview) {
            Severity: Minor
            Found in src/model/VocabularyConfig.php - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Missing class import via use statement (line '39', column '37').
            Open

                    $this->pluginRegister = new PluginRegister($pluginArray);
            Severity: Minor
            Found in src/model/VocabularyConfig.php by phpmd

            MissingImport

            Since: 2.7.0

            Importing all external classes in a file through use statements makes them clearly visible.

            Example

            function make() {
                return new \stdClass();
            }

            Source http://phpmd.org/rules/cleancode.html#MissingImport

            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

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

                        if (EasyRdf\RdfNamespace::shorten($prop) !== null) { // shortening property labels if possible
            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 getDefaultConceptSidebarView uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        return $sidebarViews[0]; // if no hierarchy, displaying first provided view
                    }
            Severity: Minor
            Found in src/model/VocabularyConfig.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 'getHierarchyProperty'.
            Open

                        if (EasyRdf\RdfNamespace::shorten($prop) !== null) { // prefixing if possible
            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

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

                    $short = EasyRdf\RdfNamespace::shorten($order);
            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 getDefaultConceptSidebarView uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            return $sidebarViews[0]; // if not in sidebarViews, displaying first provided view
                        }
            Severity: Minor
            Found in src/model/VocabularyConfig.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 getDataURLs uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $format = EasyRdf\Format::guessFormat(null, $url->getURI());
                            if ($format === null) {
                                trigger_error("Could not guess format for <$url>.", E_USER_WARNING);
                                continue;
            Severity: Minor
            Found in src/model/VocabularyConfig.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 'getAdditionalSearchProperties'.
            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

            Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'hasMultiLingualProperty'.
            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 getPluginArray uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                            } else {
                                $pluginArray[] = $plugin->getLiteral('skosmos:usePlugin')->getValue();
                            }
            Severity: Minor
            Found in src/model/VocabularyConfig.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 getDefaultSidebarView uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        return $sidebarViews[0]; // if no alphabetical index, displaying first provided view
                    }
            Severity: Minor
            Found in src/model/VocabularyConfig.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 getDataURLs uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $ret[$mimetype] = $url->getURI();
                        }
            Severity: Minor
            Found in src/model/VocabularyConfig.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 getDefaultSidebarView uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            return $sidebarViews[0]; // if not in sidebarViews, displaying first provided view
                        }
            Severity: Minor
            Found in src/model/VocabularyConfig.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 'getDataURLs'.
            Open

                            $format = EasyRdf\Format::guessFormat(null, $url->getURI());
            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 getDataURLs uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                            } else {
                                $arr = $ret[$mimetype];
                            }
            Severity: Minor
            Found in src/model/VocabularyConfig.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\Language' in method 'getLanguages'.
            Open

                        $langlit = Punic\Language::getName($lang->getValue(), $this->getLang());
            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

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

                        if (EasyRdf\RdfNamespace::shorten($prop) !== null) { // shortening property labels if possible
            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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public function getDefaultConceptSidebarView()
                {
                    $defview = $this->resource->getLiteral('skosmos:defaultConceptSidebarView');
                    $sidebarViews = $this->getSidebarViews();
                    if ($defview) {
            Severity: Major
            Found in src/model/VocabularyConfig.php and 1 other location - About 1 hr to fix
            src/model/VocabularyConfig.php on lines 559..577

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 103.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public function getDefaultSidebarView()
                {
                    $defview = $this->resource->getLiteral('skosmos:defaultSidebarView');
                    $sidebarViews = $this->getSidebarViews();
                    if ($defview) {
            Severity: Major
            Found in src/model/VocabularyConfig.php and 1 other location - About 1 hr to fix
            src/model/VocabularyConfig.php on lines 583..601

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 103.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

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

                public function getShowTopConcepts()
                {
                    return $this->getBoolean('skosmos:showTopConcepts');
                }
            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

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

                public function getShowLangCodes()
                {
                    return $this->getBoolean('skosmos:explicitLanguageTags');
                }
            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

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

                public function getExternalResourcesLoading()
                {
                    return $this->getBoolean('skosmos:loadExternalResources', 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

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

                public function getShowDeprecated()
                {
                    return $this->getBoolean('skosmos:showDeprecated', false);
                }
            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

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

                public function getShowDeprecatedChanges()
                {
                    return $this->getBoolean('skosmos:showDeprecatedChanges', false);
                }
            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

            There are no issues that match your filters.

            Category
            Status