Function sendNotifications
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function sendNotifications(int $userID = 0)
{
global $gSettingsManager, $gL10n, $gCurrentUser;
if ($gSettingsManager->has('system_notifications_profile_changes')
- 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 sendNotifications
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendNotifications(int $userID = 0)
{
global $gSettingsManager, $gL10n, $gCurrentUser;
if ($gSettingsManager->has('system_notifications_profile_changes')
File ChangeNotification.php
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use Admidio\Exception;
/**
* @brief Object to collect change notifications and optionally send a message to the administrator
Function logUserDeletion
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function logUserDeletion(int $userID, User $user = null)
{
global $gProfileFields, $gL10n, $gDb;
// If user wasn't yet created in the DB, no need to log anything
- 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 logUserDeletion
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function logUserDeletion(int $userID, User $user = null)
{
global $gProfileFields, $gL10n, $gDb;
// If user wasn't yet created in the DB, no need to log anything
Function logUserCreation
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function logUserCreation(int $userID, User $user = null)
{
global $gProfileFields, $gDb;
// If user was never created in the DB, no need to log
- 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 logProfileChange
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
public function logProfileChange(int $userID, int $fieldId, string $fieldName, string $old_value, string $new_value, string $old_value_db = '', string $new_value_db = '', $user = null, bool $deleting = false)
Method logUserCreation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function logUserCreation(int $userID, User $user = null)
{
global $gProfileFields, $gDb;
// If user was never created in the DB, no need to log
Method logRoleChange
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function logRoleChange(int $userID, string $roleName, string $fieldName, string $old_value, string $new_value, User $user = null, bool $deleting = false)
{
global $gSettingsManager, $gL10n;
// Don't log anything if no User ID is set yet (e.g. user not yet saved to the database!)
if ($userID == 0) {
Function logRoleChange
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function logRoleChange(int $userID, string $roleName, string $fieldName, string $old_value, string $new_value, User $user = null, bool $deleting = false)
{
global $gSettingsManager, $gL10n;
// Don't log anything if no User ID is set yet (e.g. user not yet saved to the database!)
if ($userID == 0) {
- 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 logRoleChange
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function logRoleChange(int $userID, string $roleName, string $fieldName, string $old_value, string $new_value, User $user = null, bool $deleting = false)
Method logUserChange
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function logUserChange(int $userID, string $fieldName, string $old_value, string $new_value, User $user = null)
Function logUserChange
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function logUserChange(int $userID, string $fieldName, string $old_value, string $new_value, User $user = null)
{
global $gSettingsManager, $gL10n;
// 1. Create a database log entry if so configured
- 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"