AppStateESS/homestead

View on GitHub
class/UI/Notification.php

Summary

Maintainability
D
1 day
Test Coverage

Function send_emails has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    public function send_emails()
    {
        if(empty($_REQUEST['subject'])){
            return Notification::show_edit_email('You must fill in the subject line of the email.', '', $_REQUEST['body']);
        } else if(empty($_REQUEST['body'])){
Severity: Minor
Found in class/UI/Notification.php - About 5 hrs 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 show_select_hall has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function show_select_hall()
    {
        /*
        if(!\Current_User::allow('hms', 'email_hall')){
             return \PHPWS_Template::process($tpl, 'hms', 'admin/permission_denied.tpl');
Severity: Minor
Found in class/UI/Notification.php - About 2 hrs 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 send_emails has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function send_emails()
    {
        if(empty($_REQUEST['subject'])){
            return Notification::show_edit_email('You must fill in the subject line of the email.', '', $_REQUEST['body']);
        } else if(empty($_REQUEST['body'])){
Severity: Major
Found in class/UI/Notification.php - About 2 hrs to fix

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

    public function show_review_email()
    {
        $tpl = array();
        if(is_array($_REQUEST['hall'])){
            foreach($_REQUEST['hall'] as $hall){
Severity: Minor
Found in class/UI/Notification.php - About 1 hr to fix

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

    public function show_select_hall()
    {
        /*
        if(!\Current_User::allow('hms', 'email_hall')){
             return \PHPWS_Template::process($tpl, 'hms', 'admin/permission_denied.tpl');
Severity: Minor
Found in class/UI/Notification.php - About 1 hr to fix

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

    public function show_review_email()
    {
        $tpl = array();
        if(is_array($_REQUEST['hall'])){
            foreach($_REQUEST['hall'] as $hall){
Severity: Minor
Found in class/UI/Notification.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

Avoid too many return statements within this method.
Open

                return Notification::show_confirmation();
Severity: Major
Found in class/UI/Notification.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return '<h1>Unkown Op</h1>';
Severity: Major
Found in class/UI/Notification.php - About 30 mins to fix

There are no issues that match your filters.

Category
Status