PHPOffice/PHPPresentation

View on GitHub

Showing 284 of 325 total issues

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

    Method loadStyle has 230 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function loadStyle(DOMElement $nodeStyle): bool
        {
            $keyStyle = $nodeStyle->getAttribute('style:name');
    
            $nodeDrawingPageProps = $this->oXMLReader->getElement('style:drawing-page-properties', $nodeStyle);
    Severity: Major
    Found in src/PhpPresentation/Reader/ODPresentation.php - About 1 day to fix

      Function writeStyleSlide has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function writeStyleSlide(XMLWriter $objWriter, Slide $slide, int $incPage): void
          {
              // style:style
              $objWriter->startElement('style:style');
              $objWriter->writeAttribute('style:family', 'drawing-page');
      Severity: Minor
      Found in src/PhpPresentation/Writer/ODPresentation/Content.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

      Method readRecordDocumentContainer has 223 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function readRecordDocumentContainer(string $stream, int $pos): void
          {
              $documentAtom = $this->loadRecordHeader($stream, $pos);
              $pos += 8;
              if (0x1 != $documentAtom['recVer'] || 0x000 != $documentAtom['recInstance'] || self::RT_DOCUMENTATOM != $documentAtom['recType']) {
      Severity: Major
      Found in src/PhpPresentation/Reader/PowerPoint97.php - About 1 day to fix

        PowerPoint97 has 61 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class PowerPoint97 implements ReaderInterface
        {
            public const OFFICEARTBLIPEMF = 0xF01A;
            public const OFFICEARTBLIPWMF = 0xF01B;
            public const OFFICEARTBLIPPICT = 0xF01C;
        Severity: Major
        Found in src/PhpPresentation/Reader/PowerPoint97.php - About 1 day to fix

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

              protected function writeShapeTable(XMLWriter $objWriter, Table $shape): void
              {
                  // draw:frame
                  $objWriter->startElement('draw:frame');
                  $objWriter->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters((int) $shape->getOffsetX()), 3) . 'cm');
          Severity: Minor
          Found in src/PhpPresentation/Writer/ODPresentation/Content.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

          Method readRecordOfficeArtSpContainer has 199 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function readRecordOfficeArtSpContainer(string $stream, int $pos)
              {
                  $arrayReturn = [
                      'length' => 0,
                      'shape' => null,
          Severity: Major
          Found in src/PhpPresentation/Reader/PowerPoint97.php - About 7 hrs 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

            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 writeSlideRelationships has 182 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function writeSlideRelationships(Slide $pSlide): string
                  {
                      //@todo Group all getShapeCollection()->getIterator
              
                      // Create XML writer
              Severity: Major
              Found in src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php - About 7 hrs to fix

                Method writeStyleSlide has 179 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function writeStyleSlide(XMLWriter $objWriter, Slide $slide, int $incPage): void
                    {
                        // style:style
                        $objWriter->startElement('style:style');
                        $objWriter->writeAttribute('style:family', 'drawing-page');
                Severity: Major
                Found in src/PhpPresentation/Writer/ODPresentation/Content.php - About 7 hrs to fix

                  Function displayShapeInfo has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function displayShapeInfo(AbstractShape $oShape): void
                      {
                          $this->append('<div class="infoBlk" id="div' . $oShape->getHashCode() . 'Info">');
                          $this->append('<dl>');
                          $this->append('<dt>HashCode</dt><dd>' . $oShape->getHashCode() . '</dd>');
                  Severity: Minor
                  Found in samples/Sample_Header.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

                  File Sample_Header.php has 449 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * Header file.
                   */
                  use PhpOffice\PhpPresentation\AbstractShape;
                  Severity: Minor
                  Found in samples/Sample_Header.php - About 6 hrs to fix

                    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 readRecordOfficeArtFOPT has 168 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function readRecordOfficeArtFOPT(string $stream, int $pos): array
                        {
                            $arrayReturn = [
                                'length' => 0,
                            ];
                    Severity: Major
                    Found in src/PhpPresentation/Reader/PowerPoint97.php - About 6 hrs to fix

                      File PptSlides.php has 445 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: Minor
                      Found in src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php - About 6 hrs to fix

                        RichText has 48 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class RichText extends AbstractShape implements ComparableInterface
                        {
                            /** Wrapping */
                            public const WRAP_NONE = 'none';
                            public const WRAP_SQUARE = 'square';
                        Severity: Minor
                        Found in src/PhpPresentation/Shape/RichText.php - About 6 hrs to fix

                          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

                            File PptTheme.php has 441 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: Minor
                            Found in src/PhpPresentation/Writer/PowerPoint2007/PptTheme.php - About 6 hrs to fix

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language