phplib/Notification.php
Method render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;";
Method mail
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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();
Method sendRollupEmail
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function sendRollupEmail($to, $new_alerts, $actions, $searches, $action_alerts, $active_alerts, $content_only=false, $debug_data=[]) {
Method sendSummaryEmail
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function sendSummaryEmail($to, $start_date, $stats, $leaders, $noisy_searches, $quiet_searches, $debug_data=[]) {
Method sendAlertActionEmail
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function sendAlertActionEmail($to, $action, $searches, $alerts, $content_only=false, $debug_data=[]) {
Function sendAlertEmail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function sendAlertEmail($to, $search, $alerts, $content_only, $debug_data=[]) {
$alertkeys = [];
$long = false;
foreach($alerts as $alert) {
if(count($alert['content']) >= 10) {
- 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 sendAlertEmail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function sendAlertEmail($to, $search, $alerts, $content_only, $debug_data=[]) {
Method mail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function mail($to, $from, $title, $message, $file=null) {
Function groupAlerts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
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']] = [[], []];
- 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"