-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdemo.php
More file actions
31 lines (22 loc) · 1002 Bytes
/
demo.php
File metadata and controls
31 lines (22 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
// This is a live demonstration on how to use the library
require_once dirname(__FILE__) . '/vendor/autoload.php';
// or if you don't use autoloading:
// require_once dirname(__FILE__) . '/src/MetarDecoder.inc.php';
use MetarDecoder\MetarDecoder;
use MetarDecoder\ChunkDecoder\WindShearChunkDecoder;
use MetarDecoder\ChunkDecoder\TemperatureChunkDecoder;
$raw_metar = 'METAR LFPG 212205Z';
print('Demo, decoding raw metar "'.$raw_metar.'"'.PHP_EOL);
$decoder = new MetarDecoder();
$decoded_metar = $decoder->parse($raw_metar);
print('Report type: '.$decoded_metar->getType().PHP_EOL);
print('ICAO: '.$decoded_metar->getIcao().PHP_EOL);
print('Day: '.$decoded_metar->getDay().PHP_EOL);
print('Time: '.$decoded_metar->getTime()->format('H:i').' UTC'.PHP_EOL);
$cd = new WindShearChunkDecoder();
print($cd->parse("WS R04 aaa")['result']['runway']);
$cd->parse("WS R04R aaa");
$cd->parse("WS ALL RWY aaa");
$cd = new TemperatureChunkDecoder();
var_dump($cd->parse("M01/M10 AAA")['result']);