CORE-POS/Common-Bundle

View on GitHub

Showing 84 of 1,039 total issues

Function load has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function load()
    {
        if (empty($this->unique)) {
            return false;
        }
Severity: Minor
Found in src/BasicModel.php - About 2 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 normalizeRename has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private function normalizeRename($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
    {
        $current = $this->connection->detailedDefinition($this->name);
        $recase_columns = array();
        foreach ($this->columns as $col_name => $definition) {
Severity: Minor
Found in src/BasicModel.php - About 2 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 save has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function save()
    {
        if (!is_array($this->hooks) || empty($this->hooks)) {
            $this->loadHooks();
        }
Severity: Minor
Found in src/BasicModel.php - About 2 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 writeLog has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function writeLog($message, array $context, $intLevel)
    {
        $file = $this->getLogLocation($intLevel);
        $verboseDebug = $this->verboseDebugging();

Severity: Minor
Found in src/BaseLogger.php - About 2 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 __call has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function __call($name, $arguments)
    {
        if (!isset($this->columns[$name])) {
            foreach ($this->columns as $col => $info) {
                if (isset($info['replaces']) && $info['replaces'] == $name) {
Severity: Minor
Found in src/BasicModel.php - About 2 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

Method create has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function create()
    {
        if ($this->connection->tableExists($this->fq_name)) {
            return true;
        }
Severity: Minor
Found in src/BasicModel.php - About 1 hr to fix

    Function arrayToSQL has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function arrayToSQL($definition, $dbms)
        {
            $sql = '';
            $type = $definition['type'];
            if (isset($this->meta_types[strtoupper($type)])) {
    Severity: Minor
    Found in src/BasicModel.php - About 1 hr 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

    Method printMarkdown has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function printMarkdown($files)
        {
            $tables = array();
            $tables = array_reduce($files,
                function ($carry, $file) {
    Severity: Minor
    Found in src/BasicModel.php - About 1 hr to fix

      Method normalizeColumnAttributes has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function normalizeColumnAttributes($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
          {
              $current = $this->connection->detailedDefinition($this->name);
              $recase_columns = array();
              $redo_pk = false;
      Severity: Minor
      Found in src/BasicModel.php - About 1 hr to fix

        Method transfer has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function transfer($source_db,$select_query,$dest_db,$insert_query)
            {
                $result = $this->query($select_query,$source_db);
                if (!$result) {
                    return false;
        Severity: Minor
        Found in src/SQLManager.php - About 1 hr to fix

          Function normalizeChangeCase has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              private function normalizeChangeCase($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
              {
                  $current = $this->connection->detailedDefinition($this->name);
                  $lowercase_current = array();
                  $casemap = array();
          Severity: Minor
          Found in src/BasicModel.php - About 1 hr 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 transfer has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function transfer($source_db,$select_query,$dest_db,$insert_query)
              {
                  $result = $this->query($select_query,$source_db);
                  if (!$result) {
                      return false;
          Severity: Minor
          Found in src/SQLManager.php - About 1 hr 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

          Method save has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function save()
              {
                  if (!is_array($this->hooks) || empty($this->hooks)) {
                      $this->loadHooks();
                  }
          Severity: Minor
          Found in src/BasicModel.php - About 1 hr to fix

            Method drawPage has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function drawPage()
                {
                    $this->preFlight();
                    if ($this->preprocess()) {
            
            
            Severity: Minor
            Found in src/ui/CorePage.php - About 1 hr to fix

              Method load has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function load()
                  {
                      if (empty($this->unique)) {
                          return false;
                      }
              Severity: Minor
              Found in src/BasicModel.php - About 1 hr to fix

                Function drawPage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function drawPage()
                    {
                        $this->preFlight();
                        if ($this->preprocess()) {
                
                
                Severity: Minor
                Found in src/ui/CorePage.php - About 1 hr 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

                Method normalizeChangeCase has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function normalizeChangeCase($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
                    {
                        $current = $this->connection->detailedDefinition($this->name);
                        $lowercase_current = array();
                        $casemap = array();
                Severity: Minor
                Found in src/BasicModel.php - About 1 hr to fix

                  Method unitTest has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function unitTest($phpunit)
                      {
                          $this->__routes = array(
                              'get',
                              'get<id>',
                  Severity: Minor
                  Found in src/ui/CoreRESTfulRouter.php - About 1 hr to fix

                    Method insertRecord has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function insertRecord()
                        {
                            $sql = 'INSERT INTO '.$this->fq_name;
                            $cols = '(';
                            $vals = '(';
                    Severity: Minor
                    Found in src/BasicModel.php - About 1 hr to fix

                      Method updateRecord has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function updateRecord()
                          {
                              $sql = 'UPDATE '.$this->fq_name;
                              $sets = '';
                              $where = '1=1';
                      Severity: Minor
                      Found in src/BasicModel.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language