File HMS_Email.php
has 686 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Homestead;
use \Michelf\Markdown;
- Create a ticketCreate a ticket
HMS_Email
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
class HMS_Email{
public static function get_tech_contacts()
{
$contacts = array();
- Create a ticketCreate a ticket
Method send_email
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function send_email($to, $from, $subject, $content, $cc = NULL, $bcc = NULL)
{
// Sanity checking
if(!isset($to) || is_null($to)){
return false;
- Create a ticketCreate a ticket
Method sendRoomChangeCancelledNotice
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendRoomChangeCancelledNotice(RoomChangeRequest $r, Student $canceller = null)
{
$subject = 'Room Change Cancelled';
$template = 'email/roomChangeCancelledNotice.tpl';
- Create a ticketCreate a ticket
Function send_email
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function send_email($to, $from, $subject, $content, $cc = NULL, $bcc = NULL)
{
// Sanity checking
if(!isset($to) || is_null($to)){
return false;
- Read upRead up
- Create a ticketCreate a ticket
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 sendRoomChangeDeniedNotice
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendRoomChangeDeniedNotice(RoomChangeRequest $r)
{
$subject = 'Room Change Denied';
$template = 'email/roomChangeDeniedNotice.tpl';
- Create a ticketCreate a ticket
Method sendRoomChangeInProcessNotice
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendRoomChangeInProcessNotice(RoomChangeRequest $r)
{
$subject = 'Room Change Approved!';
$template = 'email/roomChangeApprovalNotice.tpl';
- Create a ticketCreate a ticket
Method sendRoomChangeCurrRDNotice
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendRoomChangeCurrRDNotice(RoomChangeRequest $request)
{
$subject = 'Room Change Approval Required';
$template = 'email/roomChangeCurrRDNotice.tpl';
- Create a ticketCreate a ticket
Method sendRoomChangeParticipantNotice
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendRoomChangeParticipantNotice(RoomChangeParticipant $requestor, RoomChangeParticipant $requestee)
{
$subject = 'Room Change Requested';
$template = 'email/roomChangeParticipantNotice.tpl';
$term = Term::getCurrentTerm();
- Create a ticketCreate a ticket
Function sendRoomChangeCancelledNotice
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function sendRoomChangeCancelledNotice(RoomChangeRequest $r, Student $canceller = null)
{
$subject = 'Room Change Cancelled';
$template = 'email/roomChangeCancelledNotice.tpl';
- Read upRead up
- Create a ticketCreate a ticket
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_lottery_roommate_reminder
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function send_lottery_roommate_reminder(Student $student, $name, $expires_on, $requestor_name, $hall_room, $year)
- Create a ticketCreate a ticket
Method sendAssignmentNotice
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function sendAssignmentNotice(Student $student, $name, $term, $location, Array $roommates, $moveinTime){
- Create a ticketCreate a ticket
Method send_email
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function send_email($to, $from, $subject, $content, $cc = NULL, $bcc = NULL)
- Create a ticketCreate a ticket
Function sendRoomChangeDeniedNotice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function sendRoomChangeDeniedNotice(RoomChangeRequest $r)
{
$subject = 'Room Change Denied';
$template = 'email/roomChangeDeniedNotice.tpl';
- Read upRead up
- Create a ticketCreate a ticket
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 logSwiftmailMessageLong
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function logSwiftmailMessageLong(\Swift_Message $message)
{
$fd = fopen(PHPWS_SOURCE_DIR . 'logs/email.log', 'a');
fprintf($fd, "=======================\n");
- Read upRead up
- Create a ticketCreate a ticket
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_lottery_roommate_invite
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function send_lottery_roommate_invite(Student $student, Student $from, $expires_on, $hall_room, $year)
- Create a ticketCreate a ticket
Method sendDamageNotification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function sendDamageNotification(Student $student, $term, $billedAmount, $coordinatorName, $coordinatorEmail)
- Create a ticketCreate a ticket
Method sendTemplateMessage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function sendTemplateMessage(Student $student, string $messageType, string $subject, string $tpl, Array $tags)
- Create a ticketCreate a ticket
Function sendAssignmentNotice
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function sendAssignmentNotice(Student $student, $name, $term, $location, Array $roommates, $moveinTime){
$tpl = array();
$tpl['NAME'] = $name;
$tpl['TERM'] = Term::toString($term);
- Read upRead up
- Create a ticketCreate a ticket
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 log_email
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function log_email($message)
{
// Log the message to a text file
$fd = fopen(PHPWS_SOURCE_DIR . 'logs/email.log',"a");
fprintf($fd, "=======================\n");
- Read upRead up
- Create a ticketCreate a ticket
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 true;
- Create a ticketCreate a ticket
Function sendRoomChangeInProcessNotice
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function sendRoomChangeInProcessNotice(RoomChangeRequest $r)
{
$subject = 'Room Change Approved!';
$template = 'email/roomChangeApprovalNotice.tpl';
- Read upRead up
- Create a ticketCreate a ticket
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"