PHPixie/Database

View on GitHub

Showing 66 of 66 total issues

Function dsn has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function dsn($withDatabase = true)
    {
        if($connection = $this->config->get('connection')) {
            $dsn = $connection;
        } else {
Severity: Minor
Found in src/PHPixie/Database/Driver/InterBase/Adapter/Firebird.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 optimize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function optimize($groups)
    {
        $count = count($groups);
        $remove = array();
        for ($i = 0; $i < $count; $i++) {

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 addKeyValuesToArray has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addKeyValuesToArray($name, $args, $requireKeys = false, $firstParameterIsKey = true, $assertIsNumeric = false)
    {
        $array = $args[0];

        if (!is_array($array)) {
Severity: Minor
Found in src/PHPixie/Database/Query/Implementation/Builder.php - About 1 hr to fix

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

        protected function parseGeneric($field, $operator, $value, $negated, $convertMongoId = false)
        {
            if (!is_array($value) || count($value) !== 1)
                throw new \PHPixie\Database\Exception\Parser("The '$operator' operator requires a single array parameter to be passed");
            
    Severity: Minor
    Found in src/PHPixie/Database/Driver/Mongo/Parser/Operator.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 parseLogicLevel has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseLogicLevel($iterator, $level = 0)
        {
            $current = $iterator->current();
            $res = $this->normalize($current);
    
    
    Severity: Minor
    Found in src/PHPixie/Database/Conditions/Logic/Parser.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 parseCompare has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function parseCompare($field, $operator, $values)
        {
            $isColumn =  false;
    
            if (substr($operator, -1, 1) === '*') {
    Severity: Minor
    Found in src/PHPixie/Database/Type/SQL/Parser/Operator.php - About 1 hr to fix

      Function add has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function add($condition, $logic = 'and')
          {
              $isExpandedGroup = $condition instanceof ExpandedGroup;
              if(!$isExpandedGroup && !(($condition instanceof \PHPixie\Database\Conditions\Condition\Field\Operator))) {
                  throw new \PHPixie\Database\Exception\Parser("You can only add ExpandedGroup and Operator conditions");
      Severity: Minor
      Found in src/PHPixie/Database/Driver/Mongo/Parser/Conditions/ExpandedGroup.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function run($connection)
          {
              $current = $connection->database();
              
              foreach ($this->chain as $step) {
      Severity: Minor
      Found in src/PHPixie/Database/Driver/Mongo/Query/Runner.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 addContainerOperatorCondition has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          protected function addContainerOperatorCondition($logic, $negate, $field, $operator, $values, $containerName = null)
      Severity: Minor
      Found in src/PHPixie/Database/Driver/PDO/Query/Items.php - About 45 mins to fix

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

            protected function addContainerOperatorCondition($logic, $negate, $field, $operator, $values, $containerName = null)
        Severity: Minor
        Found in src/PHPixie/Database/Driver/Mongo/Query/Item.php - About 45 mins to fix

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

              public function buildCondition($logic, $negate, $args)
              {
                  $count = count($args);
                  if ($count >= 2) {
                      $field = $args[0];
          Severity: Minor
          Found in src/PHPixie/Database/Conditions/Builder/Container.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 addOperatorCondition has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function addOperatorCondition($logic, $negate, $field, $operator, $values, $containerName = null)
          Severity: Minor
          Found in src/PHPixie/Database/Query/Implementation/Builder.php - About 45 mins to fix

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

                protected function appendFields($query, $expr)
                {
                    $fields = $query->getFields();
            
                    if (empty($fields)) {
            Severity: Minor
            Found in src/PHPixie/Database/Type/SQL/Parser.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 parseBetween has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                protected function parseBetween($field, $operator, $range, $negated, $convertMongoId = false)
            Severity: Minor
            Found in src/PHPixie/Database/Driver/Mongo/Parser/Operator.php - About 35 mins to fix

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

                  protected function addContainerInOperatorCondition($field, $values, $logic, $negate, $containerName = null)
              Severity: Minor
              Found in src/PHPixie/Database/Driver/Mongo/Query/Item.php - About 35 mins to fix

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

                    public function addSubdocumentPlaceholder($field, $logic = 'and', $negate = false, $allowEmpty = true, $containerName = null)
                Severity: Minor
                Found in src/PHPixie/Database/Type/Document/Query/Implementation/Builder.php - About 35 mins to fix

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

                      public function addSubarrayItemPlaceholder($field, $logic = 'and', $negate = false, $allowEmpty = true, $containerName = null)
                  Severity: Minor
                  Found in src/PHPixie/Database/Type/Document/Query/Implementation/Builder.php - About 35 mins to fix

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

                        protected function addContainerSubdocumentPlaceholder($field, $logic = 'and', $negate = false, $allowEmpty = true, $containerName = null)
                    Severity: Minor
                    Found in src/PHPixie/Database/Driver/Mongo/Query/Item.php - About 35 mins to fix

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

                          protected function parseGeneric($field, $operator, $value, $negated, $convertMongoId = false)
                      Severity: Minor
                      Found in src/PHPixie/Database/Driver/Mongo/Parser/Operator.php - About 35 mins to fix

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

                            public function addOnOperatorCondition($logic, $negate, $field, $operator, $values)
                        Severity: Minor
                        Found in src/PHPixie/Database/Driver/PDO/Query/Items.php - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language