PHPColibri/framework

View on GitHub
Validation/Validation.php

Summary

Maintainability
C
7 hrs
Test Coverage

Validation has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Validation
{
    /** @var string */
    public static $requiredMessage = 'поле \'%s\' является обязательным для заполнения.';
    /** @var string */
Severity: Minor
Found in Validation/Validation.php - About 2 hrs to fix

    Function isEqual has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isEqual(array $keys, $message = null)
        {
            $existingKey = null;
            foreach ($keys as $key) {
                if (isset($this->scope[$key])) {
    Severity: Minor
    Found in Validation/Validation.php - About 55 mins to fix

    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 regex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function regex($key, $pattern, $message = null)
        {
            if (is_array($key)) {
                foreach ($key as $k => $name) {
                    $this->regex($name, is_array($pattern) ? $pattern[$k] : $pattern, $message);
    Severity: Minor
    Found in Validation/Validation.php - About 35 mins to fix

    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 required has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function required($key, $message = null)
        {
            if (is_array($key)) {
                foreach ($key as $name) {
                    $this->required($name, $message);
    Severity: Minor
    Found in Validation/Validation.php - About 35 mins to fix

    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 minLength has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function minLength($key, $minLength, $message = null)
        {
            if (is_array($key)) {
                foreach ($key as $k => $name) {
                    $this->minLength($name, is_array($minLength) ? $minLength[$k] : $minLength, $message);
    Severity: Minor
    Found in Validation/Validation.php - About 35 mins to fix

    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 is has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function is($checkFunc, $key, $message)
        {
            if (is_array($key)) {
                foreach ($key as $name) {
                    $this->is($checkFunc, $name, $message);
    Severity: Minor
    Found in Validation/Validation.php - About 35 mins to fix

    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 maxLength has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function maxLength($key, $maxLength, $message = null)
        {
            if (is_array($key)) {
                foreach ($key as $k => $name) {
                    $this->maxLength($name, is_array($maxLength) ? $maxLength[$k] : $maxLength, $message);
    Severity: Minor
    Found in Validation/Validation.php - About 35 mins to fix

    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 check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function check(string $method, $key, string $message = null, callable $check)
        {
            if (is_array($key)) {
                foreach ($key as $name) {
                    $this->$method($name, $message);
    Severity: Minor
    Found in Validation/Validation.php - About 35 mins to fix

    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 isNot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isNot($checkFunc, $key, $message)
        {
            if (is_array($key)) {
                foreach ($key as $name) {
                    $this->isNot($checkFunc, $name, $message);
    Severity: Minor
    Found in Validation/Validation.php - About 35 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status