Function generate_certificate
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function generate_certificate( $domain, $addon_domains = array(), $dn_args = array() ) {
$account_keypair = AccountKeyPair::get();
$account_key_details = $account_keypair->get_private_details();
if ( is_wp_error( $account_key_details ) ) {
- 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_certificate
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generate_certificate( $domain, $addon_domains = array(), $dn_args = array() ) {
$account_keypair = AccountKeyPair::get();
$account_key_details = $account_keypair->get_private_details();
if ( is_wp_error( $account_key_details ) ) {
Function reset
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function reset() {
$filesystem = Util::get_filesystem();
$paths = array(
Util::get_letsencrypt_certificates_dir_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
Function register_account
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function register_account() {
$account_keypair = AccountKeyPair::get();
if ( ! $account_keypair->exists() ) {
$status = $account_keypair->generate();
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
Function parse_wp_error
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function parse_wp_error( $response, $code = false, $message = false, $data = '' ) {
if ( ! $code ) {
$code = 'letsencrypt_error';
}
- 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 revoke_certificate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function revoke_certificate( $domain ) {
$certificate = Certificate::get( $domain );
if ( ! $certificate->exists() ) {
return new WP_Error( 'cert_not_exist', sprintf( __( 'The certificate <code>%s</code> does not exist.', 'wp-encrypt' ), $domain_path . '/cert.pem' ) );
}
- 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
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $status;
Avoid too many return
statements within this method. Open
return $this->parse_wp_error( $result, 'new_cert_invalid_response_code', __( 'Invalid response code for new certificate request.', 'wp-encrypt' ) );
Avoid too many return
statements within this method. Open
return $csr;
Avoid too many return
statements within this method. Open
return new WP_Error( 'new_cert_fail', __( 'No certificates generated.', 'wp-encrypt' ) );
Avoid too many return
statements within this method. Open
return array(
'domains' => $all_domains,
);
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $this->parse_wp_error( $result, 'new_cert_invalid_response_code', __( 'Invalid response code for new certificate request.', 'wp-encrypt' ) );