Showing 21 of 106 total issues

File SQL.php has 375 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 *  This is Spoof.
 *  Copyright (C) 2011-2017  Spoof project.
Severity: Minor
Found in src/lib360/db/language/SQL.php - About 5 hrs to fix

    Method __construct has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct($value, $type = null)
        {
            // validate type and value
            if (is_null($type)) {
                $type = $this->determineType($value);
    Severity: Major
    Found in src/lib360/db/value/Value.php - About 2 hrs to fix

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

          public function __construct($value, $type = null)
          {
              // validate type and value
              if (is_null($type)) {
                  $type = $this->determineType($value);
      Severity: Minor
      Found in src/lib360/db/value/Value.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

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

          public function getConditionOperator(IDriver $driver, ICondition $condition)
          {
              switch ($condition->operator) {
                  case Condition::OPERATOR_EQUALS:
                      if ($condition->value2->getType() == Value::TYPE_NULL) {
      Severity: Minor
      Found in src/lib360/db/language/SQL.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 getConditionOperator has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getConditionOperator(IDriver $driver, ICondition $condition)
          {
              switch ($condition->operator) {
                  case Condition::OPERATOR_EQUALS:
                      if ($condition->value2->getType() == Value::TYPE_NULL) {
      Severity: Minor
      Found in src/lib360/db/language/SQL.php - About 1 hr to fix

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

            public function getValue(IDriver $driver, IValue $value)
            {
                $query = new Query();
                switch ($value->getType()) {
                    case Value::TYPE_PREPARED:
        Severity: Minor
        Found in src/lib360/db/language/SQL.php - About 1 hr to fix

          Method handleRequest has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function handleRequest(api\Request $request)
              {
                  $response = new api\Response();
                  try {
                      // map request to class and method
          Severity: Minor
          Found in src/lib360/api/router/Rest.php - About 1 hr to fix

            Method getJoin has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getJoin(IDriver $driver, IJoin $join)
                {
                    $query = new Query();
                    $query->setString($driver->tableQuoteStart . $join->tableBase . $driver->tableQuoteEnd);
                    foreach ($join->tableJoin as $i => $table) {
            Severity: Minor
            Found in src/lib360/db/language/SQL.php - About 1 hr to fix

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

                  public function bindValues(\PDOStatement $sth, array $values = null)
                  {
                      if (!is_null($values)) {
                          foreach ($values as $key => $value) {
                              $type = \PDO::PARAM_STR;
              Severity: Minor
              Found in src/lib360/db/executor/PDO.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 getCondition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getCondition(array $conditions) {
                      $conditionGroup = null;
                      if (count($conditions) == 1) {
                          foreach ($conditions as $column => $value) {
                              $conditionGroup = new Condition(
              Severity: Minor
              Found in src/lib360/db/data/Table.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 sendResponse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function sendResponse(api\Response $response)
                  {
                      $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ?
                          $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
                      $body = null;
              Severity: Minor
              Found in src/lib360/api/request/handler/Rest.php - About 1 hr to fix

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

                    public static function get($type, $name)
                    {
                        if (isset(self::$objects[$type]) && isset(self::$objects[$type][$name])) {
                            $object = self::$objects[$type][$name];
                        } else {
                Severity: Minor
                Found in src/lib360/db/object/Factory.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 getValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getValue(IDriver $driver, IValue $value)
                    {
                        $query = new Query();
                        switch ($value->getType()) {
                            case Value::TYPE_PREPARED:
                Severity: Minor
                Found in src/lib360/db/language/SQL.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 getSelectFromView has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getSelectFromView(IDriver $driver, IView $storage)
                    {
                        $query = new Query();
                        $i = 0;
                        foreach ($storage->joins as $key => $join) {
                Severity: Minor
                Found in src/lib360/db/language/SQL.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        $dsn,
                        $username = null,
                        $password = null,
                        array $options = null,
                        $driver = null
                Severity: Minor
                Found in src/lib360/db/connection/Config.php - About 35 mins to fix

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

                      protected function __construct()
                      {
                          if (!isset(static::$table)) {
                              // Set table instance to class
                              $this->setTable();
                  Severity: Minor
                  Found in src/lib360/db/data/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 getJoin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getJoin(IDriver $driver, IJoin $join)
                      {
                          $query = new Query();
                          $query->setString($driver->tableQuoteStart . $join->tableBase . $driver->tableQuoteEnd);
                          foreach ($join->tableJoin as $i => $table) {
                  Severity: Minor
                  Found in src/lib360/db/language/SQL.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 determineType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function determineType($value) {
                          $type = null;
                          if (is_array($value)) {
                              $type = self::TYPE_ARRAY;
                          } elseif (is_bool($value)) {
                  Severity: Minor
                  Found in src/lib360/db/value/Value.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 handleRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handleRequest(api\Request $request)
                      {
                          $response = new api\Response();
                          try {
                              // map request to class and method
                  Severity: Minor
                  Found in src/lib360/api/router/Rest.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 getRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getRequest()
                      {
                          $request = new api\Request();
                          if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
                              $request->parts = explode('/', $_SERVER['REQUEST_URI']);
                  Severity: Minor
                  Found in src/lib360/api/request/handler/Rest.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