OC_User
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class OC_User {
/**
* @return \OC\User\Session
*/
public static function getUserSession() {
File user.php
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Aldo "xoen" Giambelluca <xoen@xoen.org>
* @author Andreas Fischer <bantu@owncloud.com>
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
Function setupBackends
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function setupBackends() {
OC_App::loadApps(['prelogin']);
$backends = \OC::$server->getSystemConfig()->getValue('user_backends', []);
if (isset($backends['default']) && !$backends['default']) {
// clear default backends
- 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 useBackend
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function useBackend($backend = 'database') {
if ($backend instanceof \OCP\UserInterface) {
self::$_usedBackends[\get_class($backend)] = $backend;
\OC::$server->getUserManager()->registerBackend($backend);
} else {
Function useBackend
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function useBackend($backend = 'database') {
if ($backend instanceof \OCP\UserInterface) {
self::$_usedBackends[\get_class($backend)] = $backend;
\OC::$server->getUserManager()->registerBackend($backend);
} else {
- 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 getDisplayName
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getDisplayName($uid = null) {
if ($uid) {
$user = \OC::$server->getUserManager()->get($uid);
if ($user) {
return $user->getDisplayName();
- 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 findFirstActiveUsedBackend
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function findFirstActiveUsedBackend() {
foreach (self::$_usedBackends as $backend) {
if ($backend instanceof OCP\Authentication\IApacheBackend) {
if ($backend->isSessionActive()) {
return $backend;
- 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"