lib/private/AppFramework/DependencyInjection/DIContainer.php
Method __construct
has 262 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct($appName, $urlParams = []) {
parent::__construct();
$this['AppName'] = $appName;
$this['urlParams'] = $urlParams;
File DIContainer.php
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @author Christoph Wurst <christoph@owncloud.com>
* @author Joas Schilling <coding@schilljs.com>
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getCommentsManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getActivityManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getCache();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getMemCacheFactory();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getL10N($c->query('AppName'));
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getRouter();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getUserSession();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getEventDispatcher();
Avoid too many return
statements within this method. Open
Open
return new CORSMiddleware(
$c['Request'],
$c['ControllerMethodReflector'],
$c['OCP\IUserSession'],
$c['OCP\IConfig']
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getRootFolder();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getGroupManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getShareManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getContentSecurityPolicyManager();
Avoid too many return
statements within this method. Open
Open
return $dispatcher;
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getCredentialsManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getSearch();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getSystemTagObjectMapper();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getAvatarManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getMountProviderCollection();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getDb();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getMimeTypeDetector();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getHTTPClientService();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getNavigationManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getCrypto();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getRequest();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getSecureRandom();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getSystemTagManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getHasher();
Avoid too many return
statements within this method. Open
Open
return $c->query('ServerContainer')->getWebRoot();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getSearch();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getDateTimeZone();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getQueryLogger();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getMailer();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getPreviewManager();
Avoid too many return
statements within this method. Open
Open
return $c->query('OCP\\IUserSession')->getSession()->get('user_id');
Avoid too many return
statements within this method. Open
Open
return new API();
Avoid too many return
statements within this method. Open
Open
return new Dispatcher(
$c['Protocol'],
$c['MiddlewareDispatcher'],
$c['ControllerMethodReflector'],
$c['Request']
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getJobList();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getTempManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getContactsManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getURLGenerator();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getDateTimeFormatter();
Avoid too many return
statements within this method. Open
Open
return new SessionMiddleware(
$c['Request'],
$c['ControllerMethodReflector'],
$app->getServer()->getSession()
);
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getDatabaseConnection();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getNotificationManager();
Avoid too many return
statements within this method. Open
Open
return $c;
Avoid too many return
statements within this method. Open
Open
return $server->getCapabilitiesManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getEventLogger();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getLogger();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getUserManager();
Avoid too many return
statements within this method. Open
Open
return new SecurityMiddleware(
$c['Request'],
$c['ControllerMethodReflector'],
$app->getServer()->getNavigationManager(),
$app->getServer()->getURLGenerator(),
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getConfig();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getMimeTypeDetector();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getHTTPClientService();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getMountManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getThemeService();
Avoid too many return
statements within this method. Open
Open
return new TwoFactorMiddleware($twoFactorManager, $userSession, $urlGenerator, $reflector, $request);
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getTagManager();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getSession();
Avoid too many return
statements within this method. Open
Open
return $this->getServer()->getL10NFactory();
Avoid too many return
statements within this method. Open
Open
return new Http($_SERVER, $protocol);
Function log
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function log($message, $level) {
switch ($level) {
case 'debug':
$level = \OCP\Util::DEBUG;
break;
- 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"