File AppManager.php
has 452 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
* @author Christoph Schaefer <christophł@wolkesicher.de>
* @author Christoph Wurst <christoph@owncloud.com>
AppManager
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class AppManager implements IAppManager {
/**
* Apps with these types can not be enabled for certain groups only
* @var string[]
*/
Function checkAppForUser
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function checkAppForUser($enabled, $appName, $user) {
if ($user !== null) {
$userAppAttributes = $user->getExtendedAttributes();
/**
* Guests will only have access to some whitelisted apps
- 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 findAppInDirectories
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function findAppInDirectories($appId) {
$sanitizedAppId = \OC_App::cleanAppId($appId);
if ($sanitizedAppId !== $appId) {
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
Method getAppInfoByPath
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAppInfoByPath($path, $etag = null) {
$file = \realpath($path);
// check the cache
$data = $this->appInfo->get($file);
Function canEnableTheme
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function canEnableTheme($appId) {
$info = $this->getAppInfo($appId);
if (
isset($info['types'])
&& \is_array($info['types'])
- 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 checkAppForUser
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkAppForUser($enabled, $appName, $user) {
if ($user !== null) {
$userAppAttributes = $user->getExtendedAttributes();
/**
* Guests will only have access to some whitelisted apps
Method findAppInDirectories
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function findAppInDirectories($appId) {
$sanitizedAppId = \OC_App::cleanAppId($appId);
if ($sanitizedAppId !== $appId) {
return false;
}
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
IUserSession $userSession = null,
IAppConfig $appConfig = null,
IGroupManager $groupManager = null,
ICacheFactory $memCacheFactory,
EventDispatcherInterface $dispatcher,
Function getAppInfoByPath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getAppInfoByPath($path, $etag = null) {
$file = \realpath($path);
// check the cache
$data = $this->appInfo->get($file);
- 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 getAppInfo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getAppInfo($appId) {
if (!\is_string($appId) || $appId === '') {
return null; // TODO explode?
}
- 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
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;