PHPOffice/PHPPresentation

View on GitHub

Showing 325 of 325 total issues

Method setDocumentLayout has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setDocumentLayout($pValue = self::LAYOUT_SCREEN_4X3, $isLandscape = true): self
    {
        switch ($pValue) {
            case self::LAYOUT_SCREEN_4X3:
            case self::LAYOUT_SCREEN_16X10:
Severity: Minor
Found in src/PhpPresentation/DocumentLayout.php - About 1 hr to fix

    Method loadStyleFill has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function loadStyleFill(XMLReader $xmlReader, DOMElement $oElement): ?Fill
        {
            // Gradient fill
            $oElementFill = $xmlReader->getElement('a:gradFill', $oElement);
            if ($oElementFill instanceof DOMElement) {
    Severity: Minor
    Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

      Method writeSlideComments has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function writeSlideComments(Slide $oSlide): string
          {
              /**
               * @var Comment[]
               */
      Severity: Minor
      Found in src/PhpPresentation/Writer/PowerPoint2007/PptComments.php - About 1 hr to fix

        Method loadDocumentProperties has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function loadDocumentProperties(string $sPart): void
            {
                $xmlReader = new XMLReader();
                // @phpstan-ignore-next-line
                if ($xmlReader->getDomFromString($sPart)) {
        Severity: Minor
        Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

          Method readRecordUserEditAtom has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function readRecordUserEditAtom(string $stream, int $pos): void
              {
                  $rHeader = $this->loadRecordHeader($stream, $pos);
                  $pos += 8;
                  if (0x0 != $rHeader['recVer'] || 0x000 != $rHeader['recInstance'] || self::RT_USEREDITATOM != $rHeader['recType'] || (0x0000001C != $rHeader['recLen'] && 0x00000020 != $rHeader['recLen'])) {
          Severity: Minor
          Found in src/PhpPresentation/Reader/PowerPoint97.php - About 1 hr to fix

            Function writeSeries has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function writeSeries(Chart $chart, Chart\Series $series): void
                {
                    $chartType = $chart->getPlotArea()->getType();
            
                    $numRange = count($series->getValues());
            Severity: Minor
            Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 1 hr 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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public function render(): ZipInterface
                {
                    for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
                        $shape = $this->getDrawingHashTable()->getByIndex($i);
                        if ($shape instanceof Chart) {
            Severity: Minor
            Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr 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 writeTypeDoughnut has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function writeTypeDoughnut(XMLWriter $objWriter, Doughnut $subject, bool $includeSheet = false): void
                {
                    // c:pieChart
                    $objWriter->startElement('c:doughnutChart');
            
            
            Severity: Minor
            Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr 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 writeTypeBar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, bool $includeSheet = false): void
                {
                    // c:barChart
                    $objWriter->startElement('c:barChart');
            
            
            Severity: Minor
            Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 1 hr 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 writeStylePartShadow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function writeStylePartShadow(XMLWriter $objWriter, Shadow $oShadow): void
                {
                    if (!$oShadow->isVisible()) {
                        return;
                    }
            Severity: Minor
            Found in src/PhpPresentation/Writer/ODPresentation/Content.php - About 1 hr 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 writeTableStyle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function writeTableStyle(XMLWriter $objWriter, Table $shape): void
                {
                    foreach ($shape->getRows() as $row) {
                        foreach ($row->getCells() as $cell) {
                            if (Fill::FILL_GRADIENT_LINEAR == $cell->getFill()->getFillType()) {
            Severity: Minor
            Found in src/PhpPresentation/Writer/ODPresentation/Styles.php - About 1 hr 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 loadShapeRichText has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function loadShapeRichText(DOMElement $oNodeFrame): void
                {
                    // Core
                    $oShape = $this->oPhpPresentation->getActiveSlide()->createRichTextShape();
                    $oShape->setParagraphs([]);
            Severity: Minor
            Found in src/PhpPresentation/Reader/ODPresentation.php - About 1 hr 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                private function readRecordMouseOverInteractiveInfoContainer(string $stream, int $pos): array
                {
                    $arrayReturn = [
                        'length' => 0,
                    ];
            Severity: Major
            Found in src/PhpPresentation/Reader/PowerPoint97.php and 1 other location - About 1 hr to fix
            src/PhpPresentation/Reader/PowerPoint97.php on lines 710..727

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 102.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                private function readRecordAnimationInfoContainer(string $stream, int $pos): array
                {
                    $arrayReturn = [
                        'length' => 0,
                    ];
            Severity: Major
            Found in src/PhpPresentation/Reader/PowerPoint97.php and 1 other location - About 1 hr to fix
            src/PhpPresentation/Reader/PowerPoint97.php on lines 1188..1205

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 102.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method writeSerialized has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function writeSerialized(?PhpPresentation $pPhpPresentation = null, $pFilename = '')
                {
                    // Clone $pPhpPresentation
                    $pPhpPresentation = clone $pPhpPresentation;
            
            
            Severity: Minor
            Found in src/PhpPresentation/Writer/Serialized.php - About 1 hr to fix

              Method fnSlide_BarHorizontal has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function fnSlide_BarHorizontal(PhpPresentation $objPHPPresentation): void
              {
                  global $oFill;
                  global $oShadow;
              
              
              Severity: Minor
              Found in samples/Sample_05_Chart.php - About 1 hr to fix

                Method loadSlides has 26 lines of code (exceeds 25 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 1 hr to fix

                  Method loadLayoutSlide has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function loadLayoutSlide(string $sPart, string $baseFile, SlideMaster $oSlideMaster): ?SlideLayout
                      {
                          $xmlReader = new XMLReader();
                          // @phpstan-ignore-next-line
                          if ($xmlReader->getDomFromString($sPart)) {
                  Severity: Minor
                  Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix

                    Method readRecordOfficeArtBlip has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function readRecordOfficeArtBlip(string $stream, int $pos): array
                        {
                            $arrayReturn = [
                                'length' => 0,
                                'picture' => null,
                    Severity: Minor
                    Found in src/PhpPresentation/Reader/PowerPoint97.php - About 1 hr to fix

                      Method loadPresentationProperties has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function loadPresentationProperties(string $sPart): void
                          {
                              $xmlReader = new XMLReader();
                              // @phpstan-ignore-next-line
                              if ($xmlReader->getDomFromString($sPart)) {
                      Severity: Minor
                      Found in src/PhpPresentation/Reader/PowerPoint2007.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language