includes/mail/UserMailer.php
Method sendInternal
has 145 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected static function sendInternal(
array $to,
MailAddress $from,
$subject,
$body,
Function sendInternal
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
Open
protected static function sendInternal(
array $to,
MailAddress $from,
$subject,
$body,
- 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
File UserMailer.php
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Function send
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function send( $to, $from, $subject, $body, $options = [] ) {
$services = MediaWikiServices::getInstance();
$allowHTMLEmail = $services->getMainConfig()->get(
MainConfigNames::AllowHTMLEmail );
- 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 send
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function send( $to, $from, $subject, $body, $options = [] ) {
$services = MediaWikiServices::getInstance();
$allowHTMLEmail = $services->getMainConfig()->get(
MainConfigNames::AllowHTMLEmail );
Consider simplifying this complex logical expression. Open
Open
if (
!(
!is_array( $body ) &&
strlen( $body ) >= $minBodyLen
)
Method send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function send( $to, $from, $subject, $body, $options = [] ) {
Method sendInternal
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
array $to,
MailAddress $from,
$subject,
$body,
$options = []
Avoid too many return
statements within this method. Open
Open
return Status::newFatal( 'php-mail-error', self::$mErrorString );
Avoid too many return
statements within this method. Open
Open
return Status::newGood();
Avoid too many return
statements within this method. Open
Open
return Status::newFatal( 'pear-mail-error', $mail_object->getMessage() );
Avoid too many return
statements within this method. Open
Open
return Status::newGood();
Avoid too many return
statements within this method. Open
Open
return Status::newFatal( 'php-mail-error-unknown' );
Avoid too many return
statements within this method. Open
Open
return $status;
Avoid too many return
statements within this method. Open
Open
return Status::newGood();
Avoid too many return
statements within this method. Open
Open
return Status::newFatal( 'php-mail-error', $ret );