File ComponentUpdateSteps.php
has 866 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use Ramsey\Uuid\Uuid;
use Admidio\Exception;
// this must be declared for backwards compatibility. Can be removed if update scripts don't use it anymore
Function updateStep41CategoryReportMigration
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public static function updateStep41CategoryReportMigration()
{
global $gL10n, $gProfileFields;
$sql = 'SELECT org_id FROM ' . TBL_ORGANIZATIONS;
- 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
ComponentUpdateSteps
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
final class ComponentUpdateSteps
{
/**
* @var Database
*/
Method updateStep41CategoryReportMigration
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep41CategoryReportMigration()
{
global $gL10n, $gProfileFields;
$sql = 'SELECT org_id FROM ' . TBL_ORGANIZATIONS;
Method updateStep41PostgreSqlSetBoolean
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep41PostgreSqlSetBoolean()
{
$updateColumnsBoolean = array(
array('table' => TBL_CATEGORIES, 'column' => 'cat_system'),
array('table' => TBL_CATEGORIES, 'column' => 'cat_default'),
Method updateStep43AddSocialNetworkProfileFields
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep43AddSocialNetworkProfileFields()
{
global $gProfileFields;
$sql = 'SELECT cat_id FROM ' . TBL_CATEGORIES . ' WHERE cat_name_intern = \'SOCIAL_NETWORKS\' ';
Method updateStep33AddDefaultParticipantList
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep33AddDefaultParticipantList()
{
global $gL10n;
// read id of system user from database
Method updateStep32NewDownloadRootFolderName
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep32NewDownloadRootFolderName()
{
global $gLogger, $g_organization;
$sql = 'SELECT org_id, org_shortname FROM ' . TBL_ORGANIZATIONS;
Function updateStep41MigrateMessageRecipients
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function updateStep41MigrateMessageRecipients()
{
$sql = 'SELECT msg_id, msg_usr_id_receiver FROM ' . TBL_MESSAGES;
$messagesStatement = self::$db->queryPrepared($sql);
- 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 updateStep32NewDownloadRootFolderName
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function updateStep32NewDownloadRootFolderName()
{
global $gLogger, $g_organization;
$sql = 'SELECT org_id, org_shortname FROM ' . TBL_ORGANIZATIONS;
- 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 updateStep33EventCategory
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep33EventCategory()
{
global $g_organization, $gL10n;
$sql = 'SELECT org_id, org_shortname FROM ' . TBL_ORGANIZATIONS;
Method updateStep41AddUuid
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep41AddUuid()
{
$updateTablesUuid = array(
array('table' => TBL_ANNOUNCEMENTS, 'column_id' => 'ann_id', 'column_uuid' => 'ann_uuid'),
array('table' => TBL_CATEGORIES, 'column_id' => 'cat_id', 'column_uuid' => 'cat_uuid'),
Method updateStep32MigrateToFolderRights
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep32MigrateToFolderRights()
{
global $g_organization;
// migrate adm_folder_roles to adm_roles_rights
Method updateStep40RenameDownloadRootFolder
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep40RenameDownloadRootFolder()
{
global $gLogger;
$sql = 'SELECT org_id, org_shortname FROM ' . TBL_ORGANIZATIONS;
Method updateStep33MigrateDatesRightsToFolderRights
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep33MigrateDatesRightsToFolderRights()
{
// migrate adm_folder_roles to adm_roles_rights
$sql = 'SELECT ror_id
FROM ' . TBL_ROLES_RIGHTS . '
Method updateStep32AddAnnouncementsCategories
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateStep32AddAnnouncementsCategories()
{
global $gL10n;
// read id of system user from database
Function updateStep40RenameDownloadRootFolder
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function updateStep40RenameDownloadRootFolder()
{
global $gLogger;
$sql = 'SELECT org_id, org_shortname FROM ' . TBL_ORGANIZATIONS;
- 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 updateStep43AddSocialNetworkProfileFields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function updateStep43AddSocialNetworkProfileFields()
{
global $gProfileFields;
$sql = 'SELECT cat_id FROM ' . TBL_CATEGORIES . ' WHERE cat_name_intern = \'SOCIAL_NETWORKS\' ';
- 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 updateStep33DownloadOrgFolderName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function updateStep33DownloadOrgFolderName()
{
global $gLogger;
$sql = 'SELECT org_shortname FROM ' . TBL_ORGANIZATIONS;
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
$sql = 'INSERT INTO ' . TBL_MENU . '
(men_com_id, men_men_id_parent, men_node, men_order, men_standard, men_name_intern, men_url, men_icon, men_name, men_description)
VALUES (NULL, NULL, 1, 1, 1, \'modules\', NULL, \'\', \'SYS_MODULES\', \'\')
, (NULL, NULL, 1, 2, 1, \'administration\', NULL, \'\', \'SYS_ADMINISTRATION\', \'\')
, (NULL, NULL, 1, 3, 1, \'plugins\', NULL, \'\', \'SYS_PLUGINS\', \'\')
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 298.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
foreach ($updateTablesUuid as $tableUuid) {
$sql = 'SELECT ' . $tableUuid['column_id'] . '
FROM ' . $tableUuid['table'] . '
WHERE ' . $tableUuid['column_uuid'] . ' IS NULL ';
$statement = self::$db->queryPrepared($sql);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 160.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
foreach ($updateTablesUuid as $tableUuid) {
$sql = 'SELECT ' . $tableUuid['column_id'] . '
FROM ' . $tableUuid['table'] . '
WHERE ' . $tableUuid['column_uuid'] . ' IS NULL ';
$statement = self::$db->queryPrepared($sql);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 160.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (!array_key_exists('MASTODON', $profileFields)) {
$profileFieldInstagram = new TableUserField(self::$db);
$profileFieldInstagram->saveChangesWithoutRights();
$profileFieldInstagram->setValue('usf_cat_id',(int) $row['cat_id']);
$profileFieldInstagram->setValue('usf_type', 'TEXT');
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 136.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (!array_key_exists('LINKEDIN', $profileFields)) {
$profileFieldLinkedIn = new TableUserField(self::$db);
$profileFieldLinkedIn->saveChangesWithoutRights();
$profileFieldLinkedIn->setValue('usf_cat_id',(int) $row['cat_id']);
$profileFieldLinkedIn->setValue('usf_type', 'TEXT');
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 136.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (!array_key_exists('INSTAGRAM', $profileFields)) {
$profileFieldInstagram = new TableUserField(self::$db);
$profileFieldInstagram->saveChangesWithoutRights();
$profileFieldInstagram->setValue('usf_cat_id',(int) $row['cat_id']);
$profileFieldInstagram->setValue('usf_type', 'TEXT');
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 136.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function updateStep41AddSystemmailText()
{
global $gL10n;
$sql = 'SELECT org_id, org_shortname FROM ' . TBL_ORGANIZATIONS;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 117.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function updateStep43AddNewNotificationText()
{
global $gL10n;
$sql = 'SELECT org_id, org_shortname FROM ' . TBL_ORGANIZATIONS;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 117.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76