MAXakaWIZARD/xls-writer

View on GitHub
src/Worksheet.php

Summary

Maintainability
F
3 days
Test Coverage

File Worksheet.php has 617 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Xls;

class Worksheet extends BIFFwriter
Severity: Major
Found in src/Worksheet.php - About 1 day to fix

    Worksheet has 70 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Worksheet extends BIFFwriter
    {
        const BOF_TYPE = 0x0010;
    
        const STATE_VISIBLE = 0x00;
    Severity: Major
    Found in src/Worksheet.php - About 1 day to fix

      Method positionImage has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function positionImage($colStart, $rowStart, $x1, $y1, $width, $height)
          {
              // Initialise end cell to the same as the start cell
              $colEnd = $colStart; // Col containing lower right corner of object
              $rowEnd = $rowStart; // Row containing bottom right corner of object
      Severity: Minor
      Found in src/Worksheet.php - About 1 hr to fix

        Method insertBitmap has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function insertBitmap($row, $col, $path, $x = 0, $y = 0, $scaleX = 1, $scaleY = 1)
        Severity: Major
        Found in src/Worksheet.php - About 50 mins to fix

          Function writeRow has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function writeRow($row, $col, $val, $format = null)
              {
                  if (is_array($val)) {
                      foreach ($val as $v) {
                          if (is_array($v)) {
          Severity: Minor
          Found in src/Worksheet.php - About 45 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 positionImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected function positionImage($colStart, $rowStart, $x1, $y1, $width, $height)
          Severity: Minor
          Found in src/Worksheet.php - About 45 mins to fix

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

                    $name,
                    $index,
                    $workbook,
                    $sst,
                    $urlFormat,
            Severity: Minor
            Found in src/Worksheet.php - About 45 mins to fix

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

                  public function writeUrl($row, $col, $url, $label = '', $format = null)
              Severity: Minor
              Found in src/Worksheet.php - About 35 mins to fix

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

                    public function setValidation($row1, $col1, $row2, $col2, $validator)
                Severity: Minor
                Found in src/Worksheet.php - About 35 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return null;
                  Severity: Major
                  Found in src/Worksheet.php - About 30 mins to fix

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

                        protected function calculateActivePane($x, $y)
                        {
                            if ($x != 0 && $y != 0) {
                                return 0; // Bottom right
                            } elseif ($x != 0 && $y == 0) {
                    Severity: Minor
                    Found in src/Worksheet.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 positionImage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function positionImage($colStart, $rowStart, $x1, $y1, $width, $height)
                        {
                            // Initialise end cell to the same as the start cell
                            $colEnd = $colStart; // Col containing lower right corner of object
                            $rowEnd = $rowStart; // Row containing bottom right corner of object
                    Severity: Minor
                    Found in src/Worksheet.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

                    There are no issues that match your filters.

                    Category
                    Status