Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
Functions.php
1<?php
2
3namespace Bitrix\Bizproc\Calc;
4
6{
7 private static array $functions;
8 private static array $libsClasses = [
9 'logic' => Libs\LogicLib::class,
10 'string' => Libs\StringLib::class,
11 'math' => Libs\MathLib::class,
12 'date' => Libs\DateLib::class,
13 'array' => Libs\ArrayLib::class,
14 'document' => Libs\DocumentLib::class,
15 ];
16
17 public static function getList(): array
18 {
19 if (!isset(static::$functions))
20 {
21 static::$functions = [];
22 foreach (static::getLibs() as $lib)
23 {
24 static::$functions += static::getLibFunctions($lib);
25 }
26 }
27
28 return static::$functions;
29 }
30
34 protected static function getLibs(): array
35 {
36 $libs = [];
37
39 foreach (static::$libsClasses as $libClass)
40 {
41 $libs[] = new $libClass();
42 }
43
44 //TODO: send Event
45
46 return $libs;
47 }
48
49 protected static function getLibFunctions(Libs\BaseLib $lib): array
50 {
51 return array_map(
52 static function($function) use ($lib)
53 {
54 $function['func'] = \Closure::fromCallable([$lib, $function['func']]);
55
56 return $function;
57 },
58 $lib->getFunctions()
59 );
60 }
61}
static getLibFunctions(Libs\BaseLib $lib)
Definition Functions.php:49