HuasoFoundries/jpgraph

View on GitHub

Showing 706 of 6,805 total issues

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

    public function File($family, $style = FS_NORMAL, $font_path = null)
    {
        $fam = @$this->font_files[$family];
        if (!$fam) {
            Util\JpGraphError::RaiseL(25046, $family); //("Specified TTF font family (id=$family) is unknown or does not exist. Please note that TTF fonts are not distributed with JpGraph for copyright reasons. You can find the MS TTF WEB-fonts (arial, courier etc) for download at http://corefonts.sourceforge.net/");
Severity: Minor
Found in src/text/TTF.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 Color has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function Color($aColor)
    {
        if (is_string($aColor)) {
            $matches = [];
            // this regex will parse a color string and fill the $matches array as such:
Severity: Minor
Found in src/util/RGB.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 StrokeMonths has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function StrokeMonths($aYCoord, $getHeight = false)
    {
        if ($this->month->iShowLabels) {
            $img = $this->iImg;
            $img->SetFont($this->month->iFFamily, $this->month->iFStyle, $this->month->iFSize);
Severity: Minor
Found in src/graph/GanttScale.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 Stroke has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function Stroke($aStrokeFileName = '')
    {
        // Start by adjusting the margin so that potential titles will fit.
        $this->AdjustMarginsForTitles();

Severity: Minor
Found in src/graph/PolarGraph.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

File LinearTicks.php has 285 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * JPGraph v4.0.3
 */
Severity: Minor
Found in src/graph/LinearTicks.php - About 2 hrs to fix

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

        public function StrokeMinutes($aYCoord, $getHeight = false)
        {
            $img = $this->iImg;
            $xt  = $img->left_margin + $this->iLabelWidth;
            $yt  = $aYCoord + $img->top_margin;
    Severity: Major
    Found in src/graph/GanttScale.php - About 2 hrs to fix

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

          public function CreateSimple($data, $constrains = [], $progress = [])
          {
              $num = safe_count($data);
              for ($i = 0; $i < $num; ++$i) {
                  switch ($data[$i][1]) {
      Severity: Major
      Found in src/graph/GanttGraph.php - About 2 hrs to fix

        Method Stroke has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function Stroke($aStrokeFileName = '')
            {
                // If the filename is the predefined value = '_csim_special_'
                // we assume that the call to stroke only needs to do enough
                // to correctly generate the CSIM maps.
        Severity: Major
        Found in src/graph/GanttGraph.php - About 2 hrs to fix

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

              public function SetImgFormat($aFormat, $aQuality = 75)
              {
                  $this->quality = $aQuality;
                  $aFormat       = strtolower($aFormat);
                  $tst           = true;
          Severity: Minor
          Found in src/image/Image.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 AdjustMarginsForGrid has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function AdjustMarginsForGrid()
              {
                  if ($this->iCol > 0) {
                      switch ($this->iGridStyle[0]) {
                          case TGRID_SINGLE:
          Severity: Minor
          Found in src/text/GTextTableCell.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 LoadBkgImage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function LoadBkgImage($aImgFormat = '', $aFile = '', $aImgStr = '')
              {
                  if ($aImgStr != '') {
                      return Image::CreateFromString($aImgStr);
                  }
          Severity: Minor
          Found in src/graph/Graph.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 StrokeConstrains has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function StrokeConstrains()
              {
                  $n = safe_count($this->iObj);
          
                  // Stroke all constrains
          Severity: Major
          Found in src/graph/GanttGraph.php - About 2 hrs to fix

            File UnitTesterActions.php has 278 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * JPGraph - Community Edition
             */
            Severity: Minor
            Found in tests/_support/_generated/UnitTesterActions.php - About 2 hrs to fix

              Method Stroke has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function Stroke($aImg, $aDummy1 = null, $aDummy2 = null)
                  {
                      if ($this->hide) {
                          return;
                      }
              Severity: Major
              Found in src/text/GraphTabTitle.php - About 2 hrs to fix

                Method StrokeWeeks has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function StrokeWeeks($aYCoord, $getHeight = false)
                    {
                        if ($this->week->iShowLabels) {
                            $img = $this->iImg;
                            $yt  = $aYCoord + $img->top_margin;
                Severity: Major
                Found in src/graph/GanttScale.php - About 2 hrs to fix

                  Method Stroke has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function Stroke($aImg, &$grid, $aPos, $aAxisAngle, $aScale, &$aMajPos, &$aMajLabel)
                      {
                          $start     = $aScale->GetMinVal();
                          $limit     = $aScale->GetMaxVal();
                          $nextMajor = 10 * $start;
                  Severity: Major
                  Found in src/graph/RadarLogTicks.php - About 2 hrs to fix

                    Method StrokeLabel has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function StrokeLabel($label, $img, $xc, $yc, $a, $r)
                        {
                            // Default value
                            if ($this->ilabelposadj === 'auto') {
                                $this->ilabelposadj = 0.65;
                    Severity: Major
                    Found in src/plot/PiePlot.php - About 2 hrs to fix

                      Method AdjTime has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function AdjTime($aTime, $aRound = 0, $aHourType = false, $aMinType = false, $aSecType = false)
                          {
                              $y = (int) date('Y', $aTime);
                              $m = (int) date('m', $aTime);
                              $d = (int) date('d', $aTime);
                      Severity: Major
                      Found in src/graph/DateScale.php - About 2 hrs to fix

                        Method StrokeMonths has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function StrokeMonths($aYCoord, $getHeight = false)
                            {
                                if ($this->month->iShowLabels) {
                                    $img = $this->iImg;
                                    $img->SetFont($this->month->iFFamily, $this->month->iFStyle, $this->month->iFSize);
                        Severity: Major
                        Found in src/graph/GanttScale.php - About 2 hrs to fix

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

                              public function Stroke($pos, $aAxisAngle, &$grid, $title, $lf)
                              {
                                  $this->img->SetColor($this->color);
                          
                                  // Determine end points for the axis
                          Severity: Minor
                          Found in src/graph/RadarAxis.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