hellsan631/LogosDB

View on GitHub

Showing 21 of 21 total issues

Function createMultiple has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public static function createMultiple($data, $count = null){

        $keyChain = self::getKeyChain();
        $goodKeys = $dataArray = [];

Severity: Minor
Found in lib/Logos/DB/MySQL/Model.php - About 4 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

Function query has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public static function query($functionCall, $params = null){

        $callable = new QueryHandler();

        if($params === null){
Severity: Minor
Found in lib/Logos/DB/MySQL/Model.php - About 3 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

File Model.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Logos\DB\MySQL;

use Logos\DB\DatabaseObject;
Severity: Minor
Found in lib/Logos/DB/MySQL/Model.php - About 2 hrs to fix

    Method createMultiple has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function createMultiple($data, $count = null){
    
            $keyChain = self::getKeyChain();
            $goodKeys = $dataArray = [];
    
    
    Severity: Minor
    Found in lib/Logos/DB/MySQL/Model.php - About 1 hr to fix

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

          public function check_token(){
      
              if(!$this->check_valid($_SERVER['REQUEST_METHOD']))
                  return false;
      
      
      Severity: Minor
      Found in lib/Logos/Security/Iron.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 fetchQueryObj has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function fetchQueryObj($prepare, $execute, $fetchMode, &$fetchParam){
      
              try {
                  $newInstance = self::getInstance();
      
      
      Severity: Minor
      Found in lib/Logos/DB/MySQL/Adapter.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 testDatabaseCanSaveMultipleObjects has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testDatabaseCanSaveMultipleObjects(){
      
              $object = self::$db_table_name;
      
              $max = 10000;
      Severity: Minor
      Found in lib/Testing/Tests/User_Test.php - About 1 hr to fix

        Function limit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function limit($limit){
        
                $min = null;
                $max = null;
        
        
        Severity: Minor
        Found in lib/Logos/DB/MySQL/QueryHandler.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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            public function getList($conditionArray = null){
        
                self::dataToArray($conditionArray);
                $name = self::name();
        
        
        Severity: Major
        Found in lib/Logos/DB/MySQL/Model.php and 1 other location - About 1 hr to fix
        lib/Logos/DB/MySQL/Model.php on lines 461..475

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 103.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            public static function loadMultiple($conditionArray = null){
        
                self::dataToArray($conditionArray);
                $name = self::name();
        
        
        Severity: Major
        Found in lib/Logos/DB/MySQL/Model.php and 1 other location - About 1 hr to fix
        lib/Logos/DB/MySQL/Model.php on lines 402..416

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 103.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function testDatabaseCanSaveMultipleObjects has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function testDatabaseCanSaveMultipleObjects(){
        
                $object = self::$db_table_name;
        
                $max = 10000;
        Severity: Minor
        Found in lib/Testing/Tests/User_Test.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 dataToArray has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected static function dataToArray(&$dataToFilter){
                if(!is_array($dataToFilter) && $dataToFilter !== null){
                    if(is_object($dataToFilter))
                        $dataToFilter = (array) $dataToFilter;
                    else if(Core::isJson($dataToFilter))
        Severity: Minor
        Found in lib/Logos/DB/DatabaseObject.php - About 55 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 createSingle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function createSingle($data){
        
                self::dataToArray($data);
                $keyChain = self::getKeyChain();
        
        
        Severity: Minor
        Found in lib/Logos/DB/MySQL/Model.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 updateObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function updateObject(&$dataToUpdate, $adhere = true){
                $keyChain = self::getKeyChain();
        
                self::dataToArray($dataToUpdate);
        
        
        Severity: Minor
        Found in lib/Logos/DB/DatabaseObject.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 createNew has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function createNew(){
        
                //A list of keys to be iterated though, generated by Object Attribute Names
                //We use the keychain because it gets non-dynamic property names,
                //which is what the database schema is based on.
        Severity: Minor
        Found in lib/Logos/DB/MySQL/Model.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

        Avoid too many return statements within this method.
        Open

                return (json_last_error() === JSON_ERROR_NONE);
        Severity: Major
        Found in lib/Logos/Resources/Core.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return true;
          Severity: Major
          Found in lib/Logos/Security/Iron.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return false;
            Severity: Major
            Found in lib/Logos/Security/Iron.php - About 30 mins to fix

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

                  private static function _buildQuerySet(&$prepareStatement, &$conditionArray, &$keyChain = []){
              
                      if(count($keyChain) === 0)
                          $keyChain = self::getKeyChain();
              
              
              Severity: Minor
              Found in lib/Logos/DB/MySQL/Model.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 toArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function toArray($emptyNull = false){
              
                      if($emptyNull){
                          $array = get_object_vars($this);
              
              
              Severity: Minor
              Found in lib/Logos/DB/DatabaseObject.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