WeatherStations::fetchFromSeveralByGeoPoint()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 9
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
namespace Netgen\Bundle\OpenWeatherMapBundle\Core;
4
5
use Netgen\Bundle\OpenWeatherMapBundle\API\OpenWeatherMap\Weather\WeatherStationsInterface;
6
7
/**
8
 * Class WeatherStations.
9
 */
10
class WeatherStations extends Base implements WeatherStationsInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function fetchFromOnStationById($stationId)
16
    {
17
        $queryPart = '/station?id=' . $stationId . '&appid=' . $this->apiKey;
18
19
        return $this->getResult(self::BASE_URL, $queryPart);
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function fetchFromSeveralByRectangleZone(array $boundingBox, $cluster = 'yes', $numberOfStations = 10)
26
    {
27
        $queryPart = '/box/station?bbox=' . implode(',', $boundingBox)
28
            . '&cluster=' . $cluster
29
            . '&cnt=' . $numberOfStations
30
            . '&appid=' . $this->apiKey;
31
32
        return $this->getResult(self::BASE_URL, $queryPart);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 View Code Duplication
    public function fetchFromSeveralByGeoPoint($latitude, $longitude, $numberOfStations = 10)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        $queryPart = '/station/find?lat=' . $latitude
41
            . '&lon=' . $longitude
42
            . '&cnt=' . $numberOfStations
43
            . '&appid=' . $this->apiKey;
44
45
        return $this->getResult(self::BASE_URL, $queryPart);
46
    }
47
}
48