Showing 17 of 17 total issues
ArrayDataStorage
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class ArrayDataStorage implements ArrayAccess, IteratorAggregate
{
const KEY_CASE_NO_CHANGE = 0;
const KEY_CASE_SNAKE = 1;
AbstractValidator
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AbstractValidator implements MessageProvider, ArrayAccess, IteratorAggregate
{
/**
* @var null|bool Null if validation never ran, false if failed, true if passed
*/
Function postProcessRules
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function postProcessRules(array &$rules)
{
$postProcessors = [];
$hasArrayRule = false;
foreach ($rules as $attribute => &$attributeRules) {
- 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 fillParameters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function fillParameters(array $routeParams)
{
foreach ($routeParams as $key => $value) {
if (strlen($value) < 2) {
continue;
- 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 getRedirect
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getRedirect()
{
$currentRouteMethod = $this->currentRouteMethod();
if (!isset($this->errorRedirects[$currentRouteMethod])) {
- 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 isThisValid
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isThisValid($object = null)
{
$objectData = $this->getObjectData($object);
$this->lastState = $this->getState($object);
$rules = Arr::mergeByCondition($this->rules, $this->lastState);
Method getRedirect
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRedirect()
{
$currentRouteMethod = $this->currentRouteMethod();
if (!isset($this->errorRedirects[$currentRouteMethod])) {
Method postProcessRules
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postProcessRules(array &$rules)
{
$postProcessors = [];
$hasArrayRule = false;
foreach ($rules as $attribute => &$attributeRules) {
Function mergeByCondition
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function mergeByCondition(array $data, $condition = null, $allowEmpty = false)
{
if (null == $condition) {
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
Function validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate($attribute, $value, array $parameters = [])
{
if (count($parameters) < 1) {
throw new Exception("ImageDimensionValidationRule requires at least one parameter");
}
- 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 setKeyNormalizer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function setKeyNormalizer($keyCase)
{
if (null !== $this->data) {
throw new Exception("Cannot change key normalizer if data was already filled in");
}
- 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 validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function validate($attribute, $value, array $parameters = [])
{
if (count($parameters) !== 2) {
throw new Exception("ImageRatioRule requires two parameters to be passed: min and max ratio");
}
- 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 true;
Avoid too many return
statements within this method. Open
return true;
Function validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function validate($attribute, $value, array $parameters = [])
{
$result = json_decode($value, true);
if (json_last_error() !== JSON_ERROR_NONE) {
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 collectData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function collectData()
{
$data = [];
if ($this->inputTypes & self::VALIDATE_INPUT) {
- 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 validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function validate($attribute, $value, array $parameters = [])
{
if (!is_array($value)) {
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"