PHPOffice/PHPPresentation

View on GitHub
src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php

Summary

Maintainability
F
1 wk
Test Coverage
B
89%

File PptCharts.php has 1413 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/PowerPoint2007/PptCharts.php - About 3 days to fix

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

        protected function writeAxis(XMLWriter $objWriter, Chart\Axis $oAxis, string $typeAxis, Chart\Type\AbstractType $typeChart): void
        {
            if (Chart\Axis::AXIS_X != $typeAxis && Chart\Axis::AXIS_Y != $typeAxis) {
                return;
            }
    Severity: Major
    Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 7 hrs to fix

      Method writeTypeBar has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, bool $includeSheet = false): void
          {
              // c:barChart
              $objWriter->startElement('c:barChart');
      
      
      Severity: Major
      Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 4 hrs to fix

        Method writeTypeBar3D has 97 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, bool $includeSheet = false): void
            {
                // c:bar3DChart
                $objWriter->startElement('c:bar3DChart');
        
        
        Severity: Major
        Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 3 hrs to fix

          Method writeTypeDoughnut has 91 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function writeTypeDoughnut(XMLWriter $objWriter, Doughnut $subject, bool $includeSheet = false): void
              {
                  // c:pieChart
                  $objWriter->startElement('c:doughnutChart');
          
          
          Severity: Major
          Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 3 hrs to fix

            Method writeTypeScatter has 88 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function writeTypeScatter(XMLWriter $objWriter, Scatter $subject, bool $includeSheet = false): void
                {
                    // c:scatterChart
                    $objWriter->startElement('c:scatterChart');
            
            
            Severity: Major
            Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 3 hrs to fix

              Method writeTypePie has 83 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function writeTypePie(XMLWriter $objWriter, Pie $subject, bool $includeSheet = false): void
                  {
                      // c:pieChart
                      $objWriter->startElement('c:pieChart');
              
              
              Severity: Major
              Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 3 hrs to fix

                Method writeTypeLine has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function writeTypeLine(XMLWriter $objWriter, Line $subject, bool $includeSheet = false): void
                    {
                        // c:lineChart
                        $objWriter->startElement('c:lineChart');
                
                
                Severity: Major
                Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 3 hrs to fix

                  Method writeTypeRadar has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function writeTypeRadar(XMLWriter $objWriter, Radar $subject, bool $includeSheet = false): void
                      {
                          // c:scatterChart
                          $objWriter->startElement('c:radarChart');
                  
                  
                  Severity: Major
                  Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 3 hrs to fix

                    Method writeTypePie3D has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function writeTypePie3D(XMLWriter $objWriter, Pie3D $subject, bool $includeSheet = false): void
                        {
                            // c:pie3DChart
                            $objWriter->startElement('c:pie3DChart');
                    
                    
                    Severity: Major
                    Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 3 hrs to fix

                      Function writeAxis has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function writeAxis(XMLWriter $objWriter, Chart\Axis $oAxis, string $typeAxis, Chart\Type\AbstractType $typeChart): void
                          {
                              if (Chart\Axis::AXIS_X != $typeAxis && Chart\Axis::AXIS_Y != $typeAxis) {
                                  return;
                              }
                      Severity: Minor
                      Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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 writeChart has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function writeChart(Chart $chart): string
                          {
                              // Create XML writer
                              $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                      
                      
                      Severity: Major
                      Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 3 hrs to fix

                        PptCharts has 23 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class PptCharts extends AbstractDecoratorWriter
                        {
                            public function render(): ZipInterface
                            {
                                for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
                        Severity: Minor
                        Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 2 hrs to fix

                          Method writeLegend has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function writeLegend(XMLWriter $objWriter, Legend $subject): void
                              {
                                  // c:legend
                                  $objWriter->startElement('c:legend');
                          
                          
                          Severity: Minor
                          Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr to fix

                            Method writeTypeArea has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function writeTypeArea(XMLWriter $objWriter, Area $subject, bool $includeSheet = false): void
                                {
                                    // c:lineChart
                                    $objWriter->startElement('c:areaChart');
                            
                            
                            Severity: Minor
                            Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr to fix

                              Method writeTitle has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function writeTitle(XMLWriter $objWriter, Title $subject): void
                                  {
                                      // c:title
                                      $objWriter->startElement('c:title');
                              
                              
                              Severity: Minor
                              Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr to fix

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

                                    protected function writeSpreadsheet(PhpPresentation $presentation, Chart $chart, string $tempName): string
                                    {
                                        // Create new spreadsheet
                                        $spreadsheet = new Spreadsheet();
                                
                                
                                Severity: Minor
                                Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr to fix

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

                                      protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, Chart $chart): void
                                      {
                                          // c:plotArea
                                          $objWriter->startElement('c:plotArea');
                                  
                                  
                                  Severity: Minor
                                  Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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 writeMultipleValuesOrReference has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected function writeMultipleValuesOrReference(XMLWriter $objWriter, bool $isReference, array $values, string $reference): void
                                      {
                                          // c:strLit / c:numLit
                                          // c:strRef / c:numRef
                                          $referenceType = ($isReference ? 'Ref' : 'Lit');
                                  Severity: Minor
                                  Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr to fix

                                    Method writePlotArea has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, Chart $chart): void
                                        {
                                            // c:plotArea
                                            $objWriter->startElement('c:plotArea');
                                    
                                    
                                    Severity: Minor
                                    Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr to fix

                                      Method writeLayout has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          protected function writeLayout(XMLWriter $objWriter, $subject): void
                                          {
                                              // c:layout
                                              $objWriter->startElement('c:layout');
                                      
                                      
                                      Severity: Minor
                                      Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr to fix

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

                                            protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, bool $includeSheet = false): void
                                            {
                                                // c:barChart
                                                $objWriter->startElement('c:barChart');
                                        
                                        
                                        Severity: Minor
                                        Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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 writeTypeDoughnut has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function writeTypeDoughnut(XMLWriter $objWriter, Doughnut $subject, bool $includeSheet = false): void
                                            {
                                                // c:pieChart
                                                $objWriter->startElement('c:doughnutChart');
                                        
                                        
                                        Severity: Minor
                                        Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function render(): ZipInterface
                                            {
                                                for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
                                                    $shape = $this->getDrawingHashTable()->getByIndex($i);
                                                    if ($shape instanceof Chart) {
                                        Severity: Minor
                                        Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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 writeTypeBar3D has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, bool $includeSheet = false): void
                                            {
                                                // c:bar3DChart
                                                $objWriter->startElement('c:bar3DChart');
                                        
                                        
                                        Severity: Minor
                                        Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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

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

                                            protected function writeSpreadsheet(PhpPresentation $presentation, Chart $chart, string $tempName): string
                                            {
                                                // Create new spreadsheet
                                                $spreadsheet = new Spreadsheet();
                                        
                                        
                                        Severity: Minor
                                        Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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 writeMultipleValuesOrReference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function writeMultipleValuesOrReference(XMLWriter $objWriter, bool $isReference, array $values, string $reference): void
                                            {
                                                // c:strLit / c:numLit
                                                // c:strRef / c:numRef
                                                $referenceType = ($isReference ? 'Ref' : 'Lit');
                                        Severity: Minor
                                        Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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