Aerendir/PHPTextMatrix

View on GitHub

Showing 10 of 10 total issues

File PHPTextMatrix.php has 327 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

/*
Severity: Minor
Found in src/PHPTextMatrix.php - About 3 hrs to fix

    Function calculateSizes has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        private function calculateSizes(): void
        {
            // For each row...
            /**
             * @var int   $rowPosition
    Severity: Minor
    Found in src/PHPTextMatrix.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

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

        private function resolveCellsPaddings(): array
        {
            $return = [0, 0, 0, 0];
    
            // If padding is not set, return default values
    Severity: Minor
    Found in src/PHPTextMatrix.php - About 1 hr to fix

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

          private function drawLine(int $lineNumber, array $rowContent, string $sepPrefix = self::SEP_): string
          {
              $line = '';
              /**
               * @var string $columnName
      Severity: Minor
      Found in src/PHPTextMatrix.php - About 1 hr to fix

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

            private function resolveOptions(array $options = []): void
            {
                $resolver = new OptionsResolver();
                $resolver->setDefaults([
                    // The horizontal header separator
        Severity: Minor
        Found in src/PHPTextMatrix.php - About 1 hr to fix

          Function drawLine has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function drawLine(int $lineNumber, array $rowContent, string $sepPrefix = self::SEP_): string
              {
                  $line = '';
                  /**
                   * @var string $columnName
          Severity: Minor
          Found in src/PHPTextMatrix.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 splitCellsContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function splitCellsContent(): void
              {
                  // For each row...
                  /**
                   * @var int   $rowPosition
          Severity: Minor
          Found in src/PHPTextMatrix.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 resolveCellsPaddings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function resolveCellsPaddings(): array
              {
                  $return = [0, 0, 0, 0];
          
                  // If padding is not set, return default values
          Severity: Minor
          Found in src/PHPTextMatrix.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function validate(): bool
              {
                  // The number of columns
                  $numberOfColumns = null;
          
          
          Severity: Minor
          Found in src/PHPTextMatrix.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 addVerticalPadding has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function addVerticalPadding(int $rowPosition, string $columnName): void
              {
                  if (0 < $this->options[self::CELLS_PADDING][0]) {
                      // Now add the top padding
                      for ($paddingLine = 0; $paddingLine < $this->options[self::CELLS_PADDING][0]; ++$paddingLine) {
          Severity: Minor
          Found in src/PHPTextMatrix.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