Completed
Push — master ( bde476...d056b3 )
by Bobby
02:21
created

Ivao::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Ballen\Metar\Providers;
4
5
/**
6
 * Metar
7
 *
8
 * Metar is a PHP library for retrieveing weather reports (METAR infomation),
9
 * the library supports multiple 'METAR prodivers' including NOAA, VATSIM and IVAO.
10
 *
11
 * @author Bobby Allen <[email protected]>
12
 * @license http://www.gnu.org/licenses/gpl-3.0.html
13
 * @link https://github.com/bobsta63/metar
14
 * @link http://www.bobbyallen.me
15
 *
16
 */
17
use \Ballen\Metar\Providers\MetarProviderInterface;
18
use \Ballen\Metar\Helpers\MetarHTTPClient;
19
20
/**
21
 * METAR service provided by the IVAO (The International Virtual Aviation Organisation)
22
 * @link https://www.ivao.aero/
23
 */
24 View Code Duplication
class Ivao extends MetarHTTPClient implements MetarProviderInterface
0 ignored issues
show
Duplication introduced by
This class 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...
25
{
26
27
    private $serviceUrl = 'http://wx.ivao.aero/metar.php/?id={{_ICAO_}}';
28
    private $icao;
29
30 2
    public function __construct($icao)
31
    {
32 2
        $this->icao = $icao;
33 2
    }
34
35 2
    private function getMetarDataString()
36
    {
37
38 2
        $data = $this->getMetarAPIResponse(str_replace('{{_ICAO_}}', $this->icao, $this->serviceUrl));
39 2
        return $data;
40
    }
41
42 2
    public function __toString()
43
    {
44 2
        return $this->getMetarDataString();
45
    }
46
}
47