PHPOffice/PHPPresentation

View on GitHub

Showing 284 of 325 total issues

Method displayShapeInfo has 108 lines of code (exceeds 25 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: Major
Found in samples/Sample_Header.php - About 4 hrs to fix

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

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

      Method writeSeriesStyle has 103 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function writeSeriesStyle(Chart $chart, Chart\Series $series): void
          {
              $chartType = $chart->getPlotArea()->getType();
      
              // style:style
      Severity: Major
      Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 4 hrs to fix

        Method writeSlideMaster has 103 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function writeSlideMaster(SlideMaster $pSlide): string
            {
                // Create XML writer
                $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                // XML header
        Severity: Major
        Found in src/PhpPresentation/Writer/PowerPoint2007/PptSlideMasters.php - About 4 hrs to fix

          Function displayPhpPresentationInfo has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt): void
              {
                  $this->append('<div class="infoBlk" id="divPhpPresentationInfo">');
                  $this->append('<dl>');
                  $this->append('<dt>Number of slides</dt><dd>' . $oPHPPpt->getSlideCount() . '</dd>');
          Severity: Minor
          Found in samples/Sample_Header.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

          Function writeTxtStyle has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function writeTxtStyle(XMLWriter $objWriter, RichText $shape): void
              {
                  // style:style
                  $objWriter->startElement('style:style');
                  $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId);
          Severity: Minor
          Found in src/PhpPresentation/Writer/ODPresentation/Content.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

          Function readStructureTextPFRun has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              private function readStructureTextPFRun(string $stream, int $pos, int $strLenRT): array
              {
                  $arrayReturn = [
                      'length' => 0,
                      'strLenRT' => $strLenRT,
          Severity: Minor
          Found in src/PhpPresentation/Reader/PowerPoint97.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 writeContentPart has 99 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function writeContentPart(Chart $chart): string
              {
                  $this->xmlContent = new XMLWriter(XMLWriter::STORAGE_MEMORY);
          
                  $chartType = $chart->getPlotArea()->getType();
          Severity: Major
          Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 3 hrs to fix

            Function readRecordOfficeArtSpgrContainer has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = false)
                {
                    $arrayReturn = [
                        'length' => 0,
                    ];
            Severity: Minor
            Found in src/PhpPresentation/Reader/PowerPoint97.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 writeTypeBar3D has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              AbstractShape has 31 functions (exceeds 20 allowed). Consider refactoring.
              Open

              abstract class AbstractShape implements ComparableInterface
              {
                  /**
                   * Container.
                   *
              Severity: Minor
              Found in src/PhpPresentation/AbstractShape.php - About 3 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

                  File RichText.php has 323 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/Shape/RichText.php - About 3 hrs to fix

                    Method writePart has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function writePart(): string
                        {
                            // Create XML writer
                            $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                            $objWriter->startDocument('1.0', 'UTF-8');
                    Severity: Major
                    Found in src/PhpPresentation/Writer/ODPresentation/Styles.php - About 3 hrs to fix

                      Method readStructureTextCFRun has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        DocumentProperties has 30 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class DocumentProperties
                        {
                            public const PROPERTY_TYPE_BOOLEAN = 'b';
                            public const PROPERTY_TYPE_INTEGER = 'i';
                            public const PROPERTY_TYPE_FLOAT = 'f';
                        Severity: Minor
                        Found in src/PhpPresentation/DocumentProperties.php - About 3 hrs to fix

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

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

                            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

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

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

                              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
                                Severity
                                Category
                                Status
                                Source
                                Language