Sibyx/phpGPX

View on GitHub

Showing 34 of 327 total issues

Method createExpectedArray has 198 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function createExpectedArray()
    {
        return [
            'waypoints' => [
                [
Severity: Major
Found in tests/LoadFileTest.php - About 7 hrs to fix

    Method createExpectedArray has 132 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function createExpectedArray()
        {
            return [
                'creator' => 'RouteConverter',
                'metadata' => [
    Severity: Major
    Found in tests/LoadRouteFileTest.php - About 5 hrs to fix

      Function parse has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function parse($nodes)
          {
              $routes = [];
      
              foreach ($nodes as $node) {
      Severity: Minor
      Found in src/phpGPX/Parsers/RouteParser.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 recalculateStats has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function recalculateStats()
          {
              if (empty($this->stats)) {
                  $this->stats = new Stats();
              }
      Severity: Minor
      Found in src/phpGPX/Models/Track.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 toXML has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function toXML(Metadata $metadata, \DOMDocument &$document)
          {
              $node =  $document->createElement(self::$tagName);
      
              foreach (self::$attributeMapper as $key => $attribute) {
      Severity: Minor
      Found in src/phpGPX/Parsers/MetadataParser.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 recalculateStats has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function recalculateStats()
          {
              if (empty($this->stats)) {
                  $this->stats = new Stats();
              }
      Severity: Major
      Found in src/phpGPX/Models/Track.php - About 2 hrs to fix

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

            public static function parse(\SimpleXMLElement $nodes)
            {
                $tracks = [];
        
                foreach ($nodes as $node) {
        Severity: Minor
        Found in src/phpGPX/Parsers/TrackParser.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 calculate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function calculate(array $points)
            {
                $cumulativeElevationGain = 0;
                $cumulativeElevationLoss = 0;
        
        
        Severity: Minor
        Found in src/phpGPX/Helpers/ElevationGainLossCalculator.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 toXML has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function toXML(Point $point, \DOMDocument &$document)
            {
                $node = $document->createElement(array_search($point->getPointType(), self::$typeMapper));
        
                $node->setAttribute('lat', $point->latitude);
        Severity: Minor
        Found in src/phpGPX/Parsers/PointParser.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 recalculateStats has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function recalculateStats()
            {
                if (empty($this->stats)) {
                    $this->stats = new Stats();
                }
        Severity: Minor
        Found in src/phpGPX/Models/Route.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 toXML has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function toXML(Route $route, \DOMDocument &$document)
            {
                $node = $document->createElement(self::$tagName);
        
                foreach (self::$attributeMapper as $key => $attribute) {
        Severity: Minor
        Found in src/phpGPX/Parsers/RouteParser.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 toXML has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function toXML(Track $track, \DOMDocument &$document)
            {
                $node = $document->createElement(self::$tagName);
        
                foreach (self::$attributeMapper as $key => $attribute) {
        Severity: Minor
        Found in src/phpGPX/Parsers/TrackParser.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 createWaypointFile has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createWaypointFile()
            {
                $sample_data = [
                    [
                        'longitude' => 9.860624216140083,
        Severity: Minor
        Found in tests/CreateWaypointTest.php - About 1 hr to fix

          Function recalculateStats has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public function recalculateStats()
              {
                  if (empty($this->stats)) {
                      $this->stats = new Stats();
                  }
          Severity: Minor
          Found in src/phpGPX/Models/Segment.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 recalculateStats has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function recalculateStats()
              {
                  if (empty($this->stats)) {
                      $this->stats = new Stats();
                  }
          Severity: Minor
          Found in src/phpGPX/Models/Route.php - About 1 hr to fix

            Method toXML has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function toXML()
                {
                    $document = new \DOMDocument("1.0", 'UTF-8');
            
                    $gpx = $document->createElementNS("http://www.topografix.com/GPX/1/1", "gpx");
            Severity: Minor
            Found in src/phpGPX/Models/GpxFile.php - About 1 hr to fix

              Function parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function parse(\SimpleXMLElement $node)
                  {
                      $metadata = new Metadata();
              
                      foreach (self::$attributeMapper as $key => $attribute) {
              Severity: Minor
              Found in src/phpGPX/Parsers/MetadataParser.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 dataProviderFilterNotNull has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function dataProviderFilterNotNull()
                  {
                      return [
                          'numeric 1' => [
                              [],
              Severity: Minor
              Found in tests/UnitTests/phpGPX/Helpers/SerializationHelperTest.php - About 1 hr to fix

                Method recalculateStats has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function recalculateStats()
                    {
                        if (empty($this->stats)) {
                            $this->stats = new Stats();
                        }
                Severity: Minor
                Found in src/phpGPX/Models/Segment.php - About 1 hr to fix

                  Method toXML has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function toXML(Metadata $metadata, \DOMDocument &$document)
                      {
                          $node =  $document->createElement(self::$tagName);
                  
                          foreach (self::$attributeMapper as $key => $attribute) {
                  Severity: Minor
                  Found in src/phpGPX/Parsers/MetadataParser.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language