PHPColibri/framework

View on GitHub

Showing 31 of 31 total issues

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

    protected function buildWhere(): string
    {
        if ($this->query->getWhere() === null) {
            return '';
        }
Severity: Minor
Found in Database/AbstractDb/Driver/Query/Builder.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 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 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 tearDown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function tearDown()
    {
        if ( ! $this->useTemplate) {
            return;
        }
Severity: Minor
Found in Controller/ViewsController.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 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

Avoid too many return statements within this method.
Open

                return $value;
Severity: Major
Found in Database/Model.php - About 30 mins to fix

    Function dbChange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function dbChange(Database\Model $item, $id = null)
        {
            if ($id !== null) {
                $item->setPKValue([$id]);
            }
    Severity: Minor
    Found in Routine/Controller/RoutineViewsController.php - About 25 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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function get(array $array, string $dottedKey = null, $default = null)
        {
            if ($dottedKey === null) {
                return $array;
            }
    Severity: Minor
    Found in Util/Arr.php - About 25 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

    Severity
    Category
    Status
    Source
    Language