includes/Tasks/RemoveTask.php
Function execute
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
public function execute() {
$this->drive = $this->full_path;
// Removing this drive here will insure it won't be used for new files while we're moving files away, and that it can later be replaced.
StoragePool::remove_drive($this->drive);
- 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 execute
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute() {
$this->drive = $this->full_path;
// Removing this drive here will insure it won't be used for new files while we're moving files away, and that it can later be replaced.
StoragePool::remove_drive($this->drive);
Function check_going_dir
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
protected static function check_going_dir($path, $share, $going_drive) {
$handle = @opendir($path);
if ($handle === FALSE) {
Log::error("Couldn't open $path to list content. Skipping...", Log::EVENT_CODE_LIST_DIR_FAILED);
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"
Further reading
Method check_going_dir
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected static function check_going_dir($path, $share, $going_drive) {
$handle = @opendir($path);
if ($handle === FALSE) {
Log::error("Couldn't open $path to list content. Skipping...", Log::EVENT_CODE_LIST_DIR_FAILED);
return;