Showing 248 of 248 total issues

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

    private function getLinks($sorting, $collectionId)
    {
        /*
         * Base links are always returned
         */
Severity: Minor
Found in app/resto/core/RestoFeatureCollection.php - About 1 hr to fix

    Function setOutputFormat has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private function setOutputFormat()
        {
            $this->outputFormat = $this->getPathSuffix();
            
            /*
    Severity: Minor
    Found in app/resto/core/RestoContext.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 toArray has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function toArray()
        {
    
            $osDescription = $this->osDescription[$this->context->lang] ?? $this->osDescription['en'];
    
    
    Severity: Minor
    Found in app/resto/core/RestoCollection.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 formatPartialUserProfile has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function formatPartialUserProfile($rawProfile)
        {
            
            $profile = array(
                'id' => $rawProfile['id'],
    Severity: Minor
    Found in app/resto/core/dbfunctions/UsersFunctions.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 extractToponym has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function extractToponym($params, &$details, &$hashToDiscard)
        {
            $foundLocation = null;
    
            /*
    Severity: Minor
    Found in app/resto/core/RestoQueryAnalyzer.php - About 1 hr to fix

      Method getType has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getType(&$value)
          {
              $type = self::T_NONE;
      
              switch (true) {
      Severity: Minor
      Found in app/resto/core/utils/Lexer.php - About 1 hr to fix

        Method getFacetsCount has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getFacetsCount($minMatch)
            {
                $facets = array(
                    'count' => 0,
                    'catalogs' => array(),
        Severity: Minor
        Found in app/resto/core/utils/STACUtil.php - About 1 hr to fix

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

              private function parentIdFromLinks($links)
              {
          
                  $parentId = null;
          
          
          Severity: Minor
          Found in app/resto/core/addons/STACCatalog.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 clear has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function clear($key = null)
              {
                  if (isset($this->directory)) {
                      if (isset($key)) {
                          $file = $this->directory . DIRECTORY_SEPARATOR . crc32($key);
          Severity: Minor
          Found in app/resto/core/RestoCache.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 writeRequestParams has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              private function writeRequestParams($params)
              {
                  $arr = array();
          
                  foreach ($params as $key => $value) {
          Severity: Minor
          Found in app/resto/core/RestoFeatureCollection.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 formatUserProfile has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function formatUserProfile($rawProfile)
              {
                  // Empty profile
                  $profile = array();
          
          
          Severity: Minor
          Found in app/resto/core/dbfunctions/UsersFunctions.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 sendMail has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function sendMail($params, $smtp = array())
              {
                  if (! isset($params) || ! is_array($params)) {
                      return false;
                  }
          Severity: Minor
          Found in app/resto/core/RestoNotifier.php - About 1 hr to fix

            Method process has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function process($method, $path, $query)
                {
            
                    // Special case for doc generation
                    if ( $path === '/_routes' ) {
            Severity: Minor
            Found in app/resto/core/RestoRouter.php - About 1 hr to fix

              Method explodeSearchTerms has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function explodeSearchTerms($obj)
                  {
                      $hashtags = [];
                      $output = [];
                      
              Severity: Minor
              Found in app/resto/core/RestoModel.php - About 1 hr to fix

                Method format has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function format($rawDescription, $osDescription)
                    {
                        $collection = array(
                            'id' => $rawDescription['id'],
                            'aliases' => isset($rawDescription['aliases']) ? json_decode($rawDescription['aliases'], true) : array(),
                Severity: Minor
                Found in app/resto/core/dbfunctions/CollectionsFunctions.php - About 1 hr to fix

                  Function setThemesLinks has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function setThemesLinks()
                      {
                          $this->title = $this->segments[1];
                          $this->description = 'Collections for theme **' . $this->segments[1] . '**';
                  
                  
                  Severity: Minor
                  Found in app/resto/core/addons/STAC.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 __construct has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __construct($config)
                      {
                          if (isset($config)) {
                              if (isset($config['commonSchema'])) {
                                  $this->commonSchema = $config['commonSchema'];
                  Severity: Minor
                  Found in app/resto/core/RestoDatabaseDriver.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 getFacetsFromKeywords has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getFacetsFromKeywords($keywords, $facetCategories, $collectionId, $options = array())
                      {
                          /*
                           * One facet per keyword
                           */
                  Severity: Minor
                  Found in app/resto/core/dbfunctions/FacetsFunctions.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 hasRightsTo has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function hasRightsTo($action, $params = array())
                      {
                  
                          $rights = $this->getRights();
                  
                  
                  Severity: Minor
                  Found in app/resto/core/RestoUser.php - About 1 hr to fix

                    Method updateUserProfile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function updateUserProfile($profile, $storageInfo)
                        {
                            if (!is_array($profile) || !isset($profile['email'])) {
                                RestoLogUtil::httpError(400);
                            }
                    Severity: Minor
                    Found in app/resto/core/dbfunctions/UsersFunctions.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language