File Preferences.php
has 1892 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Admidio\UserInterface;
use ComponentUpdate;
use FileSystemUtils;
Method createEmailDispatchForm
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createEmailDispatchForm(): string
{
global $gL10n, $gCurrentOrganization, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createEventsForm
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createEventsForm(): string
{
global $gL10n, $gSettingsManager, $gDb, $gCurrentOrgId, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createPhotosForm
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createPhotosForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method initialize
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function initialize(): void
{
global $gL10n;
$this->accordionCommonPanels = array(
Method createCaptchaForm
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createCaptchaForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createMessagesForm
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createMessagesForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createCommonForm
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createCommonForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createSystemInformationForm
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSystemInformationForm(): string
{
global $gL10n, $gDb, $gLogger;
$this->assignSmartyVariable('operatingSystemName', SystemInfoUtils::getOS());
Method createGroupsRolesForm
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createGroupsRolesForm(): string
{
global $gL10n, $gSettingsManager, $gDb, $gCurrentOrgId, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createSystemNotificationsForm
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSystemNotificationsForm(): string
{
global $gL10n, $gDb, $gSettingsManager, $gCurrentOrgId, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Preferences
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Preferences extends HtmlPage
{
/**
* @var array Array with all possible accordion entries for the system preferences.
* Each accordion entry consists of an array that has the following structure:
Method show
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show()
{
if ($this->preferencesPanelToShow !== '') {
// open the modules tab if the options of a module should be shown
if (array_key_exists($this->preferencesPanelToShow, $this->accordionModulePanels)) {
Method createGuestbookForm
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createGuestbookForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createPHPForm
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createPHPForm(): string
{
global $gL10n;
if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) {
Method createOrganizationForm
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createOrganizationForm(): string
{
global $gDb, $gL10n, $gCurrentOrganization, $gSettingsManager, $gCurrentOrgId, $gCurrentSession;
// read organization and all system preferences values into form array
Method createContactsForm
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createContactsForm(): string
{
global $gL10n, $gSettingsManager, $gDb, $gCurrentOrgId, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createProfileForm
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createProfileForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentOrganization, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createLinksForm
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createLinksForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createRegionalSettingsForm
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createRegionalSettingsForm(): string
{
global $gL10n, $gSettingsManager, $gTimezone, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Function createSystemInformationForm
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function createSystemInformationForm(): string
{
global $gL10n, $gDb, $gLogger;
$this->assignSmartyVariable('operatingSystemName', SystemInfoUtils::getOS());
- 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 createSecurityForm
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSecurityForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createRegistrationForm
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createRegistrationForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createAnnouncementsForm
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createAnnouncementsForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Method createCategoryReportForm
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createCategoryReportForm(): string
{
global $gL10n, $gSettingsManager, $gDb, $gCurrentOrgId, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Function createPHPForm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function createPHPForm(): string
{
global $gL10n;
if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) {
- 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 createDocumentsFilesForm
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createDocumentsFilesForm(): string
{
global $gL10n, $gSettingsManager, $gCurrentSession;
$formValues = $gSettingsManager->getAll();
Similar blocks of code found in 2 locations. Consider refactoring. Open
$this->accordionCommonPanels = array(
'Common' => array(
'id' => 'Common',
'title' => $gL10n->get('SYS_COMMON'),
'icon' => 'bi-gear-fill'
- 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 307.
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
$this->accordionModulePanels = array(
'Announcements' => array(
'id' => 'Announcements',
'title' => $gL10n->get('SYS_ANNOUNCEMENTS'),
'icon' => 'bi-newspaper'
- 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 307.
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
if ($gSettingsManager->getBool('events_rooms_enabled')) {
$selectBoxEntries = array(
'detail' => $gL10n->get('SYS_DETAILED'),
'compact' => $gL10n->get('SYS_COMPACT'),
'room' => $gL10n->get('SYS_COMPACT') . ' - ' . $gL10n->get('SYS_ROOM'),
- 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 199.
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