NatLibFi/Skosmos

View on GitHub

Showing 1,049 of 1,049 total issues

Method generateConceptSearchQueryInner has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph)
Severity: Minor
Found in src/model/sparql/GenericSparql.php - About 45 mins to fix

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

        public function getLanguages()
        {
            $languageResources = $this->getResource()->getResource('skosmos:languages');
            if (!is_null($languageResources) && !empty($languageResources)) {
                $languages = array();
    Severity: Minor
    Found in src/model/GlobalConfig.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

    Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct($model, $vocab, $resource, $literal, $prop, $clang = '')
    Severity: Minor
    Found in src/model/ConceptPropertyValueLiteral.php - About 45 mins to fix

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

          public function getReifiedPropertyValues()
          {
              $ret = array();
              $props = $this->resource->propertyUris();
              foreach ($props as $prop) {
      Severity: Minor
      Found in src/model/ConceptPropertyValue.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 sendFeedback has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null)
          {
              $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
              $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject;
              if ($fromVocab !== null && $fromVocab !== '') {
      Severity: Minor
      Found in src/controller/WebController.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

      Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function __construct($model, $prop, $label, $tooltip = null, $super = null, $sort_by_notation = false)
      Severity: Minor
      Found in src/model/ConceptProperty.php - About 45 mins to fix

        Method queryTransitiveProperty has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function queryTransitiveProperty($uri, $props, $lang, $limit, $anylang = false, $fallbacklang = '')
        Severity: Minor
        Found in src/model/sparql/GenericSparql.php - About 45 mins to fix

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

              private function initializeConfig(): EasyRdf\Resource
              {
                  // retrieve last modified time for config file (filemtime returns int|bool!)
                  $configModifiedTime = filemtime($this->filePath);
                  if (!is_bool($configModifiedTime)) {
          Severity: Minor
          Found in src/model/GlobalConfig.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 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 getVocabularyList has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getVocabularyList($categories = true, $shortname = false)
              {
                  $cats = $this->getVocabularyCategories();
                  $ret = array();
                  foreach ($cats as $cat) {
          Severity: Minor
          Found in src/model/Model.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

          Method linkUrlFilter has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function linkUrlFilter($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null)
          Severity: Minor
          Found in src/controller/LinkUrlExtension.php - About 45 mins to fix

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

                public function search(Request $request): void
                {
                    $maxhits = $request->getQueryParam('maxhits');
                    $offset = $request->getQueryParam('offset');
                    $term = $request->getQueryParamRaw('query');
            Severity: Minor
            Found in src/controller/RestController.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 dumpJsonLd has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function dumpJsonLd()
                {
                    $context = array(
                        'skos' => EasyRdf\RdfNamespace::get("skos"),
                        'isothes' => EasyRdf\RdfNamespace::get("isothes"),
            Severity: Minor
            Found in src/model/Concept.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 getVocabName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getVocabName($lang = '')
                {
            
                    if ($this->clang) {
                        $lang = $this->clang;
            Severity: Minor
            Found in src/model/ConceptMappingPropertyValue.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

            Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function __construct(Model $model, Vocabulary $vocab, Resource $target, Resource $source, string $prop, $clang = '')
            Severity: Minor
            Found in src/model/ConceptMappingPropertyValue.php - About 45 mins to fix

              The class Model has a coupling between objects value of 24. Consider to reduce the number of dependencies under 13.
              Open

              class Model
              {
                  /** cache for Vocabulary objects */
                  private $allVocabularies = null;
                  /** cache for Vocabulary objects */
              Severity: Minor
              Found in src/model/Model.php by phpmd

              CouplingBetweenObjects

              Since: 1.1.0

              A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

              Example

              class Foo {
                  /**
                   * @var \foo\bar\X
                   */
                  private $x = null;
              
                  /**
                   * @var \foo\bar\Y
                   */
                  private $y = null;
              
                  /**
                   * @var \foo\bar\Z
                   */
                  private $z = null;
              
                  public function setFoo(\Foo $foo) {}
                  public function setBar(\Bar $bar) {}
                  public function setBaz(\Baz $baz) {}
              
                  /**
                   * @return \SplObjectStorage
                   * @throws \OutOfRangeException
                   * @throws \InvalidArgumentException
                   * @throws \ErrorException
                   */
                  public function process(\Iterator $it) {}
              
                  // ...
              }

              Source https://phpmd.org/rules/design.html#couplingbetweenobjects

              The class Concept has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13.
              Open

              class Concept extends VocabularyDataObject implements Modifiable
              {
                  /**
                   * Stores a label string if the concept has been found through
                   * a altLabel/label in a another language than the ui.
              Severity: Minor
              Found in src/model/Concept.php by phpmd

              CouplingBetweenObjects

              Since: 1.1.0

              A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

              Example

              class Foo {
                  /**
                   * @var \foo\bar\X
                   */
                  private $x = null;
              
                  /**
                   * @var \foo\bar\Y
                   */
                  private $y = null;
              
                  /**
                   * @var \foo\bar\Z
                   */
                  private $z = null;
              
                  public function setFoo(\Foo $foo) {}
                  public function setBar(\Bar $bar) {}
                  public function setBaz(\Baz $baz) {}
              
                  /**
                   * @return \SplObjectStorage
                   * @throws \OutOfRangeException
                   * @throws \InvalidArgumentException
                   * @throws \ErrorException
                   */
                  public function process(\Iterator $it) {}
              
                  // ...
              }

              Source https://phpmd.org/rules/design.html#couplingbetweenobjects

              Method transformPropertyResults has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private function transformPropertyResults($uri, $lang, $objects, $propname, $propuri)
              Severity: Minor
              Found in src/controller/RestController.php - About 35 mins to fix

                Method generateChangeListQuery has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false)
                Severity: Minor
                Found in src/model/sparql/GenericSparql.php - About 35 mins to fix

                  Method generateTransitivePropertyQuery has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private function generateTransitivePropertyQuery($uri, $props, $lang, $limit, $anylang)
                  Severity: Minor
                  Found in src/model/sparql/GenericSparql.php - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language