Showing 787 of 2,467 total issues
Avoid deeply nested control flow statements. Open
Open
if ($carry === 0) {
break;
}
Function validateCondition
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function validateCondition($condition)
{
if (!is_array($condition)) {
$this->addError($this->filterAttributeName, $this->parseErrorMessage('invalidFilter'));
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
Consider simplifying this complex logical expression. Open
Open
if (
$this->matchAction($action)
&& $this->matchRole($user)
&& $this->matchIP($request->getUserIP())
&& $this->matchVerb($request->getMethod())
Consider simplifying this complex logical expression. Open
Open
if (isset($_SERVER['SCRIPT_NAME']) && basename($_SERVER['SCRIPT_NAME']) === $scriptName) {
$this->_scriptUrl = $_SERVER['SCRIPT_NAME'];
} elseif (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) === $scriptName) {
$this->_scriptUrl = $_SERVER['PHP_SELF'];
} elseif (isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME']) === $scriptName) {
Consider simplifying this complex logical expression. Open
Open
if ($isArray) {
$params[$name] = (array)$params[$name];
} elseif (is_array($params[$name])) {
$isValid = false;
} elseif (
Consider simplifying this complex logical expression. Open
Open
if (
$message === false && $selector === 'other' ||
strncmp($selector, '=', 1) === 0 && (int) mb_substr($selector, 1, mb_strlen($selector, $charset), $charset) === $arg ||
$selector === 'one' && $arg - $offset == 1
) {
Consider simplifying this complex logical expression. Open
Open
if ($checkDateTimeInfo) {
$timestamp = new DateTime($value, new DateTimeZone($this->defaultTimeZone));
$info = date_parse($value);
return [
$timestamp,
Consider simplifying this complex logical expression. Open
Open
if ($date === false || ($errors !== false && ($errors['error_count'] || $errors['warning_count'])) || ($this->strictDateFormat && $date->format($format) !== $value)) {
return false;
}
Function initEventHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function initEventHandler($gridView, type, event, selector, callback)
Method formatOptionHelp
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
protected function formatOptionHelp($name, $required, $type, $defaultValue, $comment)
Method truncate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function truncate($string, $length, $suffix = '...', $encoding = null, $asHtml = false)
Method activeListInput
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
protected static function activeListInput($type, $model, $attribute, $items, $options = [])
Method tokensMatch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private function tokensMatch(SqlToken $patternToken, SqlToken $token, $offset = 0, &$firstMatchIndex = null, &$lastMatchIndex = null)
Method matchPathname
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static function matchPathname($path, $basePath, $pattern, $firstWildcard, $flags)
Method bindParam
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function bindParam($name, &$value, $dataType = null, $length = null, $driverOptions = null)
Method extractColumnSize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
protected function extractColumnSize($column, $dbType, $precision, $scale, $length)
Method extractColumnType
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
protected function extractColumnType($column, $dbType, $precision, $scale, $length)
Method buildBuckets
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private function buildBuckets($models, $link, $viaModels = null, $viaQuery = null, $checkMultiple = true)
Method on
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function on($class, $name, $handler, $data = null, $append = true)
Method hkdf
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function hkdf($algo, $inputKey, $salt = null, $info = null, $length = 0)