phpvms/app/Support/ICAO.php

26 lines
482 B
PHP
Raw Normal View History

<?php
namespace App\Support;
/**
* ICAO Helper Tools
*/
class ICAO
{
/**
* Create a random hex code. Eventually this may follow the format in:
* ICAO Aeronautical Telecommunications, Annex 10, Vol. III, chapter 9
2018-08-27 00:40:04 +08:00
*
* @param null $country
2018-08-27 00:40:04 +08:00
*
2018-08-27 02:50:08 +08:00
* @throws \Exception
2018-08-27 02:51:47 +08:00
*
* @return string
*/
2019-04-08 06:35:55 +08:00
public static function createHexCode($country = null): string
{
$bytes = random_bytes(4);
return bin2hex($bytes);
}
}