Completed
Pull Request — 1.x (#380)
by Akihito
01:41 queued 01:14
created
src/Injector.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
 
43 43
     public static function getInstance(string $appName, string $context, string $appDir, ?CacheInterface $cache = null): InjectorInterface
44 44
     {
45
-        $injectorId = str_replace('\\', '_', $appName) . $context;
45
+        $injectorId = str_replace('\\', '_', $appName).$context;
46 46
         if (isset(self::$instances[$injectorId])) {
47 47
             return self::$instances[$injectorId];
48 48
         }
49 49
 
50 50
         $meta = new Meta($appName, $context, $appDir);
51
-        $cache = $cache ?? new ChainAdapter([new ApcuAdapter($injectorId), new FilesystemAdapter($injectorId, 0, $meta->tmpDir . '/injector')]);
51
+        $cache = $cache ?? new ChainAdapter([new ApcuAdapter($injectorId), new FilesystemAdapter($injectorId, 0, $meta->tmpDir.'/injector')]);
52 52
         assert($cache instanceof AdapterInterface);
53 53
         /** @psalm-suppress all */
54 54
         [$injector, $bindingsUpdate] = $cache->getItem($injectorId)->get();
55
-        if (! $injector instanceof InjectorInterface || ($injector instanceof RayInjector && $bindingsUpdate instanceof BindingsUpdate && $bindingsUpdate->isUpdated($meta))) {
55
+        if (!$injector instanceof InjectorInterface || ($injector instanceof RayInjector && $bindingsUpdate instanceof BindingsUpdate && $bindingsUpdate->isUpdated($meta))) {
56 56
             $injector = self::factory($meta, $context);
57 57
             $injector->getInstance(AppInterface::class);
58 58
             assert($cache instanceof AdapterInterface);
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 
69 69
     private static function factory(Meta $meta, string $context): InjectorInterface
70 70
     {
71
-        $scriptDir = $meta->tmpDir . '/di';
72
-        ! is_dir($scriptDir) && ! @mkdir($scriptDir) && ! is_dir($scriptDir);
71
+        $scriptDir = $meta->tmpDir.'/di';
72
+        !is_dir($scriptDir) && !@mkdir($scriptDir) && !is_dir($scriptDir);
73 73
         $module = (new Module())($meta, $context, '');
74 74
         $rayInjector = new RayInjector($module, $scriptDir);
75 75
         $isProd = $rayInjector->getInstance('', Compile::class);
76 76
         assert(is_bool($isProd));
77 77
         if ($isProd) {
78
-            return new ScriptInjector($scriptDir, static function () use ($scriptDir, $module) {
78
+            return new ScriptInjector($scriptDir, static function() use ($scriptDir, $module) {
79 79
                 return new ScriptinjectorModule($scriptDir, $module);
80 80
             });
81 81
         }
Please login to merge, or discard this patch.