PHPOffice/PHPPresentation

View on GitHub

Showing 325 of 325 total issues

PptCharts has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class PptCharts extends AbstractDecoratorWriter
{
    public function render(): ZipInterface
    {
        for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
Severity: Minor
Found in src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php - About 2 hrs to fix

    Alignment has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Alignment implements ComparableInterface
    {
        // Horizontal alignment
        public const HORIZONTAL_GENERAL = 'l';
        public const HORIZONTAL_LEFT = 'l';
    Severity: Minor
    Found in src/PhpPresentation/Style/Alignment.php - About 2 hrs to fix

      File Font.php has 268 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/Style/Font.php - About 2 hrs to fix

        Function writeTable has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function writeTable(): void
            {
                // table:table
                $this->xmlContent->startElement('table:table');
                $this->xmlContent->writeAttribute('table:name', 'table-local');
        Severity: Minor
        Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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 writeRichTextStyle has a Cognitive Complexity of 18 (exceeds 5 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: Minor
        Found in src/PhpPresentation/Writer/ODPresentation/Styles.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 writeTable has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function writeTable(): void
            {
                // table:table
                $this->xmlContent->startElement('table:table');
                $this->xmlContent->writeAttribute('table:name', 'table-local');
        Severity: Major
        Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 2 hrs to fix

          Method loadSlide has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function loadSlide(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 2 hrs to fix

            Method writeSlideLayout has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function writeSlideLayout(SlideLayout $pSlideLayout): string
                {
                    // Create XML writer
                    $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                    // XML header
            Severity: Major
            Found in src/PhpPresentation/Writer/PowerPoint2007/PptSlideLayouts.php - About 2 hrs to fix

              Method loadCurrentUserStream has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function loadCurrentUserStream(): void
                  {
                      $pos = 0;
              
                      /**
              Severity: Major
              Found in src/PhpPresentation/Reader/PowerPoint97.php - About 2 hrs to fix

                ObjectsChart has 22 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class ObjectsChart extends AbstractDecoratorWriter
                {
                    /**
                     * @var XMLWriter
                     */
                Severity: Minor
                Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php - About 2 hrs to fix

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

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

                        public function render(): ZipInterface
                        {
                            // Create XML writer
                            $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
                            $objWriter->startDocument('1.0', 'UTF-8');
                    Severity: Major
                    Found in src/PhpPresentation/Writer/ODPresentation/Meta.php - About 2 hrs to fix

                      Function calculateExtents has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function calculateExtents(ShapeContainerInterface $container): array
                          {
                              /** @var array<string, int> $extents */
                              $extents = [self::X => 0, self::Y => 0];
                      
                      
                      Severity: Minor
                      Found in src/PhpPresentation/GeometryCalculator.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 writePlotAreaStyle has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function writePlotAreaStyle(Chart $chart): void
                          {
                              $chartType = $chart->getPlotArea()->getType();
                      
                              // style:style
                      Severity: Minor
                      Found in src/PhpPresentation/Writer/ODPresentation/ObjectsChart.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 calculateOffsets has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function calculateOffsets(ShapeContainerInterface $container): array
                          {
                              $offsets = [self::X => 0, self::Y => 0];
                      
                              if (null !== $container && 0 != count($container->getShapeCollection())) {
                      Severity: Minor
                      Found in src/PhpPresentation/GeometryCalculator.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 getEndingNotes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function getEndingNotes($writers)
                      {
                          $result = '';
                      
                          // Do not show execution time for index
                      Severity: Minor
                      Found in samples/Sample_Header.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 readRecordOfficeArtTertiaryFOPT has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function readRecordOfficeArtTertiaryFOPT(string $stream, int $pos)
                          {
                              $arrayReturn = [
                                  'length' => 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

                      AbstractSlide has 21 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      abstract class AbstractSlide implements ComparableInterface, ShapeContainerInterface
                      {
                          use ShapeCollection;
                      
                          /**
                      Severity: Minor
                      Found in src/PhpPresentation/Slide/AbstractSlide.php - About 2 hrs to fix

                        Method writeParagraphStyles has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function writeParagraphStyles(XMLWriter $objWriter, Paragraph $paragraph, bool $isPlaceholder = false): void
                            {
                                $objWriter->startElement('a:pPr');
                                $objWriter->writeAttribute('algn', $paragraph->getAlignment()->getHorizontal());
                                $objWriter->writeAttribute('rtl', $paragraph->getAlignment()->isRTL() ? '1' : '0');
                        Severity: Major
                        Found in src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php - About 2 hrs to fix

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

                              public function render(): ZipInterface
                              {
                                  /**
                                   * @var Author[]
                                   */
                          Severity: Minor
                          Found in src/PhpPresentation/Writer/PowerPoint2007/CommentAuthors.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

                          Severity
                          Category
                          Status
                          Source
                          Language