File TableFolder.php
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use Admidio\Exception;
/**
* @brief Class manages access to database table adm_folders
Function addAdditionalToFolderContents
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public function addAdditionalToFolderContents(array $completeFolder): array
{
global $gCurrentUser;
// If user hasn't adminDocumentsFiles, don't add more data
- 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
TableFolder
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class TableFolder extends TableAccess
{
/**
* @var RolesRights|null Object with all roles that could view the current folder
*/
Function getSubfoldersWithProperties
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getSubfoldersWithProperties(): array
{
global $gCurrentUser, $gValidLogin;
// Get all subfolder of the current 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 addAdditionalToFolderContents
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addAdditionalToFolderContents(array $completeFolder): array
{
global $gCurrentUser;
// If user hasn't adminDocumentsFiles, don't add more data
Method delete
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete(int $folderId = 0): bool
{
global $gLogger;
$folId = (int)$this->getValue('fol_id');
Method getSubfoldersWithProperties
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSubfoldersWithProperties(): array
{
global $gCurrentUser, $gValidLogin;
// Get all subfolder of the current folder
Function addFolderOrFileToDatabase
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function addFolderOrFileToDatabase(string $newFolderFileName)
{
$newFolderFileName = urldecode($newFolderFileName);
$newObjectPath = $this->getFullFolderPath() . '/' . $newFolderFileName;
$folderId = (int)$this->getValue('fol_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 getFilesWithProperties
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFilesWithProperties(): array
{
global $gCurrentUser;
$files = array();
Function getFolderForDownload
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getFolderForDownload(string $folderUuid): bool
{
global $gCurrentUser, $gCurrentOrgId, $gValidLogin;
if ($folderUuid !== '') {
- 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 getFolderForDownload
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFolderForDownload(string $folderUuid): bool
{
global $gCurrentUser, $gCurrentOrgId, $gValidLogin;
if ($folderUuid !== '') {
Method addFolderOrFileToDatabase
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addFolderOrFileToDatabase(string $newFolderFileName)
{
$newFolderFileName = urldecode($newFolderFileName);
$newObjectPath = $this->getFullFolderPath() . '/' . $newFolderFileName;
$folderId = (int)$this->getValue('fol_id');
Function delete
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function delete(int $folderId = 0): bool
{
global $gLogger;
$folId = (int)$this->getValue('fol_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
Function getFilesWithProperties
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getFilesWithProperties(): array
{
global $gCurrentUser;
$files = array();
- 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 editRolesOnFolder
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function editRolesOnFolder(string $mode, string $rolesRightNameIntern, array $rolesArray, bool $recursive, int $folderId = 0)
Function editRolesOnFolder
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function editRolesOnFolder(string $mode, string $rolesRightNameIntern, array $rolesArray, bool $recursive, int $folderId = 0)
{
if (count($rolesArray) === 0) {
return;
}
- 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"