PHPOffice/PHPPresentation

View on GitHub

Showing 325 of 325 total issues

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

                Function writeDrawingRelations has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function writeDrawingRelations(AbstractSlideAlias $pSlideMaster, XMLWriter $objWriter, int $relId)
                    {
                        if (count($pSlideMaster->getShapeCollection()) > 0) {
                            // Loop trough images and write relationships
                            foreach ($pSlideMaster->getShapeCollection() as $shape) {
                Severity: Minor
                Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.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 loadDocumentProperties has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function loadDocumentProperties(): void
                    {
                        $arrayProperties = [
                            '/office:document-meta/office:meta/meta:initial-creator' => 'setCreator',
                            '/office:document-meta/office:meta/dc:creator' => 'setLastModifiedBy',
                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

                Function loadCurrentUserStream has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function loadCurrentUserStream(): void
                    {
                        $pos = 0;
                
                        /**
                Severity: Minor
                Found in src/PhpPresentation/Reader/PowerPoint97.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 fnSlide_BarPercentStacked has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function fnSlide_BarPercentStacked(PhpPresentation $objPHPPresentation): void
                {
                    global $oFill;
                    global $oShadow;
                
                
                Severity: Major
                Found in samples/Sample_05_Chart.php - About 2 hrs to fix

                  Legend has 24 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Legend implements ComparableInterface
                  {
                      /** Legend positions */
                      public const POSITION_BOTTOM = 'b';
                      public const POSITION_LEFT = 'l';
                  Severity: Minor
                  Found in src/PhpPresentation/Shape/Chart/Legend.php - About 2 hrs to fix

                    PhpPresentation has 24 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class PhpPresentation
                    {
                        /**
                         * Document properties.
                         *
                    Severity: Minor
                    Found in src/PhpPresentation/PhpPresentation.php - About 2 hrs to fix

                      Function save has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function save(string $pFilename): void
                          {
                              if (empty($pFilename)) {
                                  throw new InvalidParameterException('pFilename', '');
                              }
                      Severity: Minor
                      Found in src/PhpPresentation/Writer/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

                      Function save has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function save(string $pFilename): void
                          {
                              if (empty($pFilename)) {
                                  throw new InvalidParameterException('pFilename', '');
                              }
                      Severity: Minor
                      Found in src/PhpPresentation/Writer/PowerPoint2007.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 writeShapeLine has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

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