Completed
Pull Request — 1.x (#330)
by Akihito
02:57
created
src/Injector.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use BEAR\Package\Context\Provider\ProdCacheProvider;
10 10
 use BEAR\Package\Provide\Boot\ScriptinjectorModule;
11 11
 use BEAR\Sunday\Extension\Application\AppInterface;
12
-use Doctrine\Common\Cache\Cache;
13 12
 use Doctrine\Common\Cache\ChainCache;
14 13
 use Ray\Compiler\ScriptInjector;
15 14
 use Ray\Di\Injector as RayInjector;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public static function getInstance(string $appName, string $context, string $appDir, string $cacheNamespace = '') : InjectorInterface
32 32
     {
33
-        $injectorId = $appName . $context . $cacheNamespace;
33
+        $injectorId = $appName.$context.$cacheNamespace;
34 34
         if (isset(self::$instances[$injectorId])) {
35 35
             return self::$instances[$injectorId];
36 36
         }
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
 
47 47
     private static function factory(Meta $meta, string $context, string $cacheNamespace, ChainCache $cache) : InjectorInterface
48 48
     {
49
-        $scriptDir = $meta->tmpDir . '/di';
50
-        ! is_dir($scriptDir) && ! @mkdir($scriptDir) && ! is_dir($scriptDir);
49
+        $scriptDir = $meta->tmpDir.'/di';
50
+        !is_dir($scriptDir) && !@mkdir($scriptDir) && !is_dir($scriptDir);
51 51
         $module = (new Module)($meta, $context, $cacheNamespace);
52 52
         $rayInjector = new RayInjector($module, $scriptDir);
53 53
         /** @var bool $isProd */
54 54
         $isProd = $rayInjector->getInstance(DiCompile::class);
55
-        if (! $isProd) {
55
+        if (!$isProd) {
56 56
             $rayInjector->getInstance(AppInterface::class);
57 57
 
58 58
             return $rayInjector;
59 59
         }
60
-        $scriptInjector = new ScriptInjector($scriptDir, function () use ($scriptDir, $module) {
60
+        $scriptInjector = new ScriptInjector($scriptDir, function() use ($scriptDir, $module) {
61 61
             return new ScriptinjectorModule($scriptDir, $module);
62 62
         });
63 63
         $scriptInjector->getInstance(AppInterface::class); // cache App as a singleton
Please login to merge, or discard this patch.