File StoragesService.php
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Jesús Macias <jmacias@solidgear.es>
* @author Lukas Reschke <lukas@statuscode.ch>
* @author Robin Appelman <icewind@owncloud.com>
Function updateStorage
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function updateStorage(IStorageConfig $updatedStorage) {
$id = $updatedStorage->getId();
$existingMount = $this->dbConfig->getMountById($id);
- 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 updateStorage
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateStorage(IStorageConfig $updatedStorage) {
$id = $updatedStorage->getId();
$existingMount = $this->dbConfig->getMountById($id);
StoragesService
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class StoragesService implements IStoragesService {
/** @var IStoragesBackendService */
protected $backendService;
/**
Method getStorageConfigFromDBMount
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getStorageConfigFromDBMount(array $mount) {
$applicableUsers = \array_filter($mount['applicable'], function ($applicable) {
return $applicable['type'] === DBConfigService::APPLICABLE_TYPE_USER;
});
$applicableUsers = \array_map(function ($applicable) {
Method addStorage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addStorage(IStorageConfig $newStorage) {
$allStorages = $this->readConfig();
$configId = $this->dbConfig->addMount(
$newStorage->getMountPoint(),
Method createStorage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createStorage(
$mountPoint,
$backendIdentifier,
$authMechanismIdentifier,
$backendOptions,
Method createStorage
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
$mountPoint,
$backendIdentifier,
$authMechanismIdentifier,
$backendOptions,
$mountOptions = null,
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $config;
Avoid too many return
statements within this method. Open
return null;
Function createStorage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function createStorage(
$mountPoint,
$backendIdentifier,
$authMechanismIdentifier,
$backendOptions,
- 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 decryptIfPassword
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function decryptIfPassword(Backend $backend, AuthMechanism $auth, $key, $value) {
$backendParameters = $backend->getParameters();
$authParameters = $auth->getParameters();
if (
(
- 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 addStorage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function addStorage(IStorageConfig $newStorage) {
$allStorages = $this->readConfig();
$configId = $this->dbConfig->addMount(
$newStorage->getMountPoint(),
- 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"