src/DMI.php

Summary

Maintainability
A
0 mins
Test Coverage

Function archive has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Wontfix

    public function archive(string $measurement, string $frequency, $period, ?int $municipalityId = null, string $country = 'DK') : Archive
    {
        // Validate required measurement.
        $supportedMeasurements = Collection::make(['temperature', 'precipitation', 'wind', 'wind-direction', 'humidity', 'pressure', 'sun', 'drought', 'lightning', 'snow']);
        if (!$supportedMeasurements->contains($measurement)) {
Severity: Minor
Found in src/DMI.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 locationByCoordinate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Invalid

    public function locationByCoordinate(float $latitude, float $longitude, bool $includeRegional = true, bool $includeWarnings = true) : Location
    {
        try {
            // Request DMI API.
            $data = $this->requestNinJo('llj', [
Severity: Minor
Found in src/DMI.php - About 35 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 seaStations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Invalid

    public function seaStations(bool $withObservations = false, bool $withForecast = false) : SeaStations
    {
        try {
            // Request DMI API.
            $data = $this->request(self::DMI_WS_BASE_URL_CITY_WEATHER . '/vandstand/active');
Severity: Minor
Found in src/DMI.php - About 35 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 location has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Invalid

    public function location(?int $id = null, $includeRegional = true, bool $includeWarnings = true) : Location
    {
        try {
            // Request DMI API data.
            $data = $this->requestNinJo('llj', [
Severity: Minor
Found in src/DMI.php - About 35 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 request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Wontfix

    private function request(string $url) : array
    {
        // If no client instance has been set,
        // we'll setup a default one with gzip enabled.
        if (!$this->hasClient()) {
Severity: Minor
Found in src/DMI.php - About 25 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

There are no issues that match your filters.

Category
Status