@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | |
41 | 41 | public static function getInstance(string $appName, string $context, string $appDir, ?CacheInterface $cache = null): InjectorInterface |
42 | 42 | { |
43 | - $injectorId = str_replace('\\', '_', $appName) . $context; |
|
43 | + $injectorId = str_replace('\\', '_', $appName).$context; |
|
44 | 44 | if (isset(self::$instances[$injectorId])) { |
45 | 45 | return self::$instances[$injectorId]; |
46 | 46 | } |
47 | 47 | |
48 | 48 | $meta = new Meta($appName, $context, $appDir); |
49 | - $cache = $cache ?? new ChainAdapter([new ApcuAdapter($injectorId), new FilesystemAdapter($injectorId, 0, $meta->tmpDir . '/injector')]); |
|
50 | - $injector = $cache->get($injectorId, static function () use ($meta, $context): InjectorInterface { |
|
49 | + $cache = $cache ?? new ChainAdapter([new ApcuAdapter($injectorId), new FilesystemAdapter($injectorId, 0, $meta->tmpDir.'/injector')]); |
|
50 | + $injector = $cache->get($injectorId, static function() use ($meta, $context): InjectorInterface { |
|
51 | 51 | $injector = self::factory($meta, $context); |
52 | 52 | $injector->getInstance(AppInterface::class); |
53 | 53 | |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | |
62 | 62 | private static function factory(Meta $meta, string $context): InjectorInterface |
63 | 63 | { |
64 | - $scriptDir = $meta->tmpDir . '/di'; |
|
65 | - ! is_dir($scriptDir) && ! @mkdir($scriptDir) && ! is_dir($scriptDir); |
|
64 | + $scriptDir = $meta->tmpDir.'/di'; |
|
65 | + !is_dir($scriptDir) && !@mkdir($scriptDir) && !is_dir($scriptDir); |
|
66 | 66 | $module = (new Module())($meta, $context, ''); |
67 | 67 | $rayInjector = new RayInjector($module, $scriptDir); |
68 | 68 | $isProd = $rayInjector->getInstance('', Compile::class); |
69 | 69 | assert(is_bool($isProd)); |
70 | 70 | if ($isProd) { |
71 | - return new ScriptInjector($scriptDir, static function () use ($scriptDir, $module) { |
|
71 | + return new ScriptInjector($scriptDir, static function() use ($scriptDir, $module) { |
|
72 | 72 | return new ScriptinjectorModule($scriptDir, $module); |
73 | 73 | }); |
74 | 74 | } |