symphonycms/symphony-2

View on GitHub
symphony/lib/toolkit/class.databasestatement.php

Summary

Maintainability
D
2 days
Test Coverage

File class.databasestatement.php has 394 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * @package toolkit
 */
Severity: Minor
Found in symphony/lib/toolkit/class.databasestatement.php - About 5 hrs to fix

    DatabaseStatement has 34 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DatabaseStatement
    {
        /**
         * List of element delimiter
         * @var string
    Severity: Minor
    Found in symphony/lib/toolkit/class.databasestatement.php - About 4 hrs to fix

      Method asTickedString has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          final public function asTickedString($value, $alias = null)
          {
              if (!$value) {
                  return '';
              }
      Severity: Minor
      Found in symphony/lib/toolkit/class.databasestatement.php - About 2 hrs to fix

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

            final public function splitFunctionArguments($arguments)
            {
                General::ensureType([
                    'arguments' => ['var' => $arguments, 'type' => 'string'],
                ]);
        Severity: Minor
        Found in symphony/lib/toolkit/class.databasestatement.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 asTickedString has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            final public function asTickedString($value, $alias = null)
            {
                if (!$value) {
                    return '';
                }
        Severity: Minor
        Found in symphony/lib/toolkit/class.databasestatement.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 generateOrderedSQLParts has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            final public function generateOrderedSQLParts()
            {
                $allParts = $this->getStatementStructure();
                $orderedParts = [];
                foreach ($allParts as $ti => $type) {
        Severity: Minor
        Found in symphony/lib/toolkit/class.databasestatement.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 appendValues has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            final protected function appendValues(array $values)
            {
                if ($this->isUsingPlaceholders()) {
                    $values = array_values($values);
                } else {
        Severity: Minor
        Found in symphony/lib/toolkit/class.databasestatement.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 splitFunctionArguments has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            final public function splitFunctionArguments($arguments)
            {
                General::ensureType([
                    'arguments' => ['var' => $arguments, 'type' => 'string'],
                ]);
        Severity: Minor
        Found in symphony/lib/toolkit/class.databasestatement.php - About 1 hr to fix

          Avoid too many return statements within this method.
          Open

                          return "($value) AS $alias";
          Severity: Major
          Found in symphony/lib/toolkit/class.databasestatement.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $value;
            Severity: Major
            Found in symphony/lib/toolkit/class.databasestatement.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $this->asTickedList(explode(self::VALUES_DELIMITER, $value));
              Severity: Major
              Found in symphony/lib/toolkit/class.databasestatement.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $fxCall;
                Severity: Major
                Found in symphony/lib/toolkit/class.databasestatement.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return $value;
                  Severity: Major
                  Found in symphony/lib/toolkit/class.databasestatement.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return $value;
                    Severity: Major
                    Found in symphony/lib/toolkit/class.databasestatement.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return "$value AS $alias";
                      Severity: Major
                      Found in symphony/lib/toolkit/class.databasestatement.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $ip === -1 ? $this->asTickedString($p) : "$ip";
                        Severity: Major
                        Found in symphony/lib/toolkit/class.databasestatement.php - About 30 mins to fix

                          There are no issues that match your filters.

                          Category
                          Status