Ivao   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMetarDataString() 0 5 1
A __toString() 0 3 1
A __construct() 0 3 1
1
<?php
2
namespace Ballen\Metar\Providers;
3
4
/**
5
 * Metar
6
 *
7
 * Metar is a PHP library for retrieveing weather reports (METAR infomation),
8
 * the library supports multiple 'METAR prodivers' including NOAA, VATSIM and IVAO.
9
 *
10
 * @author Bobby Allen <[email protected]>
11
 * @license http://www.gnu.org/licenses/gpl-3.0.html
12
 * @link https://github.com/allebb/metar
13
 * @link http://www.bobbyallen.me
14
 *
15
 */
16
use \Ballen\Metar\Helpers\MetarHTTPClient;
17
18
/**
19
 * METAR service provided by the IVAO (The International Virtual Aviation Organisation)
20
 * @link https://www.ivao.aero/
21
 */
22
class Ivao extends MetarHTTPClient implements MetarProviderInterface
23
{
24
25
    private $serviceUrl = 'http://wx.ivao.aero/metar.php/?id={{_ICAO_}}';
26
    private $icao;
27
28 2
    public function __construct($icao)
29
    {
30 2
        $this->icao = $icao;
31 2
    }
32
33 2
    private function getMetarDataString()
34
    {
35
36 2
        $data = $this->getMetarAPIResponse(str_replace('{{_ICAO_}}', $this->icao, $this->serviceUrl));
37 2
        return $data;
38
    }
39
40 2
    public function __toString()
41
    {
42 2
        return $this->getMetarDataString();
43
    }
44
}
45