File SMB.php
has 600 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
* @author Jesús Macias <jmacias@solidgear.es>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
Function getFileInfo
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
protected function getFileInfo($path) {
$this->log('enter: '.__FUNCTION__."($path)");
$path = $this->buildPath($path);
if (!isset($this->statCache[$path])) {
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
SMB
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class SMB extends StorageAdapter {
/** @var bool */
protected $logActive;
/**
Function rename
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function rename($source, $target) {
$this->log("enter: rename('$source', '$target')", Util::DEBUG);
if ($this->isRootDir($source) || $this->isRootDir($target)) {
$this->log("refusing to rename \"$source\" to \"$target\"");
- 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 getFileInfo
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFileInfo($path) {
$this->log('enter: '.__FUNCTION__."($path)");
$path = $this->buildPath($path);
if (!isset($this->statCache[$path])) {
try {
Method fopen
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fopen($path, $mode) {
$this->log('enter: '.__FUNCTION__."($path, $mode)");
$fullPath = $this->buildPath($path);
$result = false;
try {
Function fopen
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function fopen($path, $mode) {
$this->log('enter: '.__FUNCTION__."($path, $mode)");
$fullPath = $this->buildPath($path);
$result = 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
Method rename
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rename($source, $target) {
$this->log("enter: rename('$source', '$target')", Util::DEBUG);
if ($this->isRootDir($source) || $this->isRootDir($target)) {
$this->log("refusing to rename \"$source\" to \"$target\"");
Method getFolderContents
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFolderContents($path) {
$this->log('enter: '.__FUNCTION__."($path)");
try {
$path = $this->buildPath($path);
$result = [];
Function getFolderContents
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function getFolderContents($path) {
$this->log('enter: '.__FUNCTION__."($path)");
try {
$path = $this->buildPath($path);
$result = [];
- 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 __construct
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($params) {
// log switch might be set already (from a subclass), so don't change it.
if (!isset($this->logActive)) {
$this->logActive = \OC::$server->getConfig()->getSystemValue('smb.logging.enable', false) === true;
}
Method rmdir
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rmdir($path) {
$this->log('enter: '.__FUNCTION__."($path)");
if ($this->isRootDir($path)) {
$this->log("refusing to delete \"$path\"");
Function __construct
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($params) {
// log switch might be set already (from a subclass), so don't change it.
if (!isset($this->logActive)) {
$this->logActive = \OC::$server->getConfig()->getSystemValue('smb.logging.enable', false) === true;
}
- 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 leave
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function leave($function, $result) {
if (!$this->logActive) {
//don't bother building log strings
return $result;
} elseif ($result === true) {
- 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 rmdir
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function rmdir($path) {
$this->log('enter: '.__FUNCTION__."($path)");
if ($this->isRootDir($path)) {
$this->log("refusing to delete \"$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"