Showing 86 of 92 total issues
Function needs_filesystem_credentials
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function needs_filesystem_credentials( $credentials = false ) {
$paths = self::get_filesystem_paths();
$type = 'direct';
$is_direct = true;
foreach ( $paths as $key => $path ) {
- Read upRead up
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';
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 {
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;
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();
- Read upRead up
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 ) ) {
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
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 ) );
- Read upRead up
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;
}
- Read upRead up
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 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>
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':
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;
}
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 ) ) {
- Read upRead up
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 );
}
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;
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;
- Read upRead up
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 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;
}
- Read upRead up
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;
- Read upRead up
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' ) );
}
- Read upRead up
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 generate_certificate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function generate_certificate( $data = array(), $network_wide = false ) {
if ( ! Util::can_generate_certificate() ) {
return new WP_Error( 'domain_cannot_sign', __( 'Domain cannot be signed. Either the account is not registered yet or the settings are not valid.', 'wp-encrypt' ) );
}
- Read upRead up
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"