Showing 44 of 44 total issues
File Util.php
has 511 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace stk2k\util;
Function getByteSizeFromString
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
public static function getByteSizeFromString( string $size_string ) : float
{
if ( ($pos=strpos($size_string,'TB')) > 0 ){
// TB
$number = substr($size_string,0,$pos);
- 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 toString
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public static function toString($value, bool $with_type = false, int $max_size = self::TOSTRING_MAX_LENGTH, string $tostring_methods = '__toString,toString' ): string
{
$ret = '';
if ( $value === NULL ){
- 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
Util
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
final class Util
{
/* length of output in string conversion methods */
const TOSTRING_MAX_LENGTH = 9999;
Method _dump
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function _dump( $key, $value, $depth, $max_string_length, &$lines, $max_depth, &$recursion )
{
if ( $depth > $max_depth ){
$lines[] = str_repeat( '.', $depth * 4 ) . "----(max depth over:$max_depth)";
return;
Function _dump
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private static function _dump( $key, $value, $depth, $max_string_length, &$lines, $max_depth, &$recursion )
{
if ( $depth > $max_depth ){
$lines[] = str_repeat( '.', $depth * 4 ) . "----(max depth over:$max_depth)";
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 toString
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function toString($value, bool $with_type = false, int $max_size = self::TOSTRING_MAX_LENGTH, string $tostring_methods = '__toString,toString' ): string
{
$ret = '';
if ( $value === NULL ){
Function process
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function process(string $str, callable $handler = null) : string
{
$keyword_list = self::findMacroKeywords($str);
if (empty($keyword_list)){
- 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 dump
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function dump($var, string $format = 'html', int $back = 0, array $options = null, bool $return = false, int $max_depth = 6 ): ?string
{
list( $file, $line ) = self::caller( $back );
if ( !$options ){
Function __construct
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(array $default_handlers = [])
{
foreach($default_handlers as $handler)
{
if (is_string($handler)){
- 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 convertEncodingRecursive
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function convertEncodingRecursive($var, string $to_encoding = null, string $from_encoding = null)
{
$type = gettype($var);
switch( $type ){
case 'string':
Method process
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(string $keyword) : string
{
switch($keyword){
case 'SERVER_NAME':
case 'REQUEST_METHOD':
Method process
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(string $keyword) : string
{
switch($keyword){
case 'DATE_NOW':
return strval(time());
Method getByteSizeFromString
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getByteSizeFromString( string $size_string ) : float
{
if ( ($pos=strpos($size_string,'TB')) > 0 ){
// TB
$number = substr($size_string,0,$pos);
Method addNamedHandler
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addNamedHandler(string $key) : MacroProcessor
{
switch($key){
case EnumMacroHandler::HANDLER_KEY_SYSTEM:
self::addHandler(new SystemMacroHandler());
Method process
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(string $str, callable $handler = null) : string
{
$keyword_list = self::findMacroKeywords($str);
if (empty($keyword_list)){
Function addNamedHandler
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function addNamedHandler(string $key) : MacroProcessor
{
switch($key){
case EnumMacroHandler::HANDLER_KEY_SYSTEM:
self::addHandler(new SystemMacroHandler());
- 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 dump
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function dump($var, string $format = 'html', int $back = 0, array $options = null, bool $return = false, int $max_depth = 6 ): ?string
{
list( $file, $line ) = self::caller( $back );
if ( !$options ){
- 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 convertEncodingRecursive
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function convertEncodingRecursive($var, string $to_encoding = null, string $from_encoding = null)
{
$type = gettype($var);
switch( $type ){
case 'string':
- 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 _dump
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
private static function _dump( $key, $value, $depth, $max_string_length, &$lines, $max_depth, &$recursion )