Showing 18 of 114 total issues
Function generateRandomKey
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public function generateRandomKey($length = 32)
{
if (!is_int($length)) {
throw new \Exception('First parameter ($length) must be an integer');
}
- 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 save
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public static function save($key, array &$array, $value, $replace = true)
{
if ($key === '') {
$array[ $key ] = $value;
- 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 parseAndValidateKeys
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function parseAndValidateKeys($key, array &$array, $mode = '')
{
$parseInfo = [
'keys' => [],
'lastKey' => '',
Method generateRandomKey
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateRandomKey($length = 32)
{
if (!is_int($length)) {
throw new \Exception('First parameter ($length) must be an integer');
}
Function parseAndValidateKeys
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private static function parseAndValidateKeys($key, array &$array, $mode = '')
{
$parseInfo = [
'keys' => [],
'lastKey' => '',
- 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 isAssociative
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function isAssociative($array, $allStrings = true)
{
if (!is_array($array) || empty($array)) {
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 save
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function save($key, array &$array, $value, $replace = true)
{
if ($key === '') {
$array[ $key ] = $value;
Method perms
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function perms($file, $perms = null)
{
if (null === $perms) {
if (!file_exists($file)) {
return false;
Function perms
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function perms($file, $perms = null)
{
if (null === $perms) {
if (!file_exists($file)) {
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
Function normalizePath
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function normalizePath($path, $slash = DIRECTORY_SEPARATOR)
{
$path = rtrim(strtr($path, '/\\', $slash . $slash), $slash);
if (strpos($slash . $path, "{$slash}.") === false && strpos($path, "{$slash}{$slash}") === false) {
return $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"
Further reading
Function isIndexed
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function isIndexed(array $array, $consecutive = false)
{
if (empty($array)) {
return 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 sizeFormat
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function sizeFormat($bytes, $decimals = 0)
{
$bytes = floatval($bytes);
if ($bytes < 1024) {
- 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 get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function get($key, array $array, $default = null, $ignoreString = true)
{
if ($key === '') {
if (!array_key_exists((string)$key, $array)) {
return $default;
- 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 number_format($bytes / pow(1024, 5), $decimals, '.', '') . ' PiB';
Avoid too many return
statements within this method. Open
return number_format($bytes / pow(1024, 4), $decimals, '.', '') . ' TiB';
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return ($parseInfo['completed'] && ($parseInfo['isExists'] || $parseInfo['isString'])) ? $parseInfo['value'] : $default;
Avoid too many return
statements within this method. Open
return number_format($bytes / pow(1024, 5), $decimals, '.', '') . ' PiB';