Function put
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function put($contents, bool $ex_lock = false) : self
{
if (!is_string($contents)){
if (is_array($contents)){
$contents = implode(PHP_EOL, $contents);
- 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
File
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class File
{
const DS = DIRECTORY_SEPARATOR;
const MAKEDIRECTORY_DEFAULT_MODE = 0777;
Function listFiles
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function listFiles( $filter = null ) : array
{
$path = $this->path;
if ( !file_exists($path) ) 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
File File.php
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace stk2k\filesystem;
Method put
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function put($contents, bool $ex_lock = false) : self
{
if (!is_string($contents)){
if (is_array($contents)){
$contents = implode(PHP_EOL, $contents);
Method listFiles
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function listFiles( $filter = null ) : array
{
$path = $this->path;
if ( !file_exists($path) ) return [];
Function rmdirRecursive
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function rmdirRecursive() : self
{
if ( !file_exists($this->path) ){
return $this;
}
- 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 mkdir
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function mkdir(int $mode = self::MAKEDIRECTORY_DEFAULT_MODE) : self
{
if ( file_exists($this->path) ){
if ( is_file($this->path) ){
throw new MakeDirectoryException($this);
- 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"