Showing 248 of 248 total issues

Avoid too many return statements within this method.
Open

        return true;
Severity: Major
Found in app/resto/core/RestoNotifier.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return $object;
    Severity: Major
    Found in app/resto/core/Resto.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return RestoLogUtil::httpError(400, 'Invalid object');
      Severity: Major
      Found in app/resto/core/Resto.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return array(
                            'value' => count($ors) > 1 ? '(' . join(' OR ', $ors) . ')' : $ors[0],
                            'isGeo' => false
                        );
        Severity: Major
        Found in app/resto/core/dbfunctions/FiltersFunctions.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $this->prepareFilterQueryIntersects($filterName, $paramsWithOperation[$filterName], $exclusion);
          Severity: Major
          Found in app/resto/core/dbfunctions/FiltersFunctions.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $this->prepareFilterQueryDistance($filterName, $paramsWithOperation, $exclusion);
            Severity: Major
            Found in app/resto/core/dbfunctions/FiltersFunctions.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return array(
                                  'value' => $this->addNot($exclusion) . QueryUtil::intervalToQuery($this->context->dbDriver->getConnection(), $paramsWithOperation[$filterName]['value'], $this->getTableName($filterName) . '.' . $this->model->searchFilters[$filterName]['key']),
                                  'isGeo' => false
                              );
              Severity: Major
              Found in app/resto/core/dbfunctions/FiltersFunctions.php - About 30 mins to fix

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

                    private function setQuery($searchContext, $model)
                    {
                        $this->startElement('os:Query');
                        $this->writeAttributes(array('role' => 'request'));
                        if (isset($searchContext['query'])) {
                Severity: Minor
                Found in app/resto/core/xml/ATOMFeed.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 createToken has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function createToken($params)
                    {
                
                        // A token can be only be created by admin 
                        if ( !$this->user->hasGroup(RestoConstants::GROUP_ADMIN_ID) ) {
                Severity: Minor
                Found in app/resto/core/api/AuthAPI.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 getQueryables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getQueryables()
                    {
                        $queryables = array();
                        foreach (array_keys($this->searchFilters) as $filterKey) {
                            if (isset($this->searchFilters[$filterKey]['queryable'])) {
                Severity: Minor
                Found in app/resto/core/RestoModel.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 getFeaturesInCollection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getFeaturesInCollection($params)
                    {
                
                        // This should return HTTP 400 but we discard it instead otherwise it brokes pystac requests
                        if (isset($params['collections'])) {
                Severity: Minor
                Found in app/resto/core/api/FeaturesAPI.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 processComplexInterval has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function processComplexInterval($dbh, $columnName, $values)
                    {
                        $quote = true;
                
                        /*
                Severity: Minor
                Found in app/resto/core/utils/QueryUtil.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 getFiltersFromQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getFiltersFromQuery($query)
                    {
                        $params = array();
                        $unknowns = array();
                        foreach ($query as $key => $value) {
                Severity: Minor
                Found in app/resto/core/RestoModel.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 updateFeatureProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function updateFeatureProperty($params, $body)
                    {
                        $feature = new RestoFeature($this->context, $this->user, array(
                            'featureId' => $params['featureId'],
                            'collection' => $this->context->keeper->getRestoCollection($params['collectionId'], $this->user)->load()
                Severity: Minor
                Found in app/resto/core/api/FeaturesAPI.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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function load($object = null, $modelName = null)
                    {
                
                        if (isset($object)) {
                            return $this->loadFromJSON($object, $modelName);
                Severity: Minor
                Found in app/resto/core/RestoCollection.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 cleanAssociativeArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function cleanAssociativeArray($associativeArray)
                    {
                        // Output
                        $cleanArray = array();
                
                
                Severity: Minor
                Found in app/resto/core/utils/RestoUtil.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 getLandCoverKeywords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getLandCoverKeywords($properties)
                    {
                        $keywords = array();
                
                        /*
                Severity: Minor
                Found in app/resto/core/addons/Tag.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 clearUpload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function clearUpload($body)
                    {
                        try {
                            if (isset($body) && is_array($body['files'])) {
                                for ($i = count($body['files']); $i--;) {
                Severity: Minor
                Found in app/resto/core/utils/RestoFileUtil.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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function load($params = array())
                    {
                       
                        if ( !$this->isLoaded ) {
                            
                Severity: Minor
                Found in app/resto/core/RestoCollections.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 storeProfile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function storeProfile($profile, $storageInfo)
                    {
                        $userInfo = (new UsersFunctions($this->context->dbDriver))->storeUserProfile(
                            $profile,
                            $storageInfo
                Severity: Minor
                Found in app/resto/core/api/UsersAPI.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

                Severity
                Category
                Status
                Source
                Language