PHPOffice/PHPPresentation

View on GitHub

Showing 284 of 325 total issues

File PowerPoint97.php has 2279 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/PowerPoint97.php - About 6 days to fix

    Function writeSlideRelationships has a Cognitive Complexity of 270 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function writeSlideRelationships(Slide $pSlide): string
        {
            //@todo Group all getShapeCollection()->getIterator
    
            // Create XML writer
    Severity: Minor
    Found in src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php - About 5 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 readRecordOfficeArtSpContainer has a Cognitive Complexity of 224 (exceeds 5 allowed). Consider refactoring.
    Open

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

    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

      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

        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

          File Content.php has 1078 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Function loadStyle has a Cognitive Complexity of 119 (exceeds 5 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: Minor
            Found in src/PhpPresentation/Reader/ODPresentation.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

            Method writeTheme has 422 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function writeTheme(Slide\SlideMaster $oMasterSlide): string
                {
                    $arrayFont = [
                        'Jpan' => 'MS Pゴシック',
                        'Hang' => '맑은 고딕',
            Severity: Major
            Found in src/PhpPresentation/Writer/PowerPoint2007/PptTheme.php - About 2 days to fix

              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

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

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

                Function readRecordDocumentContainer has a Cognitive Complexity of 77 (exceeds 5 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: Minor
                Found in src/PhpPresentation/Reader/PowerPoint97.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 readRecordOfficeArtFOPT has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function readRecordOfficeArtFOPT(string $stream, int $pos): array
                    {
                        $arrayReturn = [
                            'length' => 0,
                        ];
                Severity: Minor
                Found in src/PhpPresentation/Reader/PowerPoint97.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 writeContent has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function writeContent(): string
                    {
                        // Create XML writer
                        $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                        $objWriter->startDocument('1.0', 'UTF-8');
                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

                File ODPresentation.php has 596 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/ODPresentation.php - About 1 day to fix

                  Function writeShapeTxt has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function writeShapeTxt(XMLWriter $objWriter, RichText $shape): void
                      {
                          // draw:frame
                          $objWriter->startElement('draw:frame');
                          $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId);
                  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

                  File Sample_05_Chart.php has 583 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  include_once 'Sample_Header.php';
                  
                  use PhpOffice\PhpPresentation\PhpPresentation;
                  Severity: Major
                  Found in samples/Sample_05_Chart.php - About 1 day to fix

                    Method writeContent has 246 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function writeContent(): string
                        {
                            // Create XML writer
                            $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                            $objWriter->startDocument('1.0', 'UTF-8');
                    Severity: Major
                    Found in src/PhpPresentation/Writer/ODPresentation/Content.php - About 1 day to fix
                      Severity
                      Category
                      Status
                      Source
                      Language