phplib/Notification.php

Summary

Maintainability
C
7 hrs
Test Coverage

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

    public static function render($tpl, $vars, $debug_data=[]) {
        $site = SiteFinder::getCurrent();

        // Embedded CSS. This is unfortunately necessary as most (all?) mail clients only allow inline CSS.
        $font = "font-family: 'Myriad Pro','Helvetica Neue',Helvetica,Tahoma,Arial,sans-serif;";
Severity: Minor
Found in phplib/Notification.php - About 1 hr to fix

    Method mail has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function mail($to, $from, $title, $message, $file=null) {
            list($to, $from, $title, $message, $file) = Hook::call('mail', [$to, $from, $title, $message, $file]);
            $to = (array) $to;
    
            $bnd = uniqid();
    Severity: Minor
    Found in phplib/Notification.php - About 1 hr to fix

      Method sendRollupEmail has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function sendRollupEmail($to, $new_alerts, $actions, $searches, $action_alerts, $active_alerts, $content_only=false, $debug_data=[]) {
      Severity: Major
      Found in phplib/Notification.php - About 1 hr to fix

        Method sendSummaryEmail has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function sendSummaryEmail($to, $start_date, $stats, $leaders, $noisy_searches, $quiet_searches, $debug_data=[]) {
        Severity: Major
        Found in phplib/Notification.php - About 50 mins to fix

          Method sendAlertActionEmail has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function sendAlertActionEmail($to, $action, $searches, $alerts, $content_only=false, $debug_data=[]) {
          Severity: Minor
          Found in phplib/Notification.php - About 45 mins to fix

            Function sendAlertEmail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function sendAlertEmail($to, $search, $alerts, $content_only, $debug_data=[]) {
                    $alertkeys = [];
                    $long = false;
                    foreach($alerts as $alert) {
                        if(count($alert['content']) >= 10) {
            Severity: Minor
            Found in phplib/Notification.php - About 45 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

            Method sendAlertEmail has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function sendAlertEmail($to, $search, $alerts, $content_only, $debug_data=[]) {
            Severity: Minor
            Found in phplib/Notification.php - About 35 mins to fix

              Method mail has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function mail($to, $from, $title, $message, $file=null) {
              Severity: Minor
              Found in phplib/Notification.php - About 35 mins to fix

                Function groupAlerts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function groupAlerts($search_map, array $alerts) {
                        $groups = [];
                        foreach($alerts as $alert) {
                            if(!array_key_exists($alert['search_id'], $groups)) {
                                $groups[$alert['search_id']] = [[], []];
                Severity: Minor
                Found in phplib/Notification.php - About 25 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

                There are no issues that match your filters.

                Category
                Status