File SettingsManager.php
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Tom Needham <tom@owncloud.com>
*
* @copyright Copyright (c) 2018, ownCloud GmbH
Function findRegisteredSections
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function findRegisteredSections($type) {
$sections = [];
foreach ($this->appManager->getEnabledAppsForUser($this->userSession->getUser()) as $app) {
if (isset($this->appManager->getAppInfo($app)['settings-sections'])) {
foreach ($this->appManager->getAppInfo($app)['settings-sections'] as $t => $section) {
- 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 getBuiltInPanel
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBuiltInPanel($className) {
$panels = [
// Personal
Profile::class => new Profile(
$this->config,
Method __construct
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
IL10N $l,
IAppManager $appManager,
IUserSession $userSession,
ILogger $logger,
IGroupManager $groupManager,
Method getBuiltInPanels
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getBuiltInPanels($type) {
if ($type === 'admin') {
return [
Enforce2fa::class,
LegacyAdmin::class,
Function findRegisteredPanels
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function findRegisteredPanels($type) {
$panels = [];
foreach ($this->appManager->getEnabledAppsForUser($this->userSession->getUser()) as $app) {
if (isset($this->appManager->getAppInfo($app)['settings'])) {
foreach ($this->appManager->getAppInfo($app)['settings'] as $t => $detected) {
- 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 loadPanels
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function loadPanels($type) {
// If already loaded just return
if (!empty($this->panels[$type])) {
return $this->panels[$type];
}
- 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 loadSection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function loadSection($type, $sectionID) {
// Load built in sections
foreach ($this->getBuiltInSections($type) as $section) {
if ($section->getID() === $sectionID) {
return $section;
- 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"