atelierspierrot/library

View on GitHub
src/Library/Tool/Table.php

Summary

Maintainability
F
1 wk
Test Coverage

Table has 94 functions (exceeds 20 allowed). Consider refactoring.
Open

class Table
{

    /**
     * Using this flag as `$pad_flag`, last cell is pad as an HTML `colspan` for each line if necessary
Severity: Major
Found in src/Library/Tool/Table.php - About 1 day to fix

    File Table.php has 742 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * This file is part of the Library package.
     *
     * Copyleft (ↄ) 2013-2016 Pierre Cassat <me@e-piwi.fr> and contributors
    Severity: Major
    Found in src/Library/Tool/Table.php - About 1 day to fix

      Function getTableIterator has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getTableIterator($part = 'body', $iterator_flag = self::ITERATE_ON_LINES)
          {
              $this->_repadAllLines();
              $table = $this->getTable();
              unset($table['title']);
      Severity: Minor
      Found in src/Library/Tool/Table.php - About 7 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 render has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          public function render($str_pad_flag = STR_PAD_RIGHT)
          {
              $stacks = array();
              if ($this->column_size===0 && $this->line_size===0 && $this->cell_size===0) {
                  $this->_parseTableSizes();
      Severity: Minor
      Found in src/Library/Tool/Table.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 _parseTableSizes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _parseTableSizes($reset = false)
          {
              if ($reset) $this->_resetSizes();
              $this->line_size = count($this->tbody);
              foreach (self::$_table_parts as $part) {
      Severity: Minor
      Found in src/Library/Tool/Table.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 render has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function render($str_pad_flag = STR_PAD_RIGHT)
          {
              $stacks = array();
              if ($this->column_size===0 && $this->line_size===0 && $this->cell_size===0) {
                  $this->_parseTableSizes();
      Severity: Major
      Found in src/Library/Tool/Table.php - About 2 hrs to fix

        Function _setPartCell has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _setPartCell($content, $line_index, $cell_index, $part, $action = 'replace')
            {
                if (property_exists($this, $part)) {
                    if (is_null($line_index)) {
                        end($this->{$part});
        Severity: Minor
        Found in src/Library/Tool/Table.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 getTableIterator has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getTableIterator($part = 'body', $iterator_flag = self::ITERATE_ON_LINES)
            {
                $this->_repadAllLines();
                $table = $this->getTable();
                unset($table['title']);
        Severity: Minor
        Found in src/Library/Tool/Table.php - About 1 hr to fix

          Function _setPartColumn has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _setPartColumn(array $contents, $column_index, $default, $part, $action = 'replace')
              {
                  if (property_exists($this, $part)) {
                      if (is_null($column_index) || $column_index>$this->getColumnSize()) {
                          $column_index = $this->getColumnSize();
          Severity: Minor
          Found in src/Library/Tool/Table.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 _getPartCell has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _getPartCell($line_index, $cell_index, $part)
              {
                  if (property_exists($this, $part)) {
                      if (is_null($line_index)) {
                          $line_index = $this->getLineSize();
          Severity: Minor
          Found in src/Library/Tool/Table.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 _repadAllLines has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _repadAllLines()
              {
                  $this->_parseTableSizes(true);
                  foreach (self::$_table_parts as $part) {
                      if (!empty($this->{$part}) && is_array($this->{$part})) {
          Severity: Minor
          Found in src/Library/Tool/Table.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 _setPartCell has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _setPartCell($content, $line_index, $cell_index, $part, $action = 'replace')
              {
                  if (property_exists($this, $part)) {
                      if (is_null($line_index)) {
                          end($this->{$part});
          Severity: Minor
          Found in src/Library/Tool/Table.php - About 1 hr to fix

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

                protected function _setPartLine(array $contents, $line_index, $part, $action = 'replace')
                {
                    if (property_exists($this, $part)) {
                        if (is_null($line_index)) {
                            end($this->{$part});
            Severity: Minor
            Found in src/Library/Tool/Table.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

            Method _setPartColumn has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                protected function _setPartColumn(array $contents, $column_index, $default, $part, $action = 'replace')
            Severity: Minor
            Found in src/Library/Tool/Table.php - About 35 mins to fix

              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      array $body = array(), array $header = array(), array $footer = array(),
                      $title = null, $pad_flag = self::PAD_BY_EMPTY_CELLS
              Severity: Minor
              Found in src/Library/Tool/Table.php - About 35 mins to fix

                Method _setPartCell has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    protected function _setPartCell($content, $line_index, $cell_index, $part, $action = 'replace')
                Severity: Minor
                Found in src/Library/Tool/Table.php - About 35 mins to fix

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

                      protected function _getPartColumn($column_index, $part)
                      {
                          if (property_exists($this, $part)) {
                              if (is_null($column_index)) {
                                  $column_index = $this->getColumnSize();
                  Severity: Minor
                  Found in src/Library/Tool/Table.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