src/Dop/Connection.php

Summary

Maintainability
D
2 days
Test Coverage

File Connection.php has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Dop;

/**
Severity: Minor
Found in src/Dop/Connection.php - About 5 hrs to fix

    Connection has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Connection
    {
        /**
         * Constructor
         *
    Severity: Minor
    Found in src/Dop/Connection.php - About 3 hrs to fix

      Function is has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function is($column, $value, $not = false)
          {
              $bang = $not ? '!' : '';
              $or = $not ? ' AND ' : ' OR ';
              $novalue = $not ? '1=1' : '0=1';
      Severity: Minor
      Found in src/Dop/Connection.php - About 2 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

      Method is has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function is($column, $value, $not = false)
          {
              $bang = $not ? '!' : '';
              $or = $not ? ' AND ' : ' OR ';
              $novalue = $not ? '1=1' : '0=1';
      Severity: Minor
      Found in src/Dop/Connection.php - About 1 hr to fix

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

            public function where($condition = null, $params = array(), $before = null)
            {
                // empty condition evaluates to true
                if (empty($condition)) {
                    return $before ? $before : $this('1=1');
        Severity: Minor
        Found in src/Dop/Connection.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

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

            public function filter($rows, $fn, $value = null)
            {
                if (is_callable(array($rows, 'fetchAll'))) {
                    $rows = $rows->fetchAll();
                }
        Severity: Minor
        Found in src/Dop/Connection.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

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

            public function limit($count = null, $offset = null)
            {
                if ($count !== null) {
                    $count = intval($count);
                    if ($count < 1) {
        Severity: Minor
        Found in src/Dop/Connection.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

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

            public function insertBatch($table, $rows)
            {
                if ($this->empt($rows)) {
                    return $this(self::EMPTY_STATEMENT);
                }
        Severity: Minor
        Found in src/Dop/Connection.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

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

            public function value($value)
            {
                if (is_array($value)) {
                    return $this->raw(implode(', ', array_map(array($this, 'value'), $value)));
                }
        Severity: Minor
        Found in src/Dop/Connection.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

        There are no issues that match your filters.

        Category
        Status