Showing 9 of 9 total issues

Function whereToString has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    public function whereToString(array $array): string
    {
        $return = ' (';
        foreach($array as $columnData) {

Severity: Minor
Found in src/Omen.php - About 5 hrs 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 contentToString has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function contentToString(array $array): string
    {
        $queryPart = '';
        $itemNo = 1;
        foreach ($array as $value) {
Severity: Minor
Found in src/Omen.php - About 4 hrs 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 getAll has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAll($what = '*', $where = [], $orderBy = [], $limitOffset = [])
    {
        // What
        if(is_array($what) && count($what) > 0) {
            if(preg_match('/\((.*)\)/', $what[0], $match)) {
Severity: Minor
Found in src/Omen.php - About 3 hrs 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

File Omen.php has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Zazalt\Omen;

class Omen extends Extension\Database
Severity: Minor
Found in src/Omen.php - About 2 hrs to fix

    Method getAll has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getAll($what = '*', $where = [], $orderBy = [], $limitOffset = [])
        {
            // What
            if(is_array($what) && count($what) > 0) {
                if(preg_match('/\((.*)\)/', $what[0], $match)) {
    Severity: Minor
    Found in src/Omen.php - About 1 hr to fix

      Method whereToString has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function whereToString(array $array): string
          {
              $return = ' (';
              foreach($array as $columnData) {
      
      
      Severity: Minor
      Found in src/Omen.php - About 1 hr to fix

        Method updateRaw has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function updateRaw($content = [], $where = [])
            {
                $query = "UPDATE {$this->modelName} SET ". implode(', ', array_map(function ($value, $column) {
        
                    if(!is_bool($value) && (is_null($value) || strlen($value) == 0)) {
        Severity: Minor
        Found in src/Omen.php - About 1 hr to fix

          Function fetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public final function fetch()
              {
                  if(!$this->results) {
                      $this->statment->execute();
                      $this->results = $this->statment->fetchAll(\PDO::FETCH_ASSOC);
          Severity: Minor
          Found in src/Omen.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 insert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function insert($content = array(), $returning = array())
              {
                  $query = "INSERT INTO {$this->modelName}(\"". implode('","', array_keys($content)) ."\") VALUES (". $this->contentToString($content) .')';
          
                  if(is_array($returning) && count($returning) > 0) {
          Severity: Minor
          Found in src/Omen.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