Showing 146 of 158 total issues
Strata
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Strata extends StrataContext
{
use StrataConfigurableTrait;
/**
Consider simplifying this complex logical expression. Open
if ($op === '=' && $val && $val[0] === '/') {
if (!preg_match($val, $prop)) {
return false;
}
} elseif (($op === '=' && $prop != $val)
Function rules
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function rules($type, $rules, $reset = false)
{
$var = '_' . $type;
switch ($type) {
- 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 FormHelper.php
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Strata\View\Helper;
use Strata\Model\ModelEntity;
File ModelEntity.php
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Strata\Model\CustomPostType;
use Strata\Utility\Hash;
Function expand
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public static function expand($data, $separator = '.')
{
$result = array();
$stack = 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
Request
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Request
{
/**
* A cache of the parsed GET values in the current request.
* @var array
UrlRoute
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class UrlRoute extends Route
{
/**
* @var string The hidden key for dynamically defined callback functions.
*/
Function debug
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function debug()
{
if (!WP_DEBUG) {
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 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, '::')) {
Function sort
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function sort(array $data, $path, $dir = 'asc', $type = 'regular')
{
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 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();
}
FormHelper
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class FormHelper extends Helper
{
/**
* @var Strata\Controller\Request The active request
*/
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;
Method saveWPGettextFunctions
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveWPGettextFunctions(array $functions, Translations $translations, $file = '')
{
foreach ($this->getFunctions() as $function) {
list($name, $line, $args) = $function;
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
Function nest
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function nest(array $data, $options = array())
{
if (!$data) {
return $data;
}
- 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 nest
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function nest(array $data, $options = array())
{
if (!$data) {
return $data;
}
Method sort
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sort(array $data, $path, $dir = 'asc', $type = 'regular')
{
if (empty($data)) {
return array();
}
Method setCurrentLocaleByContext
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setCurrentLocaleByContext()
{
if (function_exists('apply_filters')) {
// Give a chance for plugins to override this decision
$locale = null;