Local
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class Local extends Common {
protected $datadir;
protected $dataDirLength;
File Local.php
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Bart Visscher <bartv@thisnet.nl>
* @author Boris Rybalkin <ribalkin@gmail.com>
* @author Brice Maron <brice@bmaron.net>
Function rename
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function rename($path1, $path2) {
$srcParent = \dirname($path1);
$dstParent = \dirname($path2);
if (!$this->isUpdatable($srcParent)) {
- 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 filemtime
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function filemtime($path) {
$fullPath = $this->getSourcePath($path);
\clearstatcache($fullPath);
if (!$this->file_exists($path)) {
return 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
Method rename
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rename($path1, $path2) {
$srcParent = \dirname($path1);
$dstParent = \dirname($path2);
if (!$this->isUpdatable($srcParent)) {
Function rmdir
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function rmdir($path) {
if (!$this->isDeletable($path)) {
return false;
}
try {
- 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 getSourcePath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getSourcePath($path) {
$fullPath = $this->datadir . $path;
if ($this->allowSymlinks || $path === '') {
return $fullPath;
}
- 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 searchInDir
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function searchInDir($query, $dir = '') {
$files = [];
$physicalDir = $this->getSourcePath($dir);
foreach (\scandir($physicalDir) as $item) {
if (\OC\Files\Filesystem::isIgnoredDir($item)) {
- 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 \rename($this->getSourcePath($path1), $this->getSourcePath($path2));
Function touch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function touch($path, $mtime = null) {
// sets the modification time of the file to the given value.
// If mtime is nil the current time is set.
// note that the access time of the file always changes to the current time.
if ($this->file_exists($path) and !$this->isUpdatable($path)) {
- 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"