@@ -1,6 +1,6 @@ discard block |
||
| 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); |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -if (! function_exists('config_path')) { |
|
| 12 | +if (!function_exists('config_path')) { |
|
| 13 | 13 | /** |
| 14 | 14 | * Get the configuration path. |
| 15 | 15 | * |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | function config_path($path = '') |
| 20 | 20 | { |
| 21 | - return app()->basePath() . '/config' . ($path ? '/' . $path : $path); |
|
| 21 | + return app()->basePath().'/config'.($path ? '/'.$path : $path); |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if (! function_exists('public_path')) { |
|
| 25 | +if (!function_exists('public_path')) { |
|
| 26 | 26 | /** |
| 27 | 27 | * Get the path to the public folder. |
| 28 | 28 | * |
@@ -31,6 +31,6 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function public_path($path = '') |
| 33 | 33 | { |
| 34 | - return app()->make('path.public') . ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); |
|
| 34 | + return app()->make('path.public').($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); |
|
| 35 | 35 | } |
| 36 | 36 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | continue; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $path = $this->module->getModulePath($this->getName()) . '/' . $folder->getPath(); |
|
| 286 | + $path = $this->module->getModulePath($this->getName()).'/'.$folder->getPath(); |
|
| 287 | 287 | |
| 288 | 288 | $this->filesystem->makeDirectory($path, 0755, true); |
| 289 | 289 | if (config('modules.stubs.gitkeep')) { |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | public function generateGitKeep($path) |
| 301 | 301 | { |
| 302 | - $this->filesystem->put($path . '/.gitkeep', ''); |
|
| 302 | + $this->filesystem->put($path.'/.gitkeep', ''); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | public function generateFiles() |
| 309 | 309 | { |
| 310 | 310 | foreach ($this->getFiles() as $stub => $file) { |
| 311 | - $path = $this->module->getModulePath($this->getName()) . $file; |
|
| 311 | + $path = $this->module->getModulePath($this->getName()).$file; |
|
| 312 | 312 | |
| 313 | 313 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 314 | 314 | $this->filesystem->makeDirectory($dir, 0775, true); |
@@ -332,13 +332,13 @@ discard block |
||
| 332 | 332 | ]); |
| 333 | 333 | |
| 334 | 334 | $this->console->call('module:make-provider', [ |
| 335 | - 'name' => $this->getName() . 'ServiceProvider', |
|
| 335 | + 'name' => $this->getName().'ServiceProvider', |
|
| 336 | 336 | 'module' => $this->getName(), |
| 337 | 337 | '--master' => true, |
| 338 | 338 | ]); |
| 339 | 339 | |
| 340 | 340 | $this->console->call('module:make-controller', [ |
| 341 | - 'controller' => $this->getName() . 'Controller', |
|
| 341 | + 'controller' => $this->getName().'Controller', |
|
| 342 | 342 | 'module' => $this->getName(), |
| 343 | 343 | ]); |
| 344 | 344 | } |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | protected function getStubContents($stub) |
| 354 | 354 | { |
| 355 | 355 | return (new Stub( |
| 356 | - '/' . $stub . '.stub', |
|
| 356 | + '/'.$stub.'.stub', |
|
| 357 | 357 | $this->getReplacement($stub) |
| 358 | 358 | ) |
| 359 | 359 | )->render(); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $replaces = []; |
| 388 | 388 | |
| 389 | 389 | foreach ($keys as $key) { |
| 390 | - if (method_exists($this, $method = 'get' . ucfirst(studly_case(strtolower($key))) . 'Replacement')) { |
|
| 390 | + if (method_exists($this, $method = 'get'.ucfirst(studly_case(strtolower($key))).'Replacement')) { |
|
| 391 | 391 | $replaces[$key] = $this->$method(); |
| 392 | 392 | } else { |
| 393 | 393 | $replaces[$key] = null; |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | private function generateModuleJsonFile() |
| 404 | 404 | { |
| 405 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 405 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 406 | 406 | |
| 407 | 407 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 408 | 408 | $this->filesystem->makeDirectory($dir, 0775, true); |
@@ -419,13 +419,13 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | private function cleanModuleJsonFile() |
| 421 | 421 | { |
| 422 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 422 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 423 | 423 | |
| 424 | 424 | $content = $this->filesystem->get($path); |
| 425 | 425 | $namespace = $this->getModuleNamespaceReplacement(); |
| 426 | 426 | $studlyName = $this->getStudlyNameReplacement(); |
| 427 | 427 | |
| 428 | - $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\Providers\\\\' . $studlyName . 'ServiceProvider"'; |
|
| 428 | + $provider = '"'.$namespace.'\\\\'.$studlyName.'\\\\Providers\\\\'.$studlyName.'ServiceProvider"'; |
|
| 429 | 429 | |
| 430 | 430 | $content = str_replace($provider, '', $content); |
| 431 | 431 | |
@@ -494,6 +494,6 @@ discard block |
||
| 494 | 494 | |
| 495 | 495 | protected function getRoutesLocationReplacement() |
| 496 | 496 | { |
| 497 | - return '/' . $this->module->config('stubs.files.routes'); |
|
| 497 | + return '/'.$this->module->config('stubs.files.routes'); |
|
| 498 | 498 | } |
| 499 | 499 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function toArray() |
| 26 | 26 | { |
| 27 | - return array_map(function ($value) { |
|
| 27 | + return array_map(function($value) { |
|
| 28 | 28 | if ($value instanceof Module) { |
| 29 | 29 | $attributes = $value->json()->getAttributes(); |
| 30 | 30 | $attributes["path"] = $value->getPath(); |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Nwidart\Modules\Laravel; |
| 4 | 4 | |
| 5 | -use Nwidart\Modules\Json; |
|
| 6 | 5 | use Nwidart\Modules\Repository as BaseRepository; |
| 7 | 6 | |
| 8 | 7 | class Repository extends BaseRepository |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Nwidart\Modules\Lumen; |
| 4 | 4 | |
| 5 | -use Nwidart\Modules\Json; |
|
| 6 | 5 | use Nwidart\Modules\Repository as BaseRepository; |
| 7 | 6 | |
| 8 | 7 | class Repository extends BaseRepository |
@@ -115,7 +115,6 @@ discard block |
||
| 115 | 115 | /** |
| 116 | 116 | * Creates a new Module instance |
| 117 | 117 | * |
| 118 | - * @param Container $app |
|
| 119 | 118 | * @param $name |
| 120 | 119 | * @param $path |
| 121 | 120 | * @return \Nwidart\Modules\Module |
@@ -420,7 +419,7 @@ discard block |
||
| 420 | 419 | /** |
| 421 | 420 | * Get module path for a specific module. |
| 422 | 421 | * |
| 423 | - * @param $module |
|
| 422 | + * @param string $module |
|
| 424 | 423 | * |
| 425 | 424 | * @return string |
| 426 | 425 | */ |
@@ -448,9 +447,9 @@ discard block |
||
| 448 | 447 | /** |
| 449 | 448 | * Get a specific config data from a configuration file. |
| 450 | 449 | * |
| 451 | - * @param $key |
|
| 450 | + * @param string $key |
|
| 452 | 451 | * |
| 453 | - * @param null $default |
|
| 452 | + * @param string $default |
|
| 454 | 453 | * @return mixed |
| 455 | 454 | */ |
| 456 | 455 | public function config($key, $default = null) |
@@ -650,7 +649,7 @@ discard block |
||
| 650 | 649 | /** |
| 651 | 650 | * Get stub path. |
| 652 | 651 | * |
| 653 | - * @return string|null |
|
| 652 | + * @return string|boolean |
|
| 654 | 653 | */ |
| 655 | 654 | public function getStubPath() |
| 656 | 655 | { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $paths = array_merge($paths, $this->config('scan.paths')); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $paths = array_map(function ($path) { |
|
| 109 | + $paths = array_map(function($path) { |
|
| 110 | 110 | return ends_with($path, '/*') ? $path : str_finish($path, '/*'); |
| 111 | 111 | }, $paths); |
| 112 | 112 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function getCached() |
| 192 | 192 | { |
| 193 | - return $this->app['cache']->remember($this->config('cache.key'), $this->config('cache.lifetime'), function () { |
|
| 193 | + return $this->app['cache']->remember($this->config('cache.key'), $this->config('cache.lifetime'), function() { |
|
| 194 | 194 | return $this->toCollection()->toArray(); |
| 195 | 195 | }); |
| 196 | 196 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | { |
| 279 | 279 | $modules = $this->enabled(); |
| 280 | 280 | |
| 281 | - uasort($modules, function (Module $a, Module $b) use ($direction) { |
|
| 281 | + uasort($modules, function(Module $a, Module $b) use ($direction) { |
|
| 282 | 282 | if ($a->order == $b->order) { |
| 283 | 283 | return 0; |
| 284 | 284 | } |
@@ -428,9 +428,9 @@ discard block |
||
| 428 | 428 | public function getModulePath($module) |
| 429 | 429 | { |
| 430 | 430 | try { |
| 431 | - return $this->findOrFail($module)->getPath() . '/'; |
|
| 431 | + return $this->findOrFail($module)->getPath().'/'; |
|
| 432 | 432 | } catch (ModuleNotFoundException $e) { |
| 433 | - return $this->getPath() . '/' . Str::studly($module) . '/'; |
|
| 433 | + return $this->getPath().'/'.Str::studly($module).'/'; |
|
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | */ |
| 444 | 444 | public function assetPath($module) : string |
| 445 | 445 | { |
| 446 | - return $this->config('paths.assets') . '/' . $module; |
|
| 446 | + return $this->config('paths.assets').'/'.$module; |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | public function config($key, $default = null) |
| 458 | 458 | { |
| 459 | - return $this->app['config']->get('modules.' . $key, $default); |
|
| 459 | + return $this->app['config']->get('modules.'.$key, $default); |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | /** |
@@ -557,9 +557,9 @@ discard block |
||
| 557 | 557 | } |
| 558 | 558 | list($name, $url) = explode(':', $asset); |
| 559 | 559 | |
| 560 | - $baseUrl = str_replace(public_path() . DIRECTORY_SEPARATOR, '', $this->getAssetsPath()); |
|
| 560 | + $baseUrl = str_replace(public_path().DIRECTORY_SEPARATOR, '', $this->getAssetsPath()); |
|
| 561 | 561 | |
| 562 | - $url = $this->app['url']->asset($baseUrl . "/{$name}/" . $url); |
|
| 562 | + $url = $this->app['url']->asset($baseUrl."/{$name}/".$url); |
|
| 563 | 563 | |
| 564 | 564 | return str_replace(['http://', 'https://'], '//', $url); |
| 565 | 565 | } |