bcit-ci/CodeIgniter

View on GitHub

Showing 728 of 865 total issues

Method field_data has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function field_data($table)
    {
        if (strpos($table, '.') !== FALSE)
        {
            sscanf($table, '%[^.].%s', $owner, $table);
Severity: Minor
Found in system/database/drivers/oci8/oci8_driver.php - About 1 hr to fix

    Method field_data has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function field_data($table)
        {
            if (strpos($table, '.') !== FALSE)
            {
                sscanf($table, '%[^.].%s', $owner, $table);
    Severity: Minor
    Found in system/database/drivers/pdo/subdrivers/pdo_oci_driver.php - About 1 hr to fix

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

          public function __construct($params)
          {
              parent::__construct($params);
      
              if (empty($this->dsn))
      Severity: Minor
      Found in system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php - About 1 hr to fix

        Method site_url has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function site_url($uri = '', $protocol = NULL)
            {
                $base_url = $this->slash_item('base_url');
        
                if (isset($protocol))
        Severity: Minor
        Found in system/core/Config.php - About 1 hr to fix

          Method write has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function write($session_id, $session_data)
              {
                  // If the two IDs don't match, we have a session_regenerate_id() call
                  // and we need to close the old handle and open a new one
                  if ($session_id !== $this->_session_id && ($this->close() === $this->_failure OR $this->read($session_id) === $this->_failure))
          Severity: Minor
          Found in system/libraries/Session/drivers/Session_files_driver.php - About 1 hr to fix

            Method date_range has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function date_range($unix_start = '', $mixed = '', $is_unix = TRUE, $format = 'Y-m-d')
                {
                    if ($unix_start == '' OR $mixed == '' OR $format == '')
                    {
                        return FALSE;
            Severity: Minor
            Found in system/helpers/date_helper.php - About 1 hr to fix

              Method create_table has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function create_table($table, $if_not_exists = FALSE, array $attributes = array())
                  {
                      if ($table === '')
                      {
                          show_error('A table name is required for that operation.');
              Severity: Minor
              Found in system/database/DB_forge.php - About 1 hr to fix

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

                    public function __construct($params)
                    {
                        parent::__construct($params);
                
                        if (empty($this->dsn))
                Severity: Minor
                Found in system/database/drivers/pdo/subdrivers/pdo_informix_driver.php - About 1 hr to fix

                  Method load_class has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function &load_class($class, $directory = 'libraries', $param = NULL)
                      {
                          static $_classes = array();
                  
                          // Does the class exist? If so, we're done...
                  Severity: Minor
                  Found in system/core/Common.php - About 1 hr to fix

                    Method open has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function open($save_path, $name)
                        {
                            $this->_memcached = new Memcached();
                            $this->_memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, TRUE); // required for touch() usage
                            $server_list = array();
                    Severity: Minor
                    Found in system/libraries/Session/drivers/Session_memcached_driver.php - About 1 hr to fix

                      Method _get_lock has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function _get_lock($session_id)
                          {
                              // PHP 7 reuses the SessionHandler object on regeneration,
                              // so we need to check here if the lock key is for the
                              // correct session ID.
                      Severity: Minor
                      Found in system/libraries/Session/drivers/Session_memcached_driver.php - About 1 hr to fix

                        Method open has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function open($save_path, $name)
                            {
                                if (empty($this->_config['save_path']))
                                {
                                    return $this->_failure;
                        Severity: Minor
                        Found in system/libraries/Session/drivers/Session_redis_driver.php - About 1 hr to fix

                          Method word_is_countable has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function word_is_countable($word)
                              {
                                  return ! in_array(
                                      strtolower($word),
                                      array(
                          Severity: Minor
                          Found in system/helpers/inflector_helper.php - About 1 hr to fix

                            Method plural has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function plural($str)
                                {
                                    $result = strval($str);
                            
                                    if ( ! word_is_countable($result))
                            Severity: Minor
                            Found in system/helpers/inflector_helper.php - About 1 hr to fix

                              Method _alter_table has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function _alter_table($alter_type, $table, $field)
                                  {
                                      if (in_array($alter_type, array('DROP', 'ADD'), TRUE))
                                      {
                                          return parent::_alter_table($alter_type, $table, $field);
                              Severity: Minor
                              Found in system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php - About 1 hr to fix

                                Method _alter_table has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function _alter_table($alter_type, $table, $field)
                                    {
                                        if (in_array($alter_type, array('DROP', 'ADD'), TRUE))
                                        {
                                            return parent::_alter_table($alter_type, $table, $field);
                                Severity: Minor
                                Found in system/database/drivers/ibase/ibase_forge.php - About 1 hr to fix

                                  Method custom_result_object has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function custom_result_object($class_name)
                                      {
                                          if (isset($this->custom_result_object[$class_name]))
                                          {
                                              return $this->custom_result_object[$class_name];
                                  Severity: Minor
                                  Found in system/database/DB_result.php - About 1 hr to fix

                                    Method csrf_set_cookie has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function csrf_set_cookie()
                                        {
                                            $expire = time() + $this->_csrf_expire;
                                            $secure_cookie = (bool) config_item('cookie_secure');
                                    
                                    
                                    Severity: Minor
                                    Found in system/core/Security.php - About 1 hr to fix

                                      Function decorate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function decorate($parent)
                                          {
                                              $this->_parent = $parent;
                                      
                                              // Lock down attributes to what is defined in the class
                                      Severity: Minor
                                      Found in system/libraries/Driver.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 read_dir has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL)
                                          {
                                              $path = rtrim($path, '/\\').DIRECTORY_SEPARATOR;
                                              if ( ! $fp = @opendir($path))
                                              {
                                      Severity: Minor
                                      Found in system/libraries/Zip.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language