Function importRootDataset
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
private function importRootDataset(array $dataset): void
{
$createTarget = $this->targetNumber;
$title = $this->transformIfNecessary($dataset['name'] ?? _('Untitled'));
- 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 importRootDataset
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function importRootDataset(array $dataset): void
{
$createTarget = $this->targetNumber;
$title = $this->transformIfNecessary($dataset['name'] ?? _('Untitled'));
File Eln.php
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Nicolas CARPi <nico-git@deltablot.email>
* @copyright 2022 Nicolas CARPi
Function importFile
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function importFile(array $file): void
{
// note: path transversal vuln is detected and handled by flysystem
$filepath = $this->tmpPath . '/' . basename($this->root) . '/' . $file['@id'];
// checksum is mandatory for import
- 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 importFile
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function importFile(array $file): void
{
// note: path transversal vuln is detected and handled by flysystem
$filepath = $this->tmpPath . '/' . basename($this->root) . '/' . $file['@id'];
// checksum is mandatory for import
Function import
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function import(): void
{
// figure out the path to the root of the eln (where the metadata file lives)
// the name of the folder is not fixed, so list folders and pick the first one found (there should be only one)
$listing = $this->fs->listContents($this->tmpDir);
- 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 import
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function import(): void
{
// figure out the path to the root of the eln (where the metadata file lives)
// the name of the folder is not fixed, so list folders and pick the first one found (there should be only one)
$listing = $this->fs->listContents($this->tmpDir);
Function importPart
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function importPart(array $part): void
{
if (empty($part['@type'])) {
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"