halfpastfouram/PHPChartJS

View on GitHub

Showing 20 of 24 total issues

Tooltips has 64 functions (exceeds 20 allowed). Consider refactoring.
Open

class Tooltips implements ArraySerializableInterface, JsonSerializable
{
    use ArraySerializable;

    /**
Severity: Major
Found in src/Options/Tooltips.php - About 1 day to fix

    Scale has 47 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class Scale implements ArraySerializableInterface, JsonSerializable
    {
        use ArraySerializable;
    
        /**
    Severity: Minor
    Found in src/Options/Scale.php - About 6 hrs to fix

      LineDataSet has 40 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class LineDataSet extends DataSet
      {
          /**
           * @var bool|string
           */
      Severity: Minor
      Found in src/DataSet/LineDataSet.php - About 5 hrs to fix

        Ticks has 37 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Ticks implements ArraySerializableInterface, JsonSerializable
        {
            use ArraySerializable;
        
            /**
        Severity: Minor
        Found in src/Options/Scales/Ticks.php - About 4 hrs to fix

          RadarDataSet has 32 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class RadarDataSet extends DataSet
          {
              /**
               * @var bool
               */
          Severity: Minor
          Found in src/DataSet/RadarDataSet.php - About 4 hrs to fix

            File Tooltips.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace Halfpastfour\PHPChartJS\Options;
            
            use Halfpastfour\PHPChartJS\ArraySerializableInterface;
            Severity: Minor
            Found in src/Options/Tooltips.php - About 4 hrs to fix

              The class Scale has an overall complexity of 50 which is very high. The configured complexity threshold is 50.
              Open

              abstract class Scale implements ArraySerializableInterface, JsonSerializable
              {
                  use ArraySerializable;
              
                  /**
              Severity: Minor
              Found in src/Options/Scale.php by phpmd

              The class Tooltips has an overall complexity of 65 which is very high. The configured complexity threshold is 50.
              Open

              class Tooltips implements ArraySerializableInterface, JsonSerializable
              {
                  use ArraySerializable;
              
                  /**
              Severity: Minor
              Found in src/Options/Tooltips.php by phpmd

              Callbacks has 25 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Callbacks implements ArraySerializableInterface, JsonSerializable
              {
                  use ArraySerializable;
              
                  /**
              Severity: Minor
              Found in src/Options/Tooltips/Callbacks.php - About 2 hrs to fix

                DataSet has 25 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class DataSet implements ChartOwnedInterface, ArraySerializableInterface, JsonSerializableInterface
                {
                    use ChartOwned;
                    use Delegate\ArraySerializable;
                    use Delegate\JsonSerializable;
                Severity: Minor
                Found in src/DataSet.php - About 2 hrs to fix

                  GridLines has 25 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class GridLines implements ArraySerializableInterface, JsonSerializable
                  {
                      use ArraySerializable;
                      use StringUtils;
                      use NumberUtils;
                  Severity: Minor
                  Found in src/Options/Scales/GridLines.php - About 2 hrs to fix

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

                    class Line implements ArraySerializableInterface, JsonSerializable
                    {
                        use ArraySerializable;
                    
                        /** https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap */
                    Severity: Minor
                    Found in src/Options/Elements/Line.php - About 2 hrs to fix

                      File Scale.php has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace Halfpastfour\PHPChartJS\Options;
                      
                      use Halfpastfour\PHPChartJS\ArraySerializableInterface;
                      Severity: Minor
                      Found in src/Options/Scale.php - About 2 hrs to fix

                        The class Scale has 47 public methods and attributes. Consider reducing the number of public items to less than 45.
                        Open

                        abstract class Scale implements ArraySerializableInterface, JsonSerializable
                        {
                            use ArraySerializable;
                        
                            /**
                        Severity: Minor
                        Found in src/Options/Scale.php by phpmd

                        ExcessivePublicCount

                        Since: 0.1

                        A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

                        Example

                        public class Foo {
                            public $value;
                            public $something;
                            public $var;
                            // [... more more public attributes ...]
                        
                            public function doWork() {}
                            public function doMoreWork() {}
                            public function doWorkAgain() {}
                            // [... more more public methods ...]
                        }

                        Source https://phpmd.org/rules/codesize.html#excessivepubliccount

                        The class Tooltips has 64 public methods and attributes. Consider reducing the number of public items to less than 45.
                        Open

                        class Tooltips implements ArraySerializableInterface, JsonSerializable
                        {
                            use ArraySerializable;
                        
                            /**
                        Severity: Minor
                        Found in src/Options/Tooltips.php by phpmd

                        ExcessivePublicCount

                        Since: 0.1

                        A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

                        Example

                        public class Foo {
                            public $value;
                            public $something;
                            public $var;
                            // [... more more public attributes ...]
                        
                            public function doWork() {}
                            public function doMoreWork() {}
                            public function doWorkAgain() {}
                            // [... more more public methods ...]
                        }

                        Source https://phpmd.org/rules/codesize.html#excessivepubliccount

                        Missing class import via use statement (line '32', column '23').
                        Open

                                    throw new \InvalidArgumentException("Invalid chart type. {$path} does not exist.");
                        Severity: Minor
                        Found in src/Factory.php by phpmd

                        MissingImport

                        Since: 2.7.0

                        Importing all external classes in a file through use statements makes them clearly visible.

                        Example

                        function make() {
                            return new \stdClass();
                        }

                        Source http://phpmd.org/rules/cleancode.html#MissingImport

                        The method render has a boolean flag argument $pretty, which is a certain sign of a Single Responsibility Principle violation.
                        Open

                            public function render($pretty = false)
                        Severity: Minor
                        Found in src/Chart.php by phpmd

                        BooleanArgumentFlag

                        Since: 1.4.0

                        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                        Example

                        class Foo {
                            public function bar($flag = true) {
                            }
                        }

                        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                        The method setLineWidth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                        Open

                                } else {
                                    $this->lineWidth = is_null($lineWidth) ? null : intval($lineWidth);
                                }
                        Severity: Minor
                        Found in src/Options/Scales/GridLines.php by phpmd

                        ElseExpression

                        Since: 1.4.0

                        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                        Example

                        class Foo
                        {
                            public function bar($flag)
                            {
                                if ($flag) {
                                    // one branch
                                } else {
                                    // another branch
                                }
                            }
                        }

                        Source https://phpmd.org/rules/cleancode.html#elseexpression

                        The method setColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                        Open

                                } else {
                                    $this->color = is_null($color) ? null : strval($color);
                                }
                        Severity: Minor
                        Found in src/Options/Scales/GridLines.php by phpmd

                        ElseExpression

                        Since: 1.4.0

                        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                        Example

                        class Foo
                        {
                            public function bar($flag)
                            {
                                if ($flag) {
                                    // one branch
                                } else {
                                    // another branch
                                }
                            }
                        }

                        Source https://phpmd.org/rules/cleancode.html#elseexpression

                        The 'getIntersect()' method which returns a boolean should be named 'is...()' or 'has...()'
                        Open

                            public function getIntersect()
                            {
                                return $this->intersect;
                            }
                        Severity: Minor
                        Found in src/Options/Hover.php by phpmd

                        BooleanGetMethodName

                        Since: 0.2

                        Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

                        Example

                        class Foo {
                            /**
                             * @return boolean
                             */
                            public function getFoo() {} // bad
                            /**
                             * @return bool
                             */
                            public function isFoo(); // ok
                            /**
                             * @return boolean
                             */
                            public function getFoo($bar); // ok, unless checkParameterizedMethods=true
                        }

                        Source https://phpmd.org/rules/naming.html#booleangetmethodname

                        Severity
                        Category
                        Status
                        Source
                        Language