PHPOffice/PHPPresentation

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

Summary

Maintainability
F
1 wk
Test Coverage
A
90%

File AbstractSlide.php has 1261 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/AbstractSlide.php - About 3 days to fix

    Method writeSlideTransition has 235 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function writeSlideTransition(XMLWriter $objWriter, ?Slide\Transition $transition): void
        {
            if (!$transition) {
                return;
            }
    Severity: Major
    Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 1 day to fix

      Function writeSlideTransition has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function writeSlideTransition(XMLWriter $objWriter, ?Slide\Transition $transition): void
          {
              if (!$transition) {
                  return;
              }
      Severity: Minor
      Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.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 writeShapeText has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function writeShapeText(XMLWriter $objWriter, RichText $shape, int $shapeId): void
          {
              // p:sp
              $objWriter->startElement('p:sp');
              // p:sp\p:nvSpPr
      Severity: Minor
      Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 6 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 writeShapeTable has 137 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function writeShapeTable(XMLWriter $objWriter, ShapeTable $shape, int $shapeId): void
          {
              // p:graphicFrame
              $objWriter->startElement('p:graphicFrame');
              // p:graphicFrame/p:nvGraphicFramePr
      Severity: Major
      Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 5 hrs to fix

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

            protected function writeShapeTable(XMLWriter $objWriter, ShapeTable $shape, int $shapeId): void
            {
                // p:graphicFrame
                $objWriter->startElement('p:graphicFrame');
                // p:graphicFrame/p:nvGraphicFramePr
        Severity: Minor
        Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.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 writeNote has 131 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function writeNote(Note $pNote): string
            {
                // Create XML writer
                $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
        
        
        Severity: Major
        Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 5 hrs to fix

          Method writeShapeText has 126 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function writeShapeText(XMLWriter $objWriter, RichText $shape, int $shapeId): void
              {
                  // p:sp
                  $objWriter->startElement('p:sp');
                  // p:sp\p:nvSpPr
          Severity: Major
          Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 5 hrs to fix

            Method writeShapePic has 95 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function writeShapePic(XMLWriter $objWriter, AbstractGraphic $shape, int $shapeId): void
                {
                    // p:pic
                    $objWriter->startElement('p:pic');
            
            
            Severity: Major
            Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 3 hrs to fix

              Function writeDrawingRelations has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function writeDrawingRelations(AbstractSlideAlias $pSlideMaster, XMLWriter $objWriter, int $relId)
                  {
                      if (count($pSlideMaster->getShapeCollection()) > 0) {
                          // Loop trough images and write relationships
                          foreach ($pSlideMaster->getShapeCollection() as $shape) {
              Severity: Minor
              Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.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 writeShapeLine has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function writeShapeLine(XMLWriter $objWriter, Line $shape, int $shapeId): void
                  {
                      // p:sp
                      $objWriter->startElement('p:cxnSp');
                      // p:nvSpPr
              Severity: Major
              Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 2 hrs to fix

                Method writeParagraphStyles has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function writeParagraphStyles(XMLWriter $objWriter, Paragraph $paragraph, bool $isPlaceholder = false): void
                    {
                        $objWriter->startElement('a:pPr');
                        $objWriter->writeAttribute('algn', $paragraph->getAlignment()->getHorizontal());
                        $objWriter->writeAttribute('rtl', $paragraph->getAlignment()->isRTL() ? '1' : '0');
                Severity: Major
                Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 2 hrs to fix

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

                      protected function writeParagraphStyles(XMLWriter $objWriter, Paragraph $paragraph, bool $isPlaceholder = false): void
                      {
                          $objWriter->startElement('a:pPr');
                          $objWriter->writeAttribute('algn', $paragraph->getAlignment()->getHorizontal());
                          $objWriter->writeAttribute('rtl', $paragraph->getAlignment()->isRTL() ? '1' : '0');
                  Severity: Minor
                  Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.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 writeDrawingRelations has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function writeDrawingRelations(AbstractSlideAlias $pSlideMaster, XMLWriter $objWriter, int $relId)
                      {
                          if (count($pSlideMaster->getShapeCollection()) > 0) {
                              // Loop trough images and write relationships
                              foreach ($pSlideMaster->getShapeCollection() as $shape) {
                  Severity: Minor
                  Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 1 hr to fix

                    Method writeShapeAutoShape has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function writeShapeAutoShape(XMLWriter $objWriter, AutoShape $shape, int $shapeId): void
                        {
                            // p:sp
                            $objWriter->startElement('p:sp');
                    
                    
                    Severity: Minor
                    Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 1 hr to fix

                      Method writeShapeChart has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function writeShapeChart(XMLWriter $objWriter, ShapeChart $shape, int $shapeId): void
                          {
                              // p:graphicFrame
                              $objWriter->startElement('p:graphicFrame');
                              // p:nvGraphicFramePr
                      Severity: Minor
                      Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 1 hr to fix

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

                            protected function writeSlideBackground(AbstractSlideAlias $pSlide, XMLWriter $objWriter): void
                            {
                                if (!($pSlide->getBackground() instanceof Slide\AbstractBackground)) {
                                    return;
                                }
                        Severity: Minor
                        Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 1 hr to fix

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

                              protected function writeShapeCollection(XMLWriter $objWriter, $shapes = [], &$shapeId = 1): void
                              {
                                  if (0 == count($shapes)) {
                                      return;
                                  }
                          Severity: Minor
                          Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.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 writeParagraphs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function writeParagraphs(XMLWriter $objWriter, array $paragraphs): void
                              {
                                  // Loop trough paragraphs
                                  foreach ($paragraphs as $paragraph) {
                                      // a:p
                          Severity: Minor
                          Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.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 writeRunStyles has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function writeRunStyles(XMLWriter $objWriter, Run $element): void
                              {
                                  // a:rPr
                                  $objWriter->startElement('a:rPr');
                          
                          
                          Severity: Minor
                          Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 1 hr to fix

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

                                protected function writeShapeGroup(XMLWriter $objWriter, Group $group, int &$shapeId): void
                                {
                                    // p:grpSp
                                    $objWriter->startElement('p:grpSp');
                                    // p:nvGrpSpPr
                            Severity: Minor
                            Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 1 hr to fix

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

                                  protected function writeShapePic(XMLWriter $objWriter, AbstractGraphic $shape, int $shapeId): void
                                  {
                                      // p:pic
                                      $objWriter->startElement('p:pic');
                              
                              
                              Severity: Minor
                              Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.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 writeShapeLine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function writeShapeLine(XMLWriter $objWriter, Line $shape, int $shapeId): void
                                  {
                                      // p:sp
                                      $objWriter->startElement('p:cxnSp');
                                      // p:nvSpPr
                              Severity: Minor
                              Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.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