-
Notifications
You must be signed in to change notification settings - Fork 6
/
nusantara
33 lines (27 loc) · 1.07 KB
/
nusantara
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
32
33
#!/usr/bin/env php
<?php
include __DIR__.'/vendor/autoload.php';
use KejawenLab\Nusantara\Nusantara;
use Symfony\Component\Console\Output\ConsoleOutput;
$output = new ConsoleOutput();
$nusantara = new Nusantara();
$output->writeln([
'<comment>KEJAWENLAB NUSANTARA</comment>',
'<info>Perangkat untuk memperoleh data wilayah termuktahir di Indonesia.</info>',
'=================================================================',
]);
$start = microtime(true);
file_put_contents(__DIR__.'/wilayah.json', json_encode($nusantara->fetch(Nusantara::SCOPE_DESA, $output)));
$end = microtime(true);
$second = $end - $start;
$minute = round($second / 60);
$hour = 0;
if ($minute > 0) {
$second = (int) $second - ($minute * 60);
$hour = round($minute / 60);
if ($hour > 0) {
$minute = (int) $minute - ($hour * 60);
}
}
$output->writeln('<comment>Menyimpan data.</comment>');
$output->writeln(sprintf('<comment>Pemrosesan telah selesai dalam "<info>%s</info>" jam "<info>%s</info>" menit "<info>%s</info>" detik</comment>', $hour, $minute, number_format($second, 2)));