-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinclude.php
More file actions
38 lines (34 loc) · 1.43 KB
/
Copy pathinclude.php
File metadata and controls
38 lines (34 loc) · 1.43 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
/**
* Подключение модуля as.onec_api (1C JSON API: остатки, цены, товары).
*
* PSR-4: As\OnecApi → lib/ (см. .settings.php). Явный автозагрузчик ниже дублирует маппинг ядра: на части
* установок Bitrix не регистрирует psr-4 из .settings.php для local-модулей до очистки кеша — без него классы
* (например JsonApiKernel) недоступны сразу после Install.
*
* Процедурный {@see include/stock_import_engine.php} не подключается здесь: ленивая загрузка через
* {@see \As\OnecApi\Stock\StockEngineBootstrap::ensureLoaded()} при обработке HTTP-маршрутов (см. JsonApiKernel).
*/
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
die();
}
spl_autoload_register(
static function (string $class): void {
$prefix = 'As\\OnecApi\\';
$len = strlen($prefix);
if (strncmp($class, $prefix, $len) !== 0) {
return;
}
$relative = substr($class, $len);
if ($relative === '') {
return;
}
$file = __DIR__ . '/lib/' . str_replace('\\', '/', $relative) . '.php';
if (is_file($file)) {
require_once $file;
}
},
true,
true
);
\As\OnecApi\Installer::syncIfNewVersion();