PHPOffice/PHPPresentation

View on GitHub
src/PhpPresentation/Reader/PowerPoint2007.php

Summary

Maintainability
F
3 wks
Test Coverage
D
67%

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

    Function loadParagraph has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function loadParagraph(XMLReader $document, DOMElement $oElement, $oShape): void
        {
            // Core
            $oParagraph = $oShape->createParagraph();
            $oParagraph->setRichTextElements([]);
    Severity: Minor
    Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 2 days 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 loadShapeTable has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function loadShapeTable(XMLReader $document, DOMElement $node, AbstractSlide $oSlide): void
        {
            $this->fileRels = $oSlide->getRelsIndex();
    
            $oShape = $oSlide->createTableShape();
    Severity: Minor
    Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 2 days 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 loadMasterSlide has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function loadMasterSlide(string $sPart, string $baseFile): void
        {
            $xmlReader = new XMLReader();
            // @phpstan-ignore-next-line
            if ($xmlReader->getDomFromString($sPart)) {
    Severity: Minor
    Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 day 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 loadShapeDrawing has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function loadShapeDrawing(XMLReader $document, DOMElement $node, AbstractSlide $oSlide): void
        {
            // Core
            $document->registerNamespace('asvg', 'http://schemas.microsoft.com/office/drawing/2016/SVG/main');
            if ($document->getElement('p:blipFill/a:blip/a:extLst/a:ext/asvg:svgBlip', $node)) {
    Severity: Minor
    Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadParagraph has 166 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function loadParagraph(XMLReader $document, DOMElement $oElement, $oShape): void
        {
            // Core
            $oParagraph = $oShape->createParagraph();
            $oParagraph->setRichTextElements([]);
    Severity: Major
    Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 6 hrs to fix

      Function loadSlide has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function loadSlide(string $sPart, string $baseFile): void
          {
              $xmlReader = new XMLReader();
              // @phpstan-ignore-next-line
              if ($xmlReader->getDomFromString($sPart)) {
      Severity: Minor
      Found in src/PhpPresentation/Reader/PowerPoint2007.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

      Function loadShapeRichText has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function loadShapeRichText(XMLReader $document, DOMElement $node, $oSlide): void
          {
              // Core
              $oShape = $oSlide->createRichTextShape();
              $oShape->setParagraphs([]);
      Severity: Minor
      Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadShapeTable has 124 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function loadShapeTable(XMLReader $document, DOMElement $node, AbstractSlide $oSlide): void
          {
              $this->fileRels = $oSlide->getRelsIndex();
      
              $oShape = $oSlide->createTableShape();
      Severity: Major
      Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 4 hrs to fix

        Function loadShadow has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function loadShadow(XMLReader $document, DOMElement $node): ?Shadow
            {
                if ($node instanceof DOMElement) {
                    $aNodes = $document->getElements('*', $node);
                    foreach ($aNodes as $nodeShadow) {
        Severity: Minor
        Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 4 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 loadMasterSlide has 112 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function loadMasterSlide(string $sPart, string $baseFile): void
            {
                $xmlReader = new XMLReader();
                // @phpstan-ignore-next-line
                if ($xmlReader->getDomFromString($sPart)) {
        Severity: Major
        Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 4 hrs to fix

          Function loadSlides has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function loadSlides(string $sPart): void
              {
                  $xmlReader = new XMLReader();
                  // @phpstan-ignore-next-line
                  if ($xmlReader->getDomFromString($sPart)) {
          Severity: Minor
          Found in src/PhpPresentation/Reader/PowerPoint2007.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

          PowerPoint2007 has 29 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class PowerPoint2007 implements ReaderInterface
          {
              /**
               * Output Object.
               *
          Severity: Minor
          Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 3 hrs to fix

            Function loadCustomProperties has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function loadCustomProperties(string $sPart): void
                {
                    $xmlReader = new XMLReader();
                    $sPart = str_replace(' xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"', '', $sPart);
                    // @phpstan-ignore-next-line
            Severity: Minor
            Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadShapeDrawing has 83 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function loadShapeDrawing(XMLReader $document, DOMElement $node, AbstractSlide $oSlide): void
                {
                    // Core
                    $document->registerNamespace('asvg', 'http://schemas.microsoft.com/office/drawing/2016/SVG/main');
                    if ($document->getElement('p:blipFill/a:blip/a:extLst/a:ext/asvg:svgBlip', $node)) {
            Severity: Major
            Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 3 hrs to fix

              Method loadShapeRichText has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function loadShapeRichText(XMLReader $document, DOMElement $node, $oSlide): void
                  {
                      // Core
                      $oShape = $oSlide->createRichTextShape();
                      $oShape->setParagraphs([]);
              Severity: Major
              Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 3 hrs to fix

                Method loadSlide has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function loadSlide(string $sPart, string $baseFile): void
                    {
                        $xmlReader = new XMLReader();
                        // @phpstan-ignore-next-line
                        if ($xmlReader->getDomFromString($sPart)) {
                Severity: Major
                Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 2 hrs to fix

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

                      protected function loadTheme(string $sPart, SlideMaster $oSlideMaster): void
                      {
                          $xmlReader = new XMLReader();
                          // @phpstan-ignore-next-line
                          if ($xmlReader->getDomFromString($sPart)) {
                  Severity: Minor
                  Found in src/PhpPresentation/Reader/PowerPoint2007.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

                  Function loadPresentationProperties has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function loadPresentationProperties(string $sPart): void
                      {
                          $xmlReader = new XMLReader();
                          // @phpstan-ignore-next-line
                          if ($xmlReader->getDomFromString($sPart)) {
                  Severity: Minor
                  Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadDocumentLayout has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function loadDocumentLayout(string $sPart): void
                      {
                          $xmlReader = new XMLReader();
                          // @phpstan-ignore-next-line
                          if ($xmlReader->getDomFromString($sPart)) {
                  Severity: Minor
                  Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadCustomProperties has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function loadCustomProperties(string $sPart): void
                      {
                          $xmlReader = new XMLReader();
                          $sPart = str_replace(' xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"', '', $sPart);
                          // @phpstan-ignore-next-line
                  Severity: Minor
                  Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

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

                        protected function loadSlideBackground(XMLReader $xmlReader, DOMElement $oElement, AbstractSlide $oSlide): void
                        {
                            // Background color
                            $oElementColor = $xmlReader->getElement('p:bgPr/a:solidFill/a:srgbClr', $oElement);
                            if ($oElementColor instanceof DOMElement) {
                    Severity: Minor
                    Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

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

                          protected function loadShadow(XMLReader $document, DOMElement $node): ?Shadow
                          {
                              if ($node instanceof DOMElement) {
                                  $aNodes = $document->getElements('*', $node);
                                  foreach ($aNodes as $nodeShadow) {
                      Severity: Minor
                      Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

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

                            protected function loadSlideBackground(XMLReader $xmlReader, DOMElement $oElement, AbstractSlide $oSlide): void
                            {
                                // Background color
                                $oElementColor = $xmlReader->getElement('p:bgPr/a:solidFill/a:srgbClr', $oElement);
                                if ($oElementColor instanceof DOMElement) {
                        Severity: Minor
                        Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadDocumentProperties has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function loadDocumentProperties(string $sPart): void
                            {
                                $xmlReader = new XMLReader();
                                // @phpstan-ignore-next-line
                                if ($xmlReader->getDomFromString($sPart)) {
                        Severity: Minor
                        Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadSlideShapes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function loadSlideShapes($oSlide, DOMNodeList $oElements, XMLReader $xmlReader): void
                            {
                                foreach ($oElements as $oNode) {
                                    if (!($oNode instanceof DOMElement)) {
                                        continue;
                        Severity: Minor
                        Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadFile has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function loadFile(string $pFilename): PhpPresentation
                            {
                                $this->oPhpPresentation = new PhpPresentation();
                                $this->oPhpPresentation->removeSlideByIndex();
                                $this->oPhpPresentation->setAllMasterSlides([]);
                        Severity: Minor
                        Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

                          Function loadRels has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function loadRels(string $fileRels): void
                              {
                                  $sPart = $this->oZip->getFromName($fileRels);
                                  if (false !== $sPart) {
                                      $xmlReader = new XMLReader();
                          Severity: Minor
                          Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadStyleFill has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function loadStyleFill(XMLReader $xmlReader, DOMElement $oElement): ?Fill
                              {
                                  // Gradient fill
                                  $oElementFill = $xmlReader->getElement('a:gradFill', $oElement);
                                  if ($oElementFill instanceof DOMElement) {
                          Severity: Minor
                          Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadLayoutSlide has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function loadLayoutSlide(string $sPart, string $baseFile, SlideMaster $oSlideMaster): ?SlideLayout
                              {
                                  $xmlReader = new XMLReader();
                                  // @phpstan-ignore-next-line
                                  if ($xmlReader->getDomFromString($sPart)) {
                          Severity: Minor
                          Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadStyleFill has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function loadStyleFill(XMLReader $xmlReader, DOMElement $oElement): ?Fill
                              {
                                  // Gradient fill
                                  $oElementFill = $xmlReader->getElement('a:gradFill', $oElement);
                                  if ($oElementFill instanceof DOMElement) {
                          Severity: Minor
                          Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

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

                                protected function loadDocumentProperties(string $sPart): void
                                {
                                    $xmlReader = new XMLReader();
                                    // @phpstan-ignore-next-line
                                    if ($xmlReader->getDomFromString($sPart)) {
                            Severity: Minor
                            Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

                              Method loadSlides has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function loadSlides(string $sPart): void
                                  {
                                      $xmlReader = new XMLReader();
                                      // @phpstan-ignore-next-line
                                      if ($xmlReader->getDomFromString($sPart)) {
                              Severity: Minor
                              Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

                                Method loadPresentationProperties has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function loadPresentationProperties(string $sPart): void
                                    {
                                        $xmlReader = new XMLReader();
                                        // @phpstan-ignore-next-line
                                        if ($xmlReader->getDomFromString($sPart)) {
                                Severity: Minor
                                Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

                                  Method loadLayoutSlide has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected function loadLayoutSlide(string $sPart, string $baseFile, SlideMaster $oSlideMaster): ?SlideLayout
                                      {
                                          $xmlReader = new XMLReader();
                                          // @phpstan-ignore-next-line
                                          if ($xmlReader->getDomFromString($sPart)) {
                                  Severity: Minor
                                  Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

                                    Function loadMasterSlides has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        protected function loadMasterSlides(XMLReader $xmlReader, string $fileRels): void
                                        {
                                            // Get all the MasterSlide Id's from the presentation.xml file
                                            foreach ($xmlReader->getElements('/p:presentation/p:sldMasterIdLst/p:sldMasterId') as $oElement) {
                                                if (!($oElement instanceof DOMElement)) {
                                    Severity: Minor
                                    Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 55 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

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                if ('..' == $partPath) {
                                                                    unset($pathImage[$key - 1], $pathImage[$key]);
                                                                }
                                    Severity: Major
                                    Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if (!$image) {
                                                                  return;
                                                              }
                                      Severity: Major
                                      Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 45 mins to fix

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

                                            protected function loadViewProperties(string $sPart): void
                                            {
                                                $xmlReader = new XMLReader();
                                                // @phpstan-ignore-next-line
                                                if ($xmlReader->getDomFromString($sPart)) {
                                        Severity: Minor
                                        Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function loadFile(string $pFilename): PhpPresentation
                                            {
                                                $this->oPhpPresentation = new PhpPresentation();
                                                $this->oPhpPresentation->removeSlideByIndex();
                                                $this->oPhpPresentation->setAllMasterSlides([]);
                                        Severity: Minor
                                        Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadStyleBorder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function loadStyleBorder(XMLReader $xmlReader, DOMElement $oElement, Border $oBorder): void
                                            {
                                                if ($oElement->hasAttribute('w')) {
                                                    $oBorder->setLineWidth((int) ((int) $oElement->getAttribute('w') / 12700));
                                                }
                                        Severity: Minor
                                        Found in src/PhpPresentation/Reader/PowerPoint2007.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 loadHyperlink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function loadHyperlink(XMLReader $xmlReader, DOMElement $element, Hyperlink $hyperlink): Hyperlink
                                            {
                                                if ($element->hasAttribute('tooltip')) {
                                                    $hyperlink->setTooltip($element->getAttribute('tooltip'));
                                                }
                                        Severity: Minor
                                        Found in src/PhpPresentation/Reader/PowerPoint2007.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

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                                        if ($oElementColor instanceof DOMElement) {
                                                            // Color
                                                            $oColor = new SchemeColor();
                                                            $oColor->setValue($oElementColor->hasAttribute('val') ? $oElementColor->getAttribute('val') : null);
                                                            // Background
                                        Severity: Minor
                                        Found in src/PhpPresentation/Reader/PowerPoint2007.php and 1 other location - About 35 mins to fix
                                        src/PhpPresentation/Reader/PowerPoint2007.php on lines 445..455

                                        Duplicated Code

                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                        Tuning

                                        This issue has a mass of 92.

                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                        Refactorings

                                        Further Reading

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                                        if ($oElementColor instanceof DOMElement) {
                                                            // Color
                                                            $oColor = new Color();
                                                            $oColor->setRGB($oElementColor->hasAttribute('val') ? $oElementColor->getAttribute('val') : null);
                                                            // Background
                                        Severity: Minor
                                        Found in src/PhpPresentation/Reader/PowerPoint2007.php and 1 other location - About 35 mins to fix
                                        src/PhpPresentation/Reader/PowerPoint2007.php on lines 457..467

                                        Duplicated Code

                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                        Tuning

                                        This issue has a mass of 92.

                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                        Refactorings

                                        Further Reading

                                        There are no issues that match your filters.

                                        Category
                                        Status