thinreports-php/thinreports-php

View on GitHub

Showing 30 of 30 total issues

Method buildTextStyles has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildTextStyles(array $attrs)
    {
        $font_style = array();

        foreach ($attrs['font_style'] ?: array() as $style) {
Severity: Minor
Found in src/Thinreports/Generator/PDF/Text.php - About 1 hr to fix

    Method drawTextBox has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function drawTextBox($content, $x, $y, $width, $height, array $attrs = array())
        {
            $styles = $this->buildTextBoxStyles($height, $attrs);
    
            if ($styles['color'] === null) {
    Severity: Minor
    Found in src/Thinreports/Generator/PDF/Text.php - About 1 hr to fix

      Function buildTextStyles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function buildTextStyles(array $attrs)
          {
              $font_style = array();
      
              foreach ($attrs['font_style'] ?: array() as $style) {
      Severity: Minor
      Found in src/Thinreports/Generator/PDF/Text.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

      Method getBounds has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getBounds()
          {
              $svg_attrs = $this->getSVGAttributes();
      
              switch (true) {
      Severity: Minor
      Found in src/Thinreports/Item/BasicItem.php - About 1 hr to fix

        Method buildTextBoxStyles has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function buildTextBoxStyles($box_height, array $attrs)
            {
                $is_single = array_key_exists('single_row', $attrs)
                             && $attrs['single_row'] === true;
        
        
        Severity: Minor
        Found in src/Thinreports/Generator/PDF/Text.php - About 1 hr to fix

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

              public function renderTextBlockItem(Item\TextBlockItem $item)
              {
                  $format = $item->getFormat();
                  $bounds = $item->getBounds();
                  $styles = $this->buildTextStyles($item->exportStyles());
          Severity: Minor
          Found in src/Thinreports/Generator/Renderer/ItemRenderer.php - About 1 hr to fix

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

                public function buildPageFormat(Layout $layout)
                {
                    $orientation = $layout->isPortraitPage() ? 'P' : 'L';
            
                    if ($layout->isUserPaperType()) {
            Severity: Minor
            Found in src/Thinreports/Generator/PDF/Document.php - About 1 hr to fix

              Function buildGraphicStyles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function buildGraphicStyles(array $attrs)
                  {
                      if (empty($attrs['stroke_width']) || $attrs['stroke_color'] == 'none') {
                          $stroke_style = null;
                      } else {
              Severity: Minor
              Found in src/Thinreports/Generator/PDF/Graphics.php - About 55 mins 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 setTextDecoration has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function setTextDecoration($underline = null, $linethrough = null)
                  {
                      $decorations = array();
              
                      if ($underline === null) {
              Severity: Minor
              Found in src/Thinreports/Item/Style/TextStyle.php - About 55 mins 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 drawImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function drawImage($filename, $x, $y, $width, $height, array $attrs = array())
              Severity: Minor
              Found in src/Thinreports/Generator/PDF/Graphics.php - About 45 mins to fix

                Function buildPageFormat has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function buildPageFormat(Layout $layout)
                    {
                        $orientation = $layout->isPortraitPage() ? 'P' : 'L';
                
                        if ($layout->isUserPaperType()) {
                Severity: Minor
                Found in src/Thinreports/Generator/PDF/Document.php - About 45 mins 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 format has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function format($value)
                    {
                        if ($value === null || $value === '') {
                            return $value;
                        }
                Severity: Minor
                Found in src/Thinreports/Item/TextFormatter.php - About 45 mins 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 padChars has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function padChars($direction, $string, $padstr, $length)
                    {
                        while (mb_strlen($string, 'UTF-8') < $length) {
                            if ($direction == 'L') {
                                $string = $padstr . $string;
                Severity: Minor
                Found in src/Thinreports/Item/TextFormatter.php - About 45 mins 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 drawTextBox has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function drawTextBox($content, $x, $y, $width, $height, array $attrs = array())
                Severity: Minor
                Found in src/Thinreports/Generator/PDF/Text.php - About 45 mins to fix

                  Function isRenderable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function isRenderable(Item\AbstractItem $item)
                      {
                          if (!$item->isVisible()) {
                              return false;
                          }
                  Severity: Minor
                  Found in src/Thinreports/Generator/Renderer/ItemRenderer.php - About 45 mins 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 drawBase64Image has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function drawBase64Image($base64_string, $x, $y, $width, $height, array $attrs = array())
                  Severity: Minor
                  Found in src/Thinreports/Generator/PDF/Graphics.php - About 45 mins to fix

                    Function buildFontStyle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function buildFontStyle(array $svg_attrs)
                        {
                            $styles = array();
                    
                            if ($svg_attrs['font-weight'] === 'bold') {
                    Severity: Minor
                    Found in src/Thinreports/Generator/Renderer/AbstractRenderer.php - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function render()
                        {
                            foreach ($this->items as $attributes) {
                                $type_name = $attributes['class'];
                    
                    
                    Severity: Minor
                    Found in src/Thinreports/Generator/Renderer/LayoutRenderer.php - About 45 mins 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 buildTextBoxStyles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function buildTextBoxStyles($box_height, array $attrs)
                        {
                            $is_single = array_key_exists('single_row', $attrs)
                                         && $attrs['single_row'] === true;
                    
                    
                    Severity: Minor
                    Found in src/Thinreports/Generator/PDF/Text.php - About 45 mins 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 drawText has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function drawText($content, $x, $y, $width, $height, array $attrs = array())
                    Severity: Minor
                    Found in src/Thinreports/Generator/PDF/Text.php - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language