PHPOffice/PHPPresentation

View on GitHub

Showing 284 of 325 total issues

Method writeTxtStyle has 86 lines of code (exceeds 25 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: Major
Found in src/PhpPresentation/Writer/ODPresentation/Content.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 writeTableStyle has 85 lines of code (exceeds 25 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: Major
    Found in src/PhpPresentation/Writer/ODPresentation/Content.php - About 3 hrs to fix

      Method writeTypePie has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method writeTypeLine has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

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

              Paragraph has 27 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Paragraph implements ComparableInterface
              {
                  public const LINE_SPACING_MODE_PERCENT = 'percent';
                  public const LINE_SPACING_MODE_POINT = 'point';
              
              
              Severity: Minor
              Found in src/PhpPresentation/Shape/RichText/Paragraph.php - About 3 hrs to fix

                Cell has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Cell implements ComparableInterface
                {
                    /**
                     * Rich text paragraphs.
                     *
                Severity: Minor
                Found in src/PhpPresentation/Shape/Table/Cell.php - About 3 hrs to fix

                  Method writeTypePie3D has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Method writeRichTextStyle has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function writeRichTextStyle(XMLWriter $objWriter, RichText $shape): void
                        {
                            $oFill = $shape->getFill();
                            if (Fill::FILL_GRADIENT_LINEAR == $oFill->getFillType() || Fill::FILL_GRADIENT_PATH == $oFill->getFillType()) {
                                if (!in_array($oFill->getHashCode(), $this->arrayGradient)) {
                    Severity: Major
                    Found in src/PhpPresentation/Writer/ODPresentation/Styles.php - About 3 hrs to fix

                      Function writeAxis has a Cognitive Complexity of 22 (exceeds 5 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: Minor
                      Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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 writeChart has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function writeChart(Chart $chart): string
                          {
                              // Create XML writer
                              $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                      
                      
                      Severity: Major
                      Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.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 render has 76 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/ContentTypes.php - About 3 hrs to fix

                            Function render has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function render(): ZipInterface
                                {
                                    // Create XML writer
                                    $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                            
                            
                            Severity: Minor
                            Found in src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.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 readParagraph has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function readParagraph(RichText $oShape, DOMElement $oNodeParent): void
                                {
                                    $oParagraph = $oShape->createParagraph();
                                    if ($oNodeParent->hasAttribute('text:style-name')) {
                                        $keyStyle = $oNodeParent->getAttribute('text:style-name');
                            Severity: Minor
                            Found in src/PhpPresentation/Reader/ODPresentation.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

                            Method readStructureTextRuler has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Method writeSlide has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function writeSlide(Slide $pSlide): string
                                  {
                                      // Create XML writer
                                      $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                              
                              
                              Severity: Major
                              Found in src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php - About 2 hrs to fix

                                Method render has 69 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/ODPresentation/MetaInfManifest.php - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language