File TableMessage.php
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use Admidio\Exception;
/**
* @brief Class manages access to database table adm_messages
Function getRecipientsNamesString
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function getRecipientsNamesString(bool $showFullUserNames = true): string
{
global $gProfileFields, $gL10n;
$recipients = $this->readRecipientsData();
- 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
TableMessage
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class TableMessage extends TableAccess
{
public const MESSAGE_TYPE_EMAIL = 'EMAIL';
public const MESSAGE_TYPE_PM = 'PM';
Method readRecipientsData
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readRecipientsData(): array
{
global $gProfileFields;
if (count($this->msgRecipientsArray) === 0) {
Method getRecipientsNamesString
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRecipientsNamesString(bool $showFullUserNames = true): string
{
global $gProfileFields, $gL10n;
$recipients = $this->readRecipientsData();
Function getConversationPartner
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getConversationPartner()
{
if ($this->getValue('msg_type') === self::MESSAGE_TYPE_PM) {
if($this->msgConversationPartnerId === 0) {
$recipients = $this->readRecipientsData();
- 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
Function addUser
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addUser(int $userID, string $fullName = '')
{
// PM always update the recipient if the message exists
if ($this->getValue('msg_type') === self::MESSAGE_TYPE_PM) {
if (count($this->msgRecipientsObjectArray) === 1) {
- 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
Function readRecipientsData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function readRecipientsData(): array
{
global $gProfileFields;
if (count($this->msgRecipientsArray) === 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
Function save
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function save(bool $updateFingerPrint = true): bool
{
if ($this->newRecord) {
// Insert
$this->setValue('msg_timestamp', DATETIME_NOW);
- 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
Function saveAttachments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function saveAttachments()
{
global $gSettingsManager;
if ($gSettingsManager->getBool('mail_save_attachments')) {
- 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"