| Total Complexity | 6 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 76.47% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | class Nacl |
||
| 19 | { |
||
| 20 | private static array $macros = []; |
||
| 21 | |||
| 22 | 1 | public static function registerMacro(MacroInterface $macro): void |
|
| 23 | { |
||
| 24 | 1 | self::$macros[] = $macro; |
|
| 25 | } |
||
| 26 | |||
| 27 | 591 | public static function createParser(): Parser |
|
| 28 | { |
||
| 29 | 591 | $parser = new Parser(); |
|
| 30 | 591 | $parser->registerMacro(new Macros\Env()); |
|
| 31 | 591 | $parser->registerMacro(new Macros\Constant()); |
|
| 32 | |||
| 33 | 591 | foreach (self::$macros as $macro) { |
|
| 34 | 8 | $parser->registerMacro($macro); |
|
| 35 | } |
||
| 36 | |||
| 37 | 591 | return $parser; |
|
| 38 | } |
||
| 39 | |||
| 40 | 542 | public static function parse(string $str): mixed |
|
| 41 | { |
||
| 42 | 542 | return self::createParser()->parse($str); |
|
| 43 | } |
||
| 44 | |||
| 45 | 9 | public static function parseFile(string $file): mixed |
|
| 46 | { |
||
| 47 | 9 | return self::createParser()->parseFile($file); |
|
| 48 | } |
||
| 49 | |||
| 50 | public static function dump(mixed $var): mixed |
||
| 55 | } |
||
| 56 | } |
||
| 57 |