-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathtariffs.php
More file actions
38 lines (28 loc) · 1.25 KB
/
Copy pathtariffs.php
File metadata and controls
38 lines (28 loc) · 1.25 KB
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
34
35
36
37
38
<?php
declare(strict_types=1);
/**
* Справочник тарифов и конфигурация сайта
*/
require __DIR__ . '/bootstrap.php';
$client = rzd();
$tariffs = attempt(fn() => $client->references->tariffs());
heading(sprintf('Тарифов в справочнике: %d, из них действующих: %d', count($tariffs), count(array_filter(
$tariffs,
static fn(object $tariff): bool => $tariff->isActive(),
))));
foreach (array_slice($tariffs, 0, 20) as $tariff) {
printf(
"%-4d %s %-8s %-10s %s\n",
$tariff->id,
pad($tariff->sysName, 22),
$tariff->category ?? '',
$tariff->status ?? '',
$tariff->nonRefundable ? 'невозвратный' : '',
);
}
heading('Из конфигурации сайта');
$config = attempt(fn() => $client->references->appConfig());
printf("адрес подсказок станций %s\n", $config['stations_search_url'] ?? '-');
printf("лимит пассажиров %s\n", json_encode($config['passengers_limit'] ?? null));
printf("режим поиска %s\n", $config['search_mode'] ?? '-');
printf("капча в поиске %s\n", isset($config['search_captcha']) ? 'настроена' : 'нет');