PHPOffice/PHPPresentation

View on GitHub

Showing 284 of 325 total issues

Function writeTableStyle has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    protected function writeTableStyle(XMLWriter $objWriter, Table $shape): void
    {
        foreach ($shape->getRows() as $keyRow => $shapeRow) {
            // style:style
            $objWriter->startElement('style:style');
Severity: Minor
Found in src/PhpPresentation/Writer/ODPresentation/Content.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 writeSlideAnimations has 146 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function writeSlideAnimations(XMLWriter $objWriter, Slide $oSlide): void
    {
        $arrayAnimations = $oSlide->getAnimations();
        if (empty($arrayAnimations)) {
            return;
Severity: Major
Found in src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php - About 5 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

    Method render has 138 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function render(): ZipInterface
        {
            // Create XML writer
            $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
    
    
    Severity: Major
    Found in src/PhpPresentation/Writer/PowerPoint2007/PptPresentation.php - About 5 hrs to fix

      Method writeShapeTable has 137 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

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

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            protected function writeSeriesStyle(Chart $chart, Chart\Series $series): void
            {
                $chartType = $chart->getPlotArea()->getType();
        
                // style:style
        Severity: Minor
        Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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

        Axis has 40 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Axis implements ComparableInterface
        {
            public const AXIS_X = 'x';
            public const AXIS_Y = 'y';
        
        
        Severity: Minor
        Found in src/PhpPresentation/Shape/Chart/Axis.php - About 5 hrs to fix

          Series has 40 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Series implements ComparableInterface
          {
              // Label positions
              public const LABEL_BESTFIT = 'bestFit';
              public const LABEL_BOTTOM = 'b';
          Severity: Minor
          Found in src/PhpPresentation/Shape/Chart/Series.php - About 5 hrs to fix

            Method writeNote has 131 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Method readStructureTextPFRun has 130 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

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

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

                  Method 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

                    Font has 37 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Font implements ComparableInterface
                    {
                        // Capitalization type
                        public const CAPITALIZATION_NONE = 'none';
                        public const CAPITALIZATION_SMALL = 'small';
                    Severity: Minor
                    Found in src/PhpPresentation/Style/Font.php - About 4 hrs to fix

                      Function readRecordOfficeArtClientTextbox has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function readRecordOfficeArtClientTextbox(string $stream, int $pos)
                          {
                              $arrayReturn = [
                                  'length' => 0,
                                  'text' => '',
                      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 readRecordOfficeArtClientTextbox has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        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

                          Method writeShapeTxt has 108 lines of code (exceeds 25 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: Major
                          Found in src/PhpPresentation/Writer/ODPresentation/Content.php - About 4 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language