Filesystem
has 71 functions (exceeds 20 allowed). Consider refactoring. Open
class Filesystem {
/**
* @var Mount\Manager $mounts
*/
private static $mounts;
File Filesystem.php
has 530 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
* @author Bart Visscher <bartv@thisnet.nl>
* @author Christopher Schäpers <kondou@ts.unde.re>
Function checkRegexAgainstFolderOrFile
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private static function checkRegexAgainstFolderOrFile($regexList, $path, $callerMessage = '') {
foreach ($regexList as $item) {
// check if the first and last character is a '/' and add one if not
// terminate with i == case insensitive
$newItem = $item;
- 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 isForbiddenFileOrDir
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isForbiddenFileOrDir($FileOrDir, $excluded = []) {
$blacklistArray = [];
$pathParts = [];
// force blacklist/exclude arraylist/arrayRegex for unit tests
Method initMountPoints
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function initMountPoints($user = '', $fullInit = true) {
if ($user == '') {
$user = \OC_User::getUser();
}
if ($user === null || $user === false || $user === '') {
Function initMountPoints
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function initMountPoints($user = '', $fullInit = true) {
if ($user == '') {
$user = \OC_User::getUser();
}
if ($user === null || $user === false || $user === '') {
- 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 normalizePath
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false, $keepUnicode = false) {
if (self::$normalizedPathCache === null) {
self::$normalizedPathCache = new CappedMemoryCache();
}
Function normalizePath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false, $keepUnicode = false) {
if (self::$normalizedPathCache === null) {
self::$normalizedPathCache = new CappedMemoryCache();
}
- 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 isForbiddenFileOrDir
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function isForbiddenFileOrDir($FileOrDir, $excluded = []) {
$blacklistArray = [];
$pathParts = [];
// force blacklist/exclude arraylist/arrayRegex for unit tests
- 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;