@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('module_path')) { |
|
| 3 | +if (!function_exists('module_path')) { |
|
| 4 | 4 | function module_path($name) |
| 5 | 5 | { |
| 6 | 6 | $module = app('modules')->find($name); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | { |
| 178 | 178 | $lowerName = $this->getLowerName(); |
| 179 | 179 | |
| 180 | - $langPath = $this->getPath() . "/Resources/lang"; |
|
| 180 | + $langPath = $this->getPath()."/Resources/lang"; |
|
| 181 | 181 | |
| 182 | 182 | if (is_dir($langPath)) { |
| 183 | 183 | $this->loadTranslationsFrom($langPath, $lowerName); |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | $file = 'module.json'; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - return array_get($this->moduleJson, $file, function () use ($file) { |
|
| 201 | - return $this->moduleJson[$file] = new Json($this->getPath() . '/' . $file, $this->app['files']); |
|
| 200 | + return array_get($this->moduleJson, $file, function() use ($file) { |
|
| 201 | + return $this->moduleJson[$file] = new Json($this->getPath().'/'.$file, $this->app['files']); |
|
| 202 | 202 | }); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | protected function fireEvent($event) |
| 251 | 251 | { |
| 252 | - $this->app['events']->fire(sprintf('modules.%s.' . $event, $this->getLowerName()), [$this]); |
|
| 252 | + $this->app['events']->fire(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | protected function registerFiles() |
| 280 | 280 | { |
| 281 | 281 | foreach ($this->get('files', []) as $file) { |
| 282 | - include $this->path . '/' . $file; |
|
| 282 | + include $this->path.'/'.$file; |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | public function getExtraPath($path) |
| 402 | 402 | { |
| 403 | - return $this->getPath() . '/' . $path; |
|
| 403 | + return $this->getPath().'/'.$path; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @param Container $app |
| 46 | 46 | * @param $name |
| 47 | - * @param $path |
|
| 47 | + * @param string $path |
|
| 48 | 48 | */ |
| 49 | 49 | public function __construct(Container $app, $name, $path) |
| 50 | 50 | { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | /** |
| 189 | 189 | * Get json contents from the cache, setting as needed. |
| 190 | 190 | * |
| 191 | - * @param $file |
|
| 191 | + * @param string $file |
|
| 192 | 192 | * |
| 193 | 193 | * @return Json |
| 194 | 194 | */ |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | /** |
| 220 | 220 | * Get a specific data from composer.json file by given the key. |
| 221 | 221 | * |
| 222 | - * @param $key |
|
| 222 | + * @param string $key |
|
| 223 | 223 | * @param null $default |
| 224 | 224 | * |
| 225 | 225 | * @return mixed |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | /** |
| 298 | 298 | * Determine whether the given status same with the current module status. |
| 299 | 299 | * |
| 300 | - * @param $status |
|
| 300 | + * @param integer $status |
|
| 301 | 301 | * |
| 302 | 302 | * @return bool |
| 303 | 303 | */ |
@@ -349,9 +349,9 @@ discard block |
||
| 349 | 349 | /** |
| 350 | 350 | * Set active state for current module. |
| 351 | 351 | * |
| 352 | - * @param $active |
|
| 352 | + * @param integer $active |
|
| 353 | 353 | * |
| 354 | - * @return bool |
|
| 354 | + * @return integer |
|
| 355 | 355 | */ |
| 356 | 356 | public function setActive($active) |
| 357 | 357 | { |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | return Str::studly($this->name); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Get name in snake case. |
|
| 99 | - * |
|
| 100 | - * @return string |
|
| 101 | - */ |
|
| 97 | + /** |
|
| 98 | + * Get name in snake case. |
|
| 99 | + * |
|
| 100 | + * @return string |
|
| 101 | + */ |
|
| 102 | 102 | public function getSnakeName() |
| 103 | 103 | { |
| 104 | - return Str::snake($this->name); |
|
| 104 | + return Str::snake($this->name); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -280,18 +280,18 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | protected function registerProviders() |
| 282 | 282 | { |
| 283 | - (new ProviderRepository($this->app, new Filesystem, $this->getCachedServicesPath())) |
|
| 283 | + (new ProviderRepository($this->app, new Filesystem, $this->getCachedServicesPath())) |
|
| 284 | 284 | ->load($this->get('providers', [])); |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - /** |
|
| 288 | - * Get the path to the cached *_module.php file. |
|
| 289 | - * |
|
| 290 | - * @return string |
|
| 291 | - */ |
|
| 287 | + /** |
|
| 288 | + * Get the path to the cached *_module.php file. |
|
| 289 | + * |
|
| 290 | + * @return string |
|
| 291 | + */ |
|
| 292 | 292 | public function getCachedServicesPath() |
| 293 | 293 | { |
| 294 | - return Str::replaceLast('services.php', $this->getSnakeName().'_module.php', $this->app->getCachedServicesPath()); |
|
| 294 | + return Str::replaceLast('services.php', $this->getSnakeName().'_module.php', $this->app->getCachedServicesPath()); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function setupStubPath() |
| 33 | 33 | { |
| 34 | - Stub::setBasePath(__DIR__ . '/Commands/stubs'); |
|
| 34 | + Stub::setBasePath(__DIR__.'/Commands/stubs'); |
|
| 35 | 35 | |
| 36 | - $this->app->booted(function ($app) { |
|
| 36 | + $this->app->booted(function($app) { |
|
| 37 | 37 | if ($app['modules']->config('stubs.enabled') === true) { |
| 38 | 38 | Stub::setBasePath($app['modules']->config('stubs.path')); |
| 39 | 39 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function setupStubPath() |
| 26 | 26 | { |
| 27 | - Stub::setBasePath(__DIR__ . '/Commands/stubs'); |
|
| 27 | + Stub::setBasePath(__DIR__.'/Commands/stubs'); |
|
| 28 | 28 | |
| 29 | 29 | if (app('modules')->config('stubs.enabled') === true) { |
| 30 | 30 | Stub::setBasePath(app('modules')->config('stubs.path')); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | protected function registerNamespaces() |
| 45 | 45 | { |
| 46 | - $configPath = __DIR__ . '/../config/config.php'; |
|
| 46 | + $configPath = __DIR__.'/../config/config.php'; |
|
| 47 | 47 | |
| 48 | 48 | $this->mergeConfigFrom($configPath, 'modules'); |
| 49 | 49 | $this->publishes([ |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | protected function registerServices() |
| 58 | 58 | { |
| 59 | - $this->app->singleton('modules', function ($app) { |
|
| 59 | + $this->app->singleton('modules', function($app) { |
|
| 60 | 60 | $path = $app['config']->get('modules.paths.modules'); |
| 61 | 61 | |
| 62 | 62 | return new Repository($app, $path); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | public function generateFolders() |
| 277 | 277 | { |
| 278 | 278 | foreach ($this->getFolders() as $folder) { |
| 279 | - $path = $this->module->getModulePath($this->getName()) . '/' . $folder; |
|
| 279 | + $path = $this->module->getModulePath($this->getName()).'/'.$folder; |
|
| 280 | 280 | |
| 281 | 281 | $this->filesystem->makeDirectory($path, 0755, true); |
| 282 | 282 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public function generateGitKeep($path) |
| 293 | 293 | { |
| 294 | - $this->filesystem->put($path . '/.gitkeep', ''); |
|
| 294 | + $this->filesystem->put($path.'/.gitkeep', ''); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | public function generateFiles() |
| 301 | 301 | { |
| 302 | 302 | foreach ($this->getFiles() as $stub => $file) { |
| 303 | - $path = $this->module->getModulePath($this->getName()) . $file; |
|
| 303 | + $path = $this->module->getModulePath($this->getName()).$file; |
|
| 304 | 304 | |
| 305 | 305 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 306 | 306 | $this->filesystem->makeDirectory($dir, 0775, true); |
@@ -324,13 +324,13 @@ discard block |
||
| 324 | 324 | ]); |
| 325 | 325 | |
| 326 | 326 | $this->console->call('module:make-provider', [ |
| 327 | - 'name' => $this->getName() . 'ServiceProvider', |
|
| 327 | + 'name' => $this->getName().'ServiceProvider', |
|
| 328 | 328 | 'module' => $this->getName(), |
| 329 | 329 | '--master' => true, |
| 330 | 330 | ]); |
| 331 | 331 | |
| 332 | 332 | $this->console->call('module:make-controller', [ |
| 333 | - 'controller' => $this->getName() . 'Controller', |
|
| 333 | + 'controller' => $this->getName().'Controller', |
|
| 334 | 334 | 'module' => $this->getName(), |
| 335 | 335 | ]); |
| 336 | 336 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | protected function getStubContents($stub) |
| 346 | 346 | { |
| 347 | 347 | return (new Stub( |
| 348 | - '/' . $stub . '.stub', |
|
| 348 | + '/'.$stub.'.stub', |
|
| 349 | 349 | $this->getReplacement($stub) |
| 350 | 350 | ) |
| 351 | 351 | )->render(); |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $replaces = []; |
| 380 | 380 | |
| 381 | 381 | foreach ($keys as $key) { |
| 382 | - if (method_exists($this, $method = 'get' . ucfirst(studly_case(strtolower($key))) . 'Replacement')) { |
|
| 382 | + if (method_exists($this, $method = 'get'.ucfirst(studly_case(strtolower($key))).'Replacement')) { |
|
| 383 | 383 | $replaces[$key] = call_user_func([$this, $method]); |
| 384 | 384 | } else { |
| 385 | 385 | $replaces[$key] = null; |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | private function generateModuleJsonFile() |
| 396 | 396 | { |
| 397 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 397 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 398 | 398 | |
| 399 | 399 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 400 | 400 | $this->filesystem->makeDirectory($dir, 0775, true); |
@@ -411,13 +411,13 @@ discard block |
||
| 411 | 411 | */ |
| 412 | 412 | private function cleanModuleJsonFile() |
| 413 | 413 | { |
| 414 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 414 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 415 | 415 | |
| 416 | 416 | $content = $this->filesystem->get($path); |
| 417 | 417 | $namespace = $this->getModuleNamespaceReplacement(); |
| 418 | 418 | $studlyName = $this->getStudlyNameReplacement(); |
| 419 | 419 | |
| 420 | - $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\Providers\\\\' . $studlyName . 'ServiceProvider"'; |
|
| 420 | + $provider = '"'.$namespace.'\\\\'.$studlyName.'\\\\Providers\\\\'.$studlyName.'ServiceProvider"'; |
|
| 421 | 421 | |
| 422 | 422 | $content = str_replace($provider, '', $content); |
| 423 | 423 | |