app/resto/core/xml/OSDD.php

Summary

Maintainability
C
1 day
Test Coverage

Function setParameters has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    private function setParameters($format)
    {
        foreach ($this->model->searchFilters as $filterName => $filter) {
            if (isset($filter) && $filterName != 'searchTerms' && !isset($filter['hidden'])) {
                $this->startElement('parameters:Parameter');
Severity: Minor
Found in app/resto/core/xml/OSDD.php - About 7 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

Method setParameters has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function setParameters($format)
    {
        foreach ($this->model->searchFilters as $filterName => $filter) {
            if (isset($filter) && $filterName != 'searchTerms' && !isset($filter['hidden'])) {
                $this->startElement('parameters:Parameter');
Severity: Minor
Found in app/resto/core/xml/OSDD.php - About 1 hr to fix

    Method getUrlTemplate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getUrlTemplate($format)
        {
            /*
             * HTML output is based on htmlSearchEndpoint
             */
    Severity: Minor
    Found in app/resto/core/xml/OSDD.php - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (isset($filter['options'][$i]['label'])) {
                                      $this->writeAttribute('label', $filter['options'][$i]['label']);
                                  }
      Severity: Major
      Found in app/resto/core/xml/OSDD.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        for ($i = count($this->statistics[$filter['osKey']]['oneOf']); $i--;) {
                                            $this->startElement('parameters:Option');
                                            $this->writeAttribute('value', $this->statistics[$filter['osKey']]['oneOf'][$i]['const']);
                                            $this->endElement();
                                        }
        Severity: Major
        Found in app/resto/core/xml/OSDD.php - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status