Vatsim::getMetarDataString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
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 VATSIM.net
20
 * @link http://www.vatsim.net or http://metar.vatsim.net/search_metar.php
21
 */
22
class Vatsim extends MetarHTTPClient implements MetarProviderInterface
23
{
24
25
    private $serviceUrl = 'http://metar.vatsim.net/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 2
        $data = $this->getMetarAPIResponse(str_replace('{{_ICAO_}}', $this->icao, $this->serviceUrl));
36 2
        return trim($data);
37
    }
38
39 2
    public function __toString()
40
    {
41 2
        return $this->getMetarDataString();
42
    }
43
}
44