2022-12-29 20:40:06 +01:00
|
|
|
<?php declare(strict_types=1);
|
2020-06-16 17:52:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load schema file names.
|
2023-08-13 15:47:21 +02:00
|
|
|
* @internal
|
2020-06-16 17:52:55 +02:00
|
|
|
*/
|
|
|
|
function loadSchemas(): array
|
|
|
|
{
|
2024-01-16 20:39:09 +01:00
|
|
|
$last = file_get_contents("https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl");
|
|
|
|
preg_match("|// Layer (\d+)|i", $last, $matches);
|
|
|
|
file_put_contents(getcwd()."/schemas/TL_telegram_v{$matches[1]}.tl", $last);
|
|
|
|
|
2020-06-16 17:52:55 +02:00
|
|
|
$res = [];
|
2022-12-08 20:16:40 +01:00
|
|
|
foreach (glob(getcwd().'/schemas/TL_telegram_*') as $file) {
|
|
|
|
preg_match("/telegram_v(\d+)/", $file, $matches);
|
2020-06-16 17:52:55 +02:00
|
|
|
$res[$matches[1]] = $file;
|
|
|
|
}
|
2022-12-08 20:16:40 +01:00
|
|
|
ksort($res);
|
2020-06-16 17:52:55 +02:00
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return max available layer number.
|
|
|
|
*
|
|
|
|
* @param array $schemas Scheme array
|
2023-08-13 15:47:21 +02:00
|
|
|
* @internal
|
2020-06-16 17:52:55 +02:00
|
|
|
*
|
|
|
|
* @return integer
|
|
|
|
*/
|
|
|
|
function maxLayer(array $schemas): int
|
|
|
|
{
|
2022-12-08 20:16:40 +01:00
|
|
|
$schemas = array_keys($schemas);
|
|
|
|
return end($schemas);
|
2020-06-16 17:52:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Init docs.
|
|
|
|
*
|
|
|
|
* @param array $layers Scheme array
|
2023-08-13 15:47:21 +02:00
|
|
|
* @internal
|
2020-06-16 17:52:55 +02:00
|
|
|
*
|
|
|
|
* @return array Documentation information for old docs
|
|
|
|
*/
|
|
|
|
function initDocs(array $layers): array
|
|
|
|
{
|
2021-12-21 14:44:39 +01:00
|
|
|
return [];
|
2020-06-16 17:52:55 +02:00
|
|
|
}
|