factory.php

main 22 lines · 547 bytes Raw
Alex Alex Commit Initial commit 01/10/2026 09:20
1<?php
2
3function znote_server_adapter(?string $engine = null): ServerAdapterInterface {
4 static $cache = array();
5
6 global $config;
7 $engine = $engine ?? (string)($config['ServerEngineReal'] ?? $config['ServerEngine'] ?? 'TFS_10');
8
9 if (isset($cache[$engine])) {
10 return $cache[$engine];
11 }
12
13 $adapter = match ($engine) {
14 'OTHIRE' => new OtHireAdapter(),
15 'CANARY' => new CanaryAdapter(),
16 'BLACKTEK' => new BlackTekAdapter(),
17 default => new TFSAdapter($engine), // TFS_02, TFS_03, TFS_10, TFS_16
18 };
19
20 return $cache[$engine] = $adapter;
21}
22
Top