Function getShareFolder
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function getShareFolder($view = null) {
if ($view === null) {
$view = Filesystem::getView();
}
// for guests we default to root as their home storage is read-only
- 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 authenticate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function authenticate($linkItem, $password = null) {
if ($password !== null) {
if ($linkItem['share_type'] == \OCP\Share::SHARE_TYPE_LINK) {
// Check Password
$newHash = '';
- 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 setupFromToken
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function setupFromToken($token, $relativePath = null, $password = null) {
\OC_User::setIncognitoMode(true);
$linkItem = \OCP\Share::getShareByToken($token, !$password);
if ($linkItem === false || ($linkItem['item_type'] !== 'file' && $linkItem['item_type'] !== 'folder')) {
Function setupFromToken
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function setupFromToken($token, $relativePath = null, $password = null) {
\OC_User::setIncognitoMode(true);
$linkItem = \OCP\Share::getShareByToken($token, !$password);
if ($linkItem === false || ($linkItem['item_type'] !== 'file' && $linkItem['item_type'] !== 'folder')) {
- 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 getShareFolder
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getShareFolder($view = null) {
if ($view === null) {
$view = Filesystem::getView();
}
// for guests we default to root as their home storage is read-only
Method getSharesFromItem
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getSharesFromItem($target) {
$result = [];
$owner = Filesystem::getOwner($target);
Filesystem::initMountPoints($owner);
$info = Filesystem::getFileInfo($target);
Function getSharesFromItem
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getSharesFromItem($target) {
$result = [];
$owner = Filesystem::getOwner($target);
Filesystem::initMountPoints($owner);
$info = Filesystem::getFileInfo($target);
- 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"