File SystemTagManager.php
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Joas Schilling <coding@schilljs.com>
* @author Vincent Petry <pvince81@owncloud.com>
*
Method updateTag
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateTag($tagId, $tagName, $userVisible, $userAssignable, $userEditable = null) {
$userVisible = (int)$userVisible;
$userAssignable = (int)$userAssignable;
/**
Method createTag
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createTag($tagName, $userVisible, $userAssignable, $userEditable = null) {
$userVisible = (int)$userVisible;
$userAssignable = (int)$userAssignable;
/**
Method deleteTags
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteTags($tagIds) {
if (!\is_array($tagIds)) {
$tagIds = [$tagIds];
}
Method getTagsByIds
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTagsByIds($tagIds) {
if (!\is_array($tagIds)) {
$tagIds = [$tagIds];
}
Method getAllTags
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllTags($visibilityFilter = null, $nameSearchPattern = null) {
$tags = [];
$query = $this->connection->getQueryBuilder();
$query->select('*')
Function deleteTags
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function deleteTags($tagIds) {
if (!\is_array($tagIds)) {
$tagIds = [$tagIds];
}
- 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 updateTag
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function updateTag($tagId, $tagName, $userVisible, $userAssignable, $userEditable = null) {
Function canUserAssignTag
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function canUserAssignTag(ISystemTag $tag, IUser $user) {
// early check to avoid unneeded group lookups
if ($tag->isUserAssignable() && $tag->isUserVisible()) {
return true;
}
- 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 canUserUseStaticTagInGroup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function canUserUseStaticTagInGroup(ISystemTag $tag, IUser $user) {
if ($this->groupManager->isAdmin($user->getUID())) {
return true;
}
if ($tag->isUserEditable() === false) {
- 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;
Function getTagsByIds
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getTagsByIds($tagIds) {
if (!\is_array($tagIds)) {
$tagIds = [$tagIds];
}
- 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"