PHPOffice/PHPPresentation

View on GitHub
src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php

Summary

Maintainability
F
6 days
Test Coverage
A
99%

File ObjectsChart.php has 721 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This file is part of PHPPresentation - A pure PHP library for reading and writing
 * presentations documents.
 *
Severity: Major
Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 1 day to fix

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

        protected function writeSeriesStyle(Chart $chart, Chart\Series $series): void
        {
            $chartType = $chart->getPlotArea()->getType();
    
            // style:style
    Severity: Minor
    Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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

    Method writeSeriesStyle has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function writeSeriesStyle(Chart $chart, Chart\Series $series): void
        {
            $chartType = $chart->getPlotArea()->getType();
    
            // style:style
    Severity: Major
    Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 4 hrs to fix

      Method writeContentPart has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function writeContentPart(Chart $chart): string
          {
              $this->xmlContent = new XMLWriter(XMLWriter::STORAGE_MEMORY);
      
              $chartType = $chart->getPlotArea()->getType();
      Severity: Major
      Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 3 hrs to fix

        Function writeTable has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function writeTable(): void
            {
                // table:table
                $this->xmlContent->startElement('table:table');
                $this->xmlContent->writeAttribute('table:name', 'table-local');
        Severity: Minor
        Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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 writeTable has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function writeTable(): void
            {
                // table:table
                $this->xmlContent->startElement('table:table');
                $this->xmlContent->writeAttribute('table:name', 'table-local');
        Severity: Major
        Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 2 hrs to fix

          ObjectsChart has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ObjectsChart extends AbstractDecoratorWriter
          {
              /**
               * @var XMLWriter
               */
          Severity: Minor
          Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 2 hrs to fix

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

                protected function writePlotAreaStyle(Chart $chart): void
                {
                    $chartType = $chart->getPlotArea()->getType();
            
                    // style:style
            Severity: Minor
            Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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 writePlotAreaStyle has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function writePlotAreaStyle(Chart $chart): void
                {
                    $chartType = $chart->getPlotArea()->getType();
            
                    // style:style
            Severity: Major
            Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 2 hrs to fix

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

                  protected function writeSeries(Chart $chart, Chart\Series $series): void
                  {
                      $chartType = $chart->getPlotArea()->getType();
              
                      $numRange = count($series->getValues());
              Severity: Minor
              Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 1 hr to fix

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

                    protected function writeAxisMainStyle(Axis $axis, string $styleName, AbstractType $chartType): void
                    {
                        // style:style
                        $this->xmlContent->startElement('style:style');
                        $this->xmlContent->writeAttribute('style:name', $styleName);
                Severity: Minor
                Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 1 hr to fix

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

                      protected function writeContentPart(Chart $chart): string
                      {
                          $this->xmlContent = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                  
                          $chartType = $chart->getPlotArea()->getType();
                  Severity: Minor
                  Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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 writePlotArea has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function writePlotArea(Chart $chart): void
                      {
                          $chartType = $chart->getPlotArea()->getType();
                  
                          // chart:plot-area
                  Severity: Minor
                  Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 1 hr to fix

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

                        protected function writeAxis(Chart $chart): void
                        {
                            $chartType = $chart->getPlotArea()->getType();
                    
                            // chart:axis
                    Severity: Minor
                    Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 1 hr to fix

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

                          protected function writeSeries(Chart $chart, Chart\Series $series): void
                          {
                              $chartType = $chart->getPlotArea()->getType();
                      
                              $numRange = count($series->getValues());
                      Severity: Minor
                      Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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 writeLegend has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function writeLegend(Chart $chart): void
                          {
                              // chart:legend
                              $this->xmlContent->startElement('chart:legend');
                              switch ($chart->getLegend()->getPosition()) {
                      Severity: Minor
                      Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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 writePlotArea has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function writePlotArea(Chart $chart): void
                          {
                              $chartType = $chart->getPlotArea()->getType();
                      
                              // chart:plot-area
                      Severity: Minor
                      Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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