@@ -28,6 +28,10 @@ discard block  | 
                                                    ||
| 28 | 28 | */  | 
                                                        
| 29 | 29 | private $appMeta;  | 
                                                        
| 30 | 30 | |
| 31 | + /**  | 
                                                        |
| 32 | + * @param string $name  | 
                                                        |
| 33 | + * @param string $contexts  | 
                                                        |
| 34 | + */  | 
                                                        |
| 31 | 35 | public function __construct($name, $contexts)  | 
                                                        
| 32 | 36 |      { | 
                                                        
| 33 | 37 | $this->appMeta = new AppMeta($name, $contexts);  | 
                                                        
@@ -75,7 +79,7 @@ discard block  | 
                                                    ||
| 75 | 79 | *  | 
                                                        
| 76 | 80 | * @param AbstractModule $module  | 
                                                        
| 77 | 81 | * @param AbstractAppMeta $appMeta  | 
                                                        
| 78 | - * @param string $contexts  | 
                                                        |
| 82 | + * @param string $scriptDir  | 
                                                        |
| 79 | 83 | */  | 
                                                        
| 80 | 84 | private function compile(AbstractModule $module, AbstractAppMeta $appMeta, $scriptDir)  | 
                                                        
| 81 | 85 |      { | 
                                                        
@@ -79,7 +79,7 @@ discard block  | 
                                                    ||
| 79 | 79 | */  | 
                                                        
| 80 | 80 | private function compile(AbstractModule $module, AbstractAppMeta $appMeta, $scriptDir)  | 
                                                        
| 81 | 81 |      { | 
                                                        
| 82 | - $hashFile = $appMeta->tmpDir . '/compile_hash';  | 
                                                        |
| 82 | + $hashFile = $appMeta->tmpDir.'/compile_hash';  | 
                                                        |
| 83 | 83 | $moduleHash = md5(serialize($module));  | 
                                                        
| 84 | 84 | $isUnchanged = file_exists($hashFile) && (file_get_contents($hashFile) === $moduleHash);  | 
                                                        
| 85 | 85 |          if ($isUnchanged) { | 
                                                        
@@ -104,11 +104,11 @@ discard block  | 
                                                    ||
| 104 | 104 |          $contextsArray = array_reverse(explode('-', $contexts)); | 
                                                        
| 105 | 105 | $module = null;  | 
                                                        
| 106 | 106 |          foreach ($contextsArray as $context) { | 
                                                        
| 107 | - $class = $appMeta->name . '\Module\\' . ucwords($context) . 'Module';  | 
                                                        |
| 108 | -            if (! class_exists($class)) { | 
                                                        |
| 109 | - $class = 'BEAR\Package\Context\\' . ucwords($context) . 'Module';  | 
                                                        |
| 107 | + $class = $appMeta->name.'\Module\\'.ucwords($context).'Module';  | 
                                                        |
| 108 | +            if (!class_exists($class)) { | 
                                                        |
| 109 | + $class = 'BEAR\Package\Context\\'.ucwords($context).'Module';  | 
                                                        |
| 110 | 110 | }  | 
                                                        
| 111 | -            if (! is_a($class, AbstractModule::class, true)) { | 
                                                        |
| 111 | +            if (!is_a($class, AbstractModule::class, true)) { | 
                                                        |
| 112 | 112 | throw new InvalidContextException($class);  | 
                                                        
| 113 | 113 | }  | 
                                                        
| 114 | 114 | /* @var $module AbstractModule */  | 
                                                        
@@ -123,8 +123,8 @@ discard block  | 
                                                    ||
| 123 | 123 | */  | 
                                                        
| 124 | 124 | private function cleanupDir($tmpDir)  | 
                                                        
| 125 | 125 |      { | 
                                                        
| 126 | -        $unlink = function ($path) use (&$unlink) { | 
                                                        |
| 127 | -            foreach (glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*') as $file) { | 
                                                        |
| 126 | +        $unlink = function($path) use (&$unlink) { | 
                                                        |
| 127 | +            foreach (glob(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*') as $file) { | 
                                                        |
| 128 | 128 | is_dir($file) ? $unlink($file) : unlink($file);  | 
                                                        
| 129 | 129 | @rmdir($file);  | 
                                                        
| 130 | 130 | }  |