Showing 18 of 18 total issues
File File.php
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Seafile\Client\Resource;
use Exception;
Method create
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(
LibraryType $library,
string $path,
SharedLinkPermissions $permissions,
int $expire = null,
Method create
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(LibraryType $library, string $dirName, string $parentDir = '/', bool $recursive = false)
{
if ($recursive) {
$response = false;
$parts = explode('/', trim($dirName, '/'));
Method copy
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function copy(
LibraryType $srcLibrary,
array $srcPaths,
LibraryType $dstLibrary,
string $dstDirectoryPath,
Method copy
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function copy(
LibraryType $srcLibrary,
string $srcFilePath,
LibraryType $dstLibrary,
string $dstDirectoryPath,
Method create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create($name, $description = "new repo", $password = ''): bool
{
// only create a library which is not empty to prevent wrong implementation
if (empty($name)) {
return false;
Method rename
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rename(LibraryType $library, DirectoryItem $dirItem, string $newFilename): bool
{
$filePath = $dirItem->dir . $dirItem->name;
if (empty($filePath)) {
Method getMultiPartParams
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMultiPartParams(
string $localFilePath,
string $dir,
bool $newFile = true,
$newFilename = false
Method delete
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete(LibraryType $library, array $paths): bool
{
// do not allow empty paths
if (empty($paths)) {
return false;
Method rename
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rename(LibraryType $library, string $directoryPath, string $newDirectoryName)
{
// don't allow empty paths
if (empty($directoryPath) || empty($newDirectoryName)) {
return false;
Function fromArray
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function fromArray(array $fromArray) // type is given in derived class
{
foreach ($fromArray as $key => $value) {
$camelCaseKey = CaseHelperFactory::make(CaseHelperFactory::INPUT_TYPE_SNAKE_CASE)->toCamelCase($key);
- 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 create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function create(LibraryType $library, string $dirName, string $parentDir = '/', bool $recursive = false)
{
if ($recursive) {
$response = false;
$parts = explode('/', trim($dirName, '/'));
- 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 create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
LibraryType $library,
string $path,
SharedLinkPermissions $permissions,
int $expire = null,
string $password = null
Method upload
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
LibraryType $library,
string $localFilePath,
string $dir = '/',
$newFilename = false,
bool $newFile = true
Method downloadFromDir
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
LibraryType $library,
DirectoryItem $item,
string $localFilePath,
string $dir,
int $reuse = 1
Method copy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
LibraryType $srcLibrary,
string $srcFilePath,
LibraryType $dstLibrary,
string $dstDirectoryPath,
int $operation = self::OPERATION_COPY
Method copy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
LibraryType $srcLibrary,
array $srcPaths,
LibraryType $dstLibrary,
string $dstDirectoryPath,
int $operation = self::OPERATION_COPY
Function toArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function toArray(int $mode = self::ARRAY_ASSOC): array
{
switch ($mode) {
case self::ARRAY_MULTI_PART:
$caseHelper = CaseHelperFactory::make(CaseHelperFactory::INPUT_TYPE_CAMEL_CASE);
- 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"