Showing 58 of 125 total issues

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

    function leftJoin(
        $leftTable = '',
        $rightTable = '',
        $leftColumn = null,
        $rightColumn = null,
Severity: Major
Found in lib/ezFunctions.php and 3 other locations - About 1 hr to fix
lib/ezFunctions.php on lines 1167..1179
lib/ezFunctions.php on lines 1245..1257
lib/ezFunctions.php on lines 1283..1295

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 101.

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 4 locations. Consider refactoring.
Open

    function innerJoin(
        $leftTable = '',
        $rightTable = '',
        $leftColumn = null,
        $rightColumn = null,
Severity: Major
Found in lib/ezFunctions.php and 3 other locations - About 1 hr to fix
lib/ezFunctions.php on lines 1206..1218
lib/ezFunctions.php on lines 1245..1257
lib/ezFunctions.php on lines 1283..1295

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 101.

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

Consider simplifying this complex logical expression.
Open

                if ($joinSet || $skipWhere || $groupBySet || $havingSet || $orderBySet || $limitSet || $unionSet) {
                    $where = $args_by;
                    $skipWhere = true;
                }
Severity: Major
Found in lib/ezQuery.php - About 1 hr to fix

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

        public function __construct(string $driver = '', array $arguments = null)
        {
            $sql = \strtolower($driver);
            if (!\array_key_exists($sql, \VENDOR) || empty($arguments)) {
                throw new Exception(\MISSING_CONFIGURATION);
    Severity: Minor
    Found in lib/Config.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 retrieveConditions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function retrieveConditions($whereConditions)
        {
            $whereConditions = $this->flattenWhereConditions($whereConditions);
            $whereKey = [];
            $whereValue = [];
    Severity: Minor
    Found in lib/ezQuery.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 processConditions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function processConditions($column, $condition, $value, $valueOrCombine, $extraCombine)
        {
            if (!\in_array($condition, \_BOOLEAN_OPERATORS))
                return $this->clearPrepare();
    
    
    Severity: Minor
    Found in lib/ezQuery.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 query_prepared has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function query_prepared(string $query, array $param = null, $isSelect = false)
        {
            $stmt = $this->dbh->prepare($query);
            $result = false;
            if ($stmt && $stmt->execute(\array_values($param))) {
    Severity: Minor
    Found in lib/Database/ez_pdo.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 current has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function current($mode = self::RESULT_AS_OBJECT)
        {
            $return_val = null;
            if (!\in_array($mode, $this->_checkTypes)) {
                throw new \Exception(\sprintf('$mode is not in %s1 or %s2', self::RESULT_AS_OBJECT, self::RESULT_AS_ARRAY));
    Severity: Minor
    Found in lib/ezResultset.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

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

            if (!empty($param) && \is_array($param) && $this->isPrepareOn()) {
                $this->shortcutUsed = true;
                $this->result = $this->query_prepared($query, $param);
            } else {
                try {
    Severity: Minor
    Found in lib/Database/ez_sqlsrv.php and 1 other location - About 40 mins to fix
    lib/Database/ez_pgsql.php on lines 302..311

    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 94.

    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

            if (!empty($param) && \is_array($param) && ($this->isPrepareOn())) {
                $this->shortcutUsed = true;
                $this->result = $this->query_prepared($query, $param);
            } else {
                try {
    Severity: Minor
    Found in lib/Database/ez_pgsql.php and 1 other location - About 40 mins to fix
    lib/Database/ez_sqlsrv.php on lines 304..313

    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 94.

    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

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

            string $privatekeyFile = 'certificate.key',
            string $certificateFile = 'certificate.crt',
            string $signingFile = 'certificate.csr',
            // string $caCertificate = null,
            string $ssl_path = null,
    Severity: Minor
    Found in lib/ezFunctions.php - About 35 mins to fix

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

          private function joining(
              String $type = \_INNER,
              string $leftTable = null,
              string $rightTable = null,
              string $leftColumn = null,
      Severity: Minor
      Found in lib/ezQuery.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 __call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __call($type, $args)
          {
              $vendor = self::vendor();
              if (empty($vendor))
                  return false;
      Severity: Minor
      Found in lib/ezSchema.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 varDump has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function varDump($mixed = null)
          {
              // Start output buffering
              \ob_start();
      
      
      Severity: Minor
      Found in lib/ezsqlModel.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 get_cache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get_cache(string $query)
          {
              // The would be cache file for this query
              $cache_file = $this->cacheDir . \_DS . \md5($query);
      
      
      Severity: Minor
      Found in lib/ezsqlModel.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 create_schema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function create_schema(array ...$columnDataOptions)
          {
              if (empty($columnDataOptions))
                  return false;
      
      
      Severity: Minor
      Found in lib/ezQuery.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 get_col_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get_col_info(string $info_type = "name", int $col_offset = -1)
          {
              if ($this->colInfo) {
                  $new_array = [];
                  if ($col_offset == -1) {
      Severity: Minor
      Found in lib/ezsqlModel.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 __call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __call($function, $args)
          {
              $prefix = \substr($function, 0, 3);
              $property = \lcfirst(\substr($function, 3, \strlen($function)));
              // Todo: make properties PSR-1, add following for backward compatibility
      Severity: Minor
      Found in lib/ezsqlModel.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