Showing 249 of 257 total issues

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

    public function search($context, $user, $model, $collections, $paramsWithOperation, $sorting)
Severity: Minor
Found in app/resto/core/dbfunctions/FeaturesFunctions.php - About 45 mins to fix

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

        public function getUserProfile($fieldName, $fieldValue, $params = array())
        {
            // Add followed and followme booleans
            $fields = $this->userFields;
            if (isset($params['from'])) {
    Severity: Minor
    Found in app/resto/core/dbfunctions/UsersFunctions.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 getFeatureDescription has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function getFeatureDescription($context, $user, $featureId, $collection, $fields)
    Severity: Minor
    Found in app/resto/core/dbfunctions/FeaturesFunctions.php - About 35 mins to fix

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

          public function __construct($context, $user, $collections, $model, $query)
      Severity: Minor
      Found in app/resto/core/RestoFeatureCollection.php - About 35 mins to fix

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

            private function processSearchTerms($searchTerm, &$filters, $featureTableName, $filterName, $exclusion)
        Severity: Minor
        Found in app/resto/core/dbfunctions/FiltersFunctions.php - About 35 mins to fix

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

              public function decodeJWT($token, $acceptExpired = false)
              {
                  try {
                      // Convert rJWT to JWT
                      if (count(explode('.', $token)) == 2) {
          Severity: Minor
          Found in app/resto/core/RestoContext.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

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

              private function processTriplet()
              {
                  $filter = array();
                  $not = false;
          
          
          Severity: Minor
          Found in app/resto/core/utils/FilterParser.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

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

              public function updateCatalog($params, $body)
              {
          
                  $facetId = $params['segments'][count($params['segments']) - 1 ];
                  $facets = (new FacetsFunctions($this->context->dbDriver))->getFacets(array('id' => $facetId));
          Severity: Minor
          Found in app/resto/core/addons/STACCatalog.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

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

              public static function storeBase64File($data, $outputDir, $allowedTypes = array())
              {
                  try {
                      if (preg_match('/^data:image\/(\w+);base64,/', $data, $type)) {
                          $data = substr($data, strpos($data, ',') + 1);
          Severity: Minor
          Found in app/resto/core/utils/RestoUtil.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

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

              public static function WKTPolygonToArray($wktPolygon)
              {
                  /*
                   * Result
                   */
          Severity: Minor
          Found in app/resto/core/utils/RestoGeometryUtil.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

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

              private function setQuery()
              {
                  /*
                   * Aggregate input parameters
                   *
          Severity: Minor
          Found in app/resto/core/RestoContext.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

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

              public static function checkGeoJSONFeature($object)
              {
                  // Default is nice
                  $error = 'Invalid GeoJSON feature';
          
          
          Severity: Minor
          Found in app/resto/core/utils/RestoGeometryUtil.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

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

              public function hasRightsTo($action, $params = array())
              {
          
                  $rights = $this->getRights();
          
          
          Severity: Minor
          Found in app/resto/core/RestoUser.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

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

              private function setCollectionLinks($links)
              {
                  if (is_array($links)) {
                      for ($i = 0, $l = count($links); $i < $l; $i++) {
                          $this->startElement('link');
          Severity: Minor
          Found in app/resto/core/xml/ATOMFeed.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

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

              private function getIdFromBearer($context, $token)
              {
                  $payloadObject = $context->decodeJWT($token);
          
                  // Unvalid token => no auth
          Severity: Minor
          Found in app/resto/core/utils/SecurityUtil.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

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

              private function uploadFiles($files)
              {
                  $filePaths = [];
          
                  // All files will be uploaded within a dedicated directory with a random name
          Severity: Minor
          Found in app/resto/core/RestoRouter.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

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

              public function storeUserProfile($profile, $storageInfo)
              {
                  if (!is_array($profile) || !isset($profile['email'])) {
                      RestoLogUtil::httpError(400, 'Cannot save user profile - invalid user identifier');
                  }
          Severity: Minor
          Found in app/resto/core/dbfunctions/UsersFunctions.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

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

              private function setWhatFilters($what, $params)
              {
                  $params['searchTerms'] = array();
                  foreach ($what as $key => $value) {
                      if ($key === 'searchTerms') {
          Severity: Minor
          Found in app/resto/core/RestoQueryAnalyzer.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

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

              private function processSearchTerms($searchTerm, &$filters, $featureTableName, $filterName, $exclusion)
              {
                  /*
                   * The '|' character is understood as "OR"
                   * For performance reason it is better to use && operator instead of multiple @> with OR
          Severity: Minor
          Found in app/resto/core/dbfunctions/FiltersFunctions.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

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

              private function getRightsForGroups($groupIds)
              {
                  $groupRights = array();
                  $results = $this->dbDriver->fetch($this->dbDriver->query('SELECT rights FROM ' . $this->dbDriver->commonSchema . '.right WHERE groupid IN (' . pg_escape_string($this->dbDriver->getConnection(), join(',', $groupIds)) . ')'));
                  if ( isset($results) && count($results) >= 1 ) {
          Severity: Minor
          Found in app/resto/core/dbfunctions/RightsFunctions.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

          Severity
          Category
          Status
          Source
          Language