CORE-POS/Common-Bundle

View on GitHub

Showing 84 of 1,039 total issues

Method fieldType has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function fieldType($result_object,$index,$which_connection='')
    {
        if ($which_connection == '') {
            $which_connection = $this->default_db;
        }
Severity: Minor
Found in src/SQLManager.php - About 1 hr to fix

    Method addConnection has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function addConnection($server,$type,$database,$username,$password='',$persistent=false,$new=false)
        {
            if (empty($type)) {
                return false;
            } elseif (strtolower($type) == 'postgres9') {
    Severity: Minor
    Found in src/SQLManager.php - About 1 hr to fix

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

          private function normalizeRename($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
          {
              $current = $this->connection->detailedDefinition($this->name);
              $recase_columns = array();
              foreach ($this->columns as $col_name => $definition) {
      Severity: Minor
      Found in src/BasicModel.php - About 1 hr to fix

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

            public function readRoutes()
            {
                // routes begin with method
                $this->__method = $this->detectMethod();
        
        
        Severity: Minor
        Found in src/ui/CoreRESTfulRouter.php - About 1 hr to fix

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

              public function addConnection($server,$type,$database,$username,$password='',$persistent=false,$new=false)
              {
                  if (empty($type)) {
                      return false;
                  } elseif (strtolower($type) == 'postgres9') {
          Severity: Minor
          Found in src/SQLManager.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 writeLog has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function writeLog($message, array $context, $intLevel)
              {
                  $file = $this->getLogLocation($intLevel);
                  $verboseDebug = $this->verboseDebugging();
          
          
          Severity: Minor
          Found in src/BaseLogger.php - About 1 hr to fix

            Method arrayToSQL has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function arrayToSQL($definition, $dbms)
                {
                    $sql = '';
                    $type = $definition['type'];
                    if (isset($this->meta_types[strtoupper($type)])) {
            Severity: Minor
            Found in src/BasicModel.php - About 1 hr to fix

              Method log has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public function log($level, $message, array $context = array())
                      {
                          switch ($this->normalizeLevel($level)) {
                              case \Psr\Log\LogLevel::EMERGENCY:
                                  $this->emergency($message, $context);
              Severity: Minor
              Found in src/Logger.php - About 1 hr to fix

                Method log has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function log($level, $message, array $context = array())
                        {
                            switch ($this->normalizeLevel($level)) {
                                case 'emergency':
                                    $this->emergency($message, $context);
                Severity: Minor
                Found in src/Logger.php - About 1 hr to fix

                  Method toOptions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function toOptions($selected=0, $id_as_label=false)
                      {
                          if (count($this->unique) != 1) {
                              return '';
                          }
                  Severity: Minor
                  Found in src/BasicModel.php - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (($argc < 3 || $argc > 4) || ($argc == 3 && $argv[1] != "--new" && $argv[1] != '--new-view') || ($argc == 4 && $argv[1] != '--update')) {
                                echo "Create new Model: php BasicModel.php --new <Model Name>\n";
                                echo "Create new View Model: php BasicModel.php --new-view <Model Name>\n";
                                echo "Update Table Structure: php BasicModel.php --update <Database name> <Subclass Filename>\n";
                                echo "Generate markdown documentation: php BasicModel.php --doc <Model Filename(s)>\n";
                    Severity: Major
                    Found in src/BasicModel.php - About 1 hr to fix

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

                          static public function getDrivers()
                          {
                              $ret = array();
                              if (extension_loaded('mysqli')) {
                                  $ret['MYSQLI'] = 'MySQLi';
                      Severity: Minor
                      Found in src/sql/Lib.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 log has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function log($level, $message, array $context = array())
                              {
                                  switch ($this->normalizeLevel($level)) {
                                      case \Psr\Log\LogLevel::EMERGENCY:
                                          $this->emergency($message, $context);
                      Severity: Minor
                      Found in src/Logger.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 log has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function log($level, $message, array $context = array())
                              {
                                  switch ($this->normalizeLevel($level)) {
                                      case 'emergency':
                                          $this->emergency($message, $context);
                      Severity: Minor
                      Found in src/Logger.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 columnsDoc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function columnsDoc()
                          {
                              $ret = str_pad('Name', 25, ' ') . '|' . str_pad('Type', 15, ' ') . '|Info' . "\n";
                              $ret .= str_repeat('-', 25) . '|' . str_repeat('-', 15) . '|' . str_repeat('-', 10) . "\n";
                              foreach ($this->columns as $name => $info) {
                      Severity: Minor
                      Found in src/BasicModel.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 toOptions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function toOptions($selected=0, $id_as_label=false)
                          {
                              if (count($this->unique) != 1) {
                                  return '';
                              }
                      Severity: Minor
                      Found in src/BasicModel.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

                      Method addConnection has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function addConnection($server,$type,$database,$username,$password='',$persistent=false,$new=false)
                      Severity: Major
                      Found in src/SQLManager.php - About 50 mins to fix

                        Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function __construct($server,$type,$database,$username,$password='',$persistent=false, $new=false)
                        Severity: Major
                        Found in src/SQLManager.php - About 50 mins to fix

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

                              private function normalizeReplacePK($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
                              {
                                  $current = $this->connection->detailedDefinition($this->name);
                                  echo ($mode==BasicModel::NORMALIZE_MODE_CHECK)?"Need to set primary key":"Setting primary key";
                                  $sql = 'ALTER TABLE ' . $this->connection->identifierEscape($this->name);
                          Severity: Minor
                          Found in src/BasicModel.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 columnToArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function columnToArray($col)
                              {
                                  $info = array();
                                  $type = strtoupper($col->type);
                                  if (property_exists($col, 'max_length') && $col->max_length != -1 && substr($type, -3) != 'INT') {
                          Severity: Minor
                          Found in src/SQLManager.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

                          Severity
                          Category
                          Status
                          Source
                          Language