File app.php
has 664 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
* @author Bart Visscher <bartv@thisnet.nl>
* @author Bernhard Posselt <dev@bernhard-posselt.com>
Function listAllApps
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
public static function listAllApps(bool $listEveryApp = false) {
$installedApps = OC_App::getAllApps();
//TODO which apps do we want to blacklist and how do we integrate
// blacklisting with the multi apps folder feature?
- 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
OC_App
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
class OC_App {
private static $adminForms = [];
private static $personalForms = [];
private static $appTypes = [];
private static $loadedApps = [];
Function loadApps
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public static function loadApps($types = null) {
if (\is_array($types) && !\array_diff($types, self::$loadedTypes)) {
return true;
}
if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) {
- 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 listAllApps
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function listAllApps(bool $listEveryApp = false) {
$installedApps = OC_App::getAllApps();
//TODO which apps do we want to blacklist and how do we integrate
// blacklisting with the multi apps folder feature?
Function loadApp
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function loadApp($app, $checkUpgrade = true) {
self::$loadedApps[] = $app;
$appPath = self::getAppPath($app);
if ($appPath === false) {
return;
- 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 loadApps
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function loadApps($types = null) {
if (\is_array($types) && !\array_diff($types, self::$loadedTypes)) {
return true;
}
if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) {
Function getAllApps
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function getAllApps() {
$apps = [];
foreach (OC::$APPSROOTS as $apps_dir) {
if (!\is_readable($apps_dir['path'])) {
- 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 loadApp
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function loadApp($app, $checkUpgrade = true) {
self::$loadedApps[] = $app;
$appPath = self::getAppPath($app);
if ($appPath === false) {
return;
Function isAppDirWritable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function isAppDirWritable($appId) {
$path = self::getAppPath($appId);
// Check if the parent directory is marked as writable in config.php
if ($path !== false) {
$appDir = \substr($path, 0, -\strlen("/$appId"));
- 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 updateApp
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateApp($appId) {
\OC::$server->getAppManager()->clearAppsCache();
$appPath = self::getAppPath($appId);
if ($appPath === false) {
return false;
Method isAppCompatible
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isAppCompatible($ocVersion, $appInfo) {
$requireMin = '';
$requireMax = '';
if (isset($appInfo['dependencies']['owncloud']['@attributes']['min-version'])) {
$requireMin = $appInfo['dependencies']['owncloud']['@attributes']['min-version'];
Method getSettingsNavigation
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getSettingsNavigation() {
$l = \OC::$server->getL10N('lib');
$urlGenerator = \OC::$server->getURLGenerator();
$settings = [];
Function isAppCompatible
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function isAppCompatible($ocVersion, $appInfo) {
$requireMin = '';
$requireMax = '';
if (isset($appInfo['dependencies']['owncloud']['@attributes']['min-version'])) {
$requireMin = $appInfo['dependencies']['owncloud']['@attributes']['min-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
Function updateApp
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function updateApp($appId) {
\OC::$server->getAppManager()->clearAppsCache();
$appPath = self::getAppPath($appId);
if ($appPath === false) {
return false;
- 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 enable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function enable($app, $groups = null) {
self::$enabledAppsCache = []; // flush
// check for required dependencies
$config = \OC::$server->getConfig();
- 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 getStorage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getStorage($appId) {
if (OC_App::isEnabled($appId)) { //sanity check
if (OC_User::isLoggedIn()) {
$view = new \OC\Files\View('/' . OC_User::getUser());
if (!$view->file_exists($appId)) {
- 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 parseAppInfo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function parseAppInfo(array $data) {
// just modify the description if it is available
// otherwise this will create a $data element with an empty 'description'
if (isset($data['description'])) {
if (\is_string($data['description'])) {
- 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 shouldUpgrade
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function shouldUpgrade($app) {
$versions = self::getAppVersions();
$info = \OC::$server->getAppManager()->getAppInfo($app);
if ($info && isset($versions[$app])) {
- 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"