src/Import/Zip.php
Method dbInsert
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function dbInsert($item): void
{
$Teams = new Teams($this->Users, $this->Users->userData['team']);
// the body is updated after it has been fixed by the uploaded files with correct long_name
$sql = 'INSERT INTO items(team, title, date, userid, category, status, canread, canwrite, canbook, elabid, metadata)
Function importAll
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
private function importAll(array $json): void
{
// do we need to update data: don't sanitize input, escape output
// if the data/meta keys exist, it's a new zip, otherwise it's an old one that needs transformation
if (!array_key_exists('data', $json)) {
- 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 dbInsert
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
private function dbInsert($item): void
{
$Teams = new Teams($this->Users, $this->Users->userData['team']);
// the body is updated after it has been fixed by the uploaded files with correct long_name
$sql = 'INSERT INTO items(team, title, date, userid, category, status, canread, canwrite, canbook, elabid, metadata)
- 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 importAll
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function importAll(array $json): void
{
// do we need to update data: don't sanitize input, escape output
// if the data/meta keys exist, it's a new zip, otherwise it's an old one that needs transformation
if (!array_key_exists('data', $json)) {