Function truncate
has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring. Open
public static function truncate($text, $length = 100, $options = array())
{
$defaults = array(
'ellipsis' => '...', 'exact' => true, 'html' => 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
File StringUtility.php
has 485 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* String handling methods.
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
Function tokenize
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public static function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')')
{
if (empty($data)) {
return array();
}
- 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 truncate
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function truncate($text, $length = 100, $options = array())
{
$defaults = array(
'ellipsis' => '...', 'exact' => true, 'html' => false
);
Function uuid
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public static function uuid()
{
$node = getenv('SERVER_ADDR');
if (strpos($node, ':') !== false) {
if (substr_count($node, '::')) {
- 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 uuid
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function uuid()
{
$node = getenv('SERVER_ADDR');
if (strpos($node, ':') !== false) {
if (substr_count($node, '::')) {
Method tokenize
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')')
{
if (empty($data)) {
return array();
}
Method cleanInsert
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function cleanInsert($str, $options)
{
$clean = $options['clean'];
if (!$clean) {
return $str;
Function wordWrap
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function wordWrap($text, $width = 72, $break = "\n", $cut = false)
{
if ($cut) {
$parts = array();
while (mb_strlen($text) > 0) {
- 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 insert
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function insert($str, $data, $options = array())
{
$defaults = array(
'before' => ':', 'after' => null, 'escape' => '\\', 'format' => null, 'clean' => false
);
Method wordWrap
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function wordWrap($text, $width = 72, $break = "\n", $cut = false)
{
if ($cut) {
$parts = array();
while (mb_strlen($text) > 0) {
Method highlight
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function highlight($text, $phrase, $options = array())
{
if (empty($phrase)) {
return $text;
}
Function insert
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function insert($str, $data, $options = array())
{
$defaults = array(
'before' => ':', 'after' => null, 'escape' => '\\', 'format' => null, 'clean' => 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 highlight
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function highlight($text, $phrase, $options = array())
{
if (empty($phrase)) {
return $text;
}
- 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 cleanInsert
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function cleanInsert($str, $options)
{
$clean = $options['clean'];
if (!$clean) {
return $str;
- 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 wrap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function wrap($text, $options = array())
{
if (is_numeric($options)) {
$options = array('width' => $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"