felixarntz/wp-encrypt

View on GitHub

Showing 86 of 92 total issues

Function maybe_request_filesystem_credentials has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        protected function maybe_request_filesystem_credentials( $network_wide = false ) {
            if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
                $credentials = array();

                $fields = array( 'hostname', 'port', 'username', 'password', 'public_key', 'private_key', 'connection_type' );
Severity: Minor
Found in inc/WPENC/ActionHandler.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 setup_filesystem has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public static function setup_filesystem( $form_post, $extra_fields = array() ) {
            global $wp_filesystem;

            $paths = self::get_filesystem_paths();
            $type = 'direct';
Severity: Minor
Found in inc/WPENC/Core/Util.php - About 1 hr to fix

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

            public static function get_network_addon_domains( $network_id = null, $global = false ) {
                if ( version_compare( get_bloginfo( 'version' ), '4.6', '<' ) ) {
                    if ( ! $network_id ) {
                        $network = get_current_site();
                    } else {
    Severity: Minor
    Found in inc/WPENC/Util.php - About 1 hr to fix

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

              protected function handle_request( $mode = 'admin' ) {
                  $ajax = false;
                  $prefix = 'admin_action_wpenc_';
                  $args = $_REQUEST;
      
      
      Severity: Minor
      Found in inc/WPENC/ActionHandler.php - About 1 hr to fix

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

                public static function get_network_site_ids( $global = false ) {
                    $ids = array();
        
                    if ( version_compare( get_bloginfo( 'version' ), '4.6', '<' ) ) {
                        $args = array();
        Severity: Minor
        Found in inc/WPENC/Util.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 generate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function generate() {
                    $filesystem = Util::get_filesystem();
        
                    $status = Util::maybe_create_letsencrypt_certificates_dir();
                    if ( is_wp_error( $status ) ) {
        Severity: Minor
        Found in inc/WPENC/Core/KeyPair.php - About 1 hr to fix

          Method render_apache_instructions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  protected function render_apache_instructions( $site_domain, $site_dir, $certificate_dirs ) {
                      $config = '<VirtualHost 192.168.0.1:443>
          DocumentRoot ' . untrailingslashit( $site_dir ) . '
          ServerName ' . $site_domain . '
          SSLEngine on
          Severity: Minor
          Found in inc/WPENC/Admin.php - About 1 hr to fix

            Function validate_settings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function validate_settings( $options = array() ) {
                        $options = array_map( 'strip_tags', array_map( 'trim', $options ) );
            
                        if ( isset( $options['country_code'] ) ) {
                            $options['country_code'] = strtoupper( substr( $options['country_code'], 0, 2 ) );
            Severity: Minor
            Found in inc/WPENC/Admin.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 maybe_show_expire_warning has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function maybe_show_expire_warning() {
                        if ( ! Util::get_option( 'show_warning' ) ) {
                            return;
                        }
            
            
            Severity: Minor
            Found in inc/WPENC/Admin.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 get_option has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public static function get_option( $field ) {
                        $options = get_site_option( 'wp_encrypt_settings', array() );
                        if ( ! isset( $options[ $field ] ) ) {
                            switch ( $field ) {
                                case 'organization':
            Severity: Minor
            Found in inc/WPENC/Util.php - About 1 hr to fix

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

                      public function maybe_show_expire_warning() {
                          if ( ! Util::get_option( 'show_warning' ) ) {
                              return;
                          }
              
              
              Severity: Minor
              Found in inc/WPENC/Admin.php - About 1 hr to fix

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

                        public function render_help_getting_started() {
                            ?>
                            <p><?php _e( 'To obtain your first SSL certificate, follow these steps:', 'wp-encrypt' ); ?></p>
                
                            <ol>
                Severity: Minor
                Found in inc/WPENC/Admin.php - About 1 hr to fix

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

                          public function generate_csr( $key_resource, $domains, $dn = array() ) {
                              $filesystem = Util::get_filesystem();
                  
                              $status = Util::maybe_create_letsencrypt_certificates_dir();
                              if ( is_wp_error( $status ) ) {
                  Severity: Minor
                  Found in inc/WPENC/Core/Certificate.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 request has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public function request( $endpoint, $method = 'GET', $data = null ) {
                              if ( is_array( $data ) ) {
                                  $data = json_encode( $data );
                              }
                  
                  
                  Severity: Minor
                  Found in inc/WPENC/Core/Client.php - About 1 hr to fix

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

                            protected function render_nginx_instructions( $site_domain, $site_dir, $certificate_dirs ) {
                                $config = 'server {
                    
                        listen   443;
                    
                    
                    Severity: Minor
                    Found in inc/WPENC/Admin.php - About 1 hr to fix

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

                              public function update_network_option() {
                                  if ( ! isset( $_POST['option_page'] ) || ! isset( $_POST['action'] ) || 'update' !== $_POST['action'] ) {
                                      return;
                                  }
                      
                      
                      Severity: Minor
                      Found in inc/WPENC/NetworkSettingsAPI.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 check_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                              protected function check_request( $action, $mode = 'admin', $args = array() ) {
                                  if ( ! isset( $args['_wpnonce'] ) ) {
                                      return new WP_Error( 'nonce_missing', __( 'Missing nonce.', 'wp-encrypt' ) );
                                  }
                      
                      
                      Severity: Minor
                      Found in inc/WPENC/ActionHandler.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 read_private has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function read_private( $force_refresh = false ) {
                                  $filesystem = Util::get_filesystem();
                      
                                  if ( null === $this->private_key_resource || $force_refresh ) {
                                      $path = $this->path . '/' . self::PRIVATE_NAME;
                      Severity: Minor
                      Found in inc/WPENC/Core/KeyPair.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 get_private_details has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function get_private_details( $force_refresh = false ) {
                                  if ( null === $this->private_key_details || $force_refresh ) {
                                      $private_key = $this->read_private();
                                      if ( is_wp_error( $private_key ) ) {
                                          return $private_key;
                      Severity: Minor
                      Found in inc/WPENC/Core/KeyPair.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 register_account has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                              protected function register_account( $data = array(), $network_wide = false ) {
                                  $filesystem_check = $this->maybe_request_filesystem_credentials( $network_wide );
                                  if ( false === $filesystem_check ) {
                                      return new WP_Error( 'invalid_filesystem_credentials', __( 'Invalid or missing filesystem credentials.', 'wp-encrypt' ), 'error' );
                                  }
                      Severity: Minor
                      Found in inc/WPENC/ActionHandler.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