HuasoFoundries/jpgraph

View on GitHub

Showing 706 of 6,805 total issues

Function Color has a Cognitive Complexity of 23 (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/image/RGB.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

Function StrokeBoxedText2 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function StrokeBoxedText2(
        $x,
        $y,
        $txt,
        $dir = 0,
Severity: Minor
Found in src/image/Image.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

Function AdjDate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function AdjDate($aTime, $aRound = 0, $aYearType = false, $aMonthType = false, $aDayType = false)
    {
        $y = (int) date('Y', $aTime);
        $m = (int) date('m', $aTime);
        $d = (int) date('d', $aTime);
Severity: Minor
Found in src/graph/DateScale.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 Stroke has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function Stroke($img, $aaoption = 0)
    {
        $n = safe_count($this->data);

        // If user hasn't set the colors use the theme array
Severity: Major
Found in src/plot/PiePlot3D.php - About 3 hrs to fix

    Method StrokeHours has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function StrokeHours($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 3 hrs to fix

      GTextTableCell has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class GTextTableCell
      {
          public $iColSpan      = 1;
          public $iRowSpan      = 1;
          public $iMarginLeft   = 5;
      Severity: Minor
      Found in src/text/GTextTableCell.php - About 3 hrs to fix

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

        class Legend
        {
            public $txtcol          = [];
            public $font_family     = FF_DEFAULT;
            public $font_style      = FS_NORMAL;
        Severity: Minor
        Found in src/graph/Legend.php - About 3 hrs to fix

          File Text.php has 297 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * JPGraph v4.0.3
           */
          Severity: Minor
          Found in src/text/Text.php - About 3 hrs to fix

            Method AutoScale has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function AutoScale($img, $min, $max, $maxsteps, $majend = true)
                {
                    if (!is_numeric($min) || !is_numeric($max)) {
                        Util\JpGraphError::Raise(25044);
                    }
            Severity: Major
            Found in src/graph/LinearScale.php - About 3 hrs to fix

              Function StrokeAxisLabelBackground has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function StrokeAxisLabelBackground()
                  {
                      // Types
                      // 0 = No background
                      // 1 = Only X-labels, length of axis
              Severity: Minor
              Found in src/graph/Graph.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

              Function StrokeTitle has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function StrokeTitle($image, $w, $h)
                  {
                      // Stroke title
                      if ($this->title->t !== '') {
                          $margin = 3;
              Severity: Minor
              Found in src/graph/MGraph.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 Stroke has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function Stroke($pos, $dummy = true)
                  {
                      $this->img->SetLineWeight($this->weight);
                      $this->img->SetColor($this->color);
                      $this->img->SetFont($this->font_family, $this->font_style, $this->font_size);
              Severity: Major
              Found in src/graph/PolarAxis.php - About 3 hrs to fix

                File TTF.php has 293 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 * JPGraph v4.0.3
                 */
                Severity: Minor
                Found in src/text/TTF.php - About 3 hrs to fix

                  File MGraph.php has 292 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * JPGraph v4.0.3
                   */
                  Severity: Minor
                  Found in src/graph/MGraph.php - About 3 hrs to fix

                    Method Raise has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function Raise($aMsg, $aHalt = true)
                        {
                            $img_iconerror =
                                'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAaV' .
                                'BMVEX//////2Xy8mLl5V/Z2VvMzFi/v1WyslKlpU+ZmUyMjEh/' .
                    Severity: Major
                    Found in src/util/JpGraphErrObjectImg.php - About 3 hrs to fix

                      Method StrokeGrid has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function StrokeGrid($pos)
                          {
                              $x = round($this->img->left_margin + $this->img->plotwidth / 2);
                              $this->scale->ticks->Stroke($this->img, $this->scale, $pos);
                      
                      
                      Severity: Major
                      Found in src/graph/PolarAxis.php - About 3 hrs to fix

                        Method PutAndStream has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function PutAndStream($aImage, $aCacheFileName, $aInline, $aStrokeFileName)
                            {
                                // Check if we should always stroke the image to a file
                                if (_FORCE_IMGTOFILE) {
                                    $aStrokeFileName = _FORCE_IMGDIR . Util\Helper::GenImgName();
                        Severity: Major
                        Found in src/image/ImgStreamCache.php - About 2 hrs to fix

                          Method DoStroke has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function DoStroke($aTicksPos, $aType, $aColor, $aWeight)
                              {
                                  $nbrgrids = safe_count($aTicksPos);
                                  if (!$this->show || $nbrgrids === 0) {
                                      return;
                          Severity: Major
                          Found in src/graph/Grid.php - About 2 hrs to fix

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

                                public function Stroke($aImg, $ax = -1, $ay = -1)
                                {
                                    // To position the super script correctly we need different
                                    // cases to handle the alignmewnt specified since that will
                                    // determine how we can interpret the x,y coordinates
                            Severity: Major
                            Found in src/text/SuperScriptText.php - About 2 hrs to fix

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

                                  public function Stroke($aImg, $x = null, $y = null)
                                  {
                                      if (is_numeric($x)) {
                                          $this->x = round($x);
                                      }
                              Severity: Major
                              Found in src/text/Text.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language