@@ -7,32 +7,32 @@ |
||
| 7 | 7 | |
| 8 | 8 | class TemplateLoader { |
| 9 | 9 | |
| 10 | - protected $fs; |
|
| 10 | + protected $fs; |
|
| 11 | 11 | |
| 12 | - protected $loaded; |
|
| 12 | + protected $loaded; |
|
| 13 | 13 | |
| 14 | - public function __construct(Filesystem $fs) |
|
| 15 | - { |
|
| 16 | - $this->fs = $fs; |
|
| 17 | - $this->loaded = []; |
|
| 18 | - } |
|
| 14 | + public function __construct(Filesystem $fs) |
|
| 15 | + { |
|
| 16 | + $this->fs = $fs; |
|
| 17 | + $this->loaded = []; |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function load($name) |
|
| 21 | - { |
|
| 22 | - if(! isset($this->loaded[$name])){ |
|
| 23 | - $path = __DIR__ . "/../../templates/{$name}.wnt"; |
|
| 20 | + public function load($name) |
|
| 21 | + { |
|
| 22 | + if(! isset($this->loaded[$name])){ |
|
| 23 | + $path = __DIR__ . "/../../templates/{$name}.wnt"; |
|
| 24 | 24 | |
| 25 | - if($customPath = config("lumen-generators.custom_templates.{$name}")){ |
|
| 26 | - $path = $customPath; |
|
| 25 | + if($customPath = config("lumen-generators.custom_templates.{$name}")){ |
|
| 26 | + $path = $customPath; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - try { |
|
| 30 | - $this->loaded[$name] = $this->fs->get($path); |
|
| 31 | - } catch(\Exception $e) { |
|
| 32 | - throw new TemplateException("Unable to read the file '{$path}'"); |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - return new Template($this, $this->loaded[$name]); |
|
| 36 | - } |
|
| 29 | + try { |
|
| 30 | + $this->loaded[$name] = $this->fs->get($path); |
|
| 31 | + } catch(\Exception $e) { |
|
| 32 | + throw new TemplateException("Unable to read the file '{$path}'"); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + return new Template($this, $this->loaded[$name]); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | } |
@@ -19,16 +19,16 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function load($name) |
| 21 | 21 | { |
| 22 | - if(! isset($this->loaded[$name])){ |
|
| 22 | + if (!isset($this->loaded[$name])) { |
|
| 23 | 23 | $path = __DIR__ . "/../../templates/{$name}.wnt"; |
| 24 | 24 | |
| 25 | - if($customPath = config("lumen-generators.custom_templates.{$name}")){ |
|
| 25 | + if ($customPath = config("lumen-generators.custom_templates.{$name}")) { |
|
| 26 | 26 | $path = $customPath; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | try { |
| 30 | 30 | $this->loaded[$name] = $this->fs->get($path); |
| 31 | - } catch(\Exception $e) { |
|
| 31 | + } catch (\Exception $e) { |
|
| 32 | 32 | throw new TemplateException("Unable to read the file '{$path}'"); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -6,10 +6,10 @@ |
||
| 6 | 6 | |
| 7 | 7 | class PublishCommand extends Command { |
| 8 | 8 | |
| 9 | - protected $signature = 'wn:publish |
|
| 9 | + protected $signature = 'wn:publish |
|
| 10 | 10 | {--f : force the publishing.} |
| 11 | 11 | '; |
| 12 | - protected $description = 'Publishes the laravel-generators config file to the config folder of your project'; |
|
| 12 | + protected $description = 'Publishes the laravel-generators config file to the config folder of your project'; |
|
| 13 | 13 | protected $fs; |
| 14 | 14 | |
| 15 | 15 | public function __construct(Filesystem $fs) |
@@ -23,22 +23,22 @@ |
||
| 23 | 23 | { |
| 24 | 24 | $paths = ServiceProvider::pathsToPublish('Wn\Generators\CommandsServiceProvider'); |
| 25 | 25 | |
| 26 | - foreach($paths as $from => $to){ |
|
| 26 | + foreach ($paths as $from => $to) { |
|
| 27 | 27 | $shortFrom = $this->shortPath($from); |
| 28 | 28 | |
| 29 | - if($this->copyFile($from, $to)) { |
|
| 29 | + if ($this->copyFile($from, $to)) { |
|
| 30 | 30 | $this->info($shortFrom . ' has succesfully been copied to ' . $this->shortPath($to)); |
| 31 | - }else{ |
|
| 31 | + } else { |
|
| 32 | 32 | $this->warn($shortFrom . ' could not be copied. To try and force use the --f option.'); |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - private function shortPath($path){ |
|
| 37 | + private function shortPath($path) { |
|
| 38 | 38 | return str_replace(base_path(), '', realpath($path)); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - private function copyFile($from, $to){ |
|
| 41 | + private function copyFile($from, $to) { |
|
| 42 | 42 | if ($this->fs->exists($to) && !$this->option('f')) { |
| 43 | 43 | return false; |
| 44 | 44 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | if($this->copyFile($from, $to)) { |
| 30 | 30 | $this->info($shortFrom . ' has succesfully been copied to ' . $this->shortPath($to)); |
| 31 | - }else{ |
|
| 31 | + } else{ |
|
| 32 | 32 | $this->warn($shortFrom . ' could not be copied. To try and force use the --f option.'); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | { |
| 7 | 7 | public function boot() |
| 8 | 8 | { |
| 9 | - $configPath = __DIR__.'/../config/lumen-generators.php'; |
|
| 9 | + $configPath = __DIR__ . '/../config/lumen-generators.php'; |
|
| 10 | 10 | $this->publishes([ |
| 11 | 11 | $configPath => base_path('config/lumen-generators.php'), |
| 12 | 12 | ]); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function register() |
| 16 | 16 | { |
| 17 | - $configPath = __DIR__.'/../config/lumen-generators.php'; |
|
| 17 | + $configPath = __DIR__ . '/../config/lumen-generators.php'; |
|
| 18 | 18 | $this->mergeConfigFrom($configPath, 'lumen-generators'); |
| 19 | 19 | |
| 20 | 20 | $this->registerPublishCommand(); |
@@ -32,92 +32,92 @@ discard block |
||
| 32 | 32 | // registerTestCommand |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - protected function registerPublishCommand(){ |
|
| 36 | - $this->app->singleton('command.wn.publish', function($app){ |
|
| 35 | + protected function registerPublishCommand() { |
|
| 36 | + $this->app->singleton('command.wn.publish', function($app) { |
|
| 37 | 37 | return $app['Wn\Generators\Commands\PublishCommand']; |
| 38 | 38 | }); |
| 39 | 39 | $this->commands('command.wn.publish'); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - protected function registerModelCommand(){ |
|
| 43 | - $this->app->singleton('command.wn.model', function($app){ |
|
| 42 | + protected function registerModelCommand() { |
|
| 43 | + $this->app->singleton('command.wn.model', function($app) { |
|
| 44 | 44 | return $app['Wn\Generators\Commands\ModelCommand']; |
| 45 | 45 | }); |
| 46 | 46 | $this->commands('command.wn.model'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - protected function registerControllerRestActionsCommand(){ |
|
| 50 | - $this->app->singleton('command.wn.controller.rest-actions', function($app){ |
|
| 49 | + protected function registerControllerRestActionsCommand() { |
|
| 50 | + $this->app->singleton('command.wn.controller.rest-actions', function($app) { |
|
| 51 | 51 | return $app['Wn\Generators\Commands\ControllerRestActionsCommand']; |
| 52 | 52 | }); |
| 53 | 53 | $this->commands('command.wn.controller.rest-actions'); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - protected function registerControllerCommand(){ |
|
| 57 | - $this->app->singleton('command.wn.controller', function($app){ |
|
| 56 | + protected function registerControllerCommand() { |
|
| 57 | + $this->app->singleton('command.wn.controller', function($app) { |
|
| 58 | 58 | return $app['Wn\Generators\Commands\ControllerCommand']; |
| 59 | 59 | }); |
| 60 | 60 | $this->commands('command.wn.controller'); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - protected function registerMigrationCommand(){ |
|
| 64 | - $this->app->singleton('command.wn.migration', function($app){ |
|
| 63 | + protected function registerMigrationCommand() { |
|
| 64 | + $this->app->singleton('command.wn.migration', function($app) { |
|
| 65 | 65 | return $app['Wn\Generators\Commands\MigrationCommand']; |
| 66 | 66 | }); |
| 67 | 67 | $this->commands('command.wn.migration'); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - protected function registerRouteCommand(){ |
|
| 71 | - $this->app->singleton('command.wn.route', function($app){ |
|
| 70 | + protected function registerRouteCommand() { |
|
| 71 | + $this->app->singleton('command.wn.route', function($app) { |
|
| 72 | 72 | return $app['Wn\Generators\Commands\RouteCommand']; |
| 73 | 73 | }); |
| 74 | 74 | $this->commands('command.wn.route'); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - protected function registerTestCommand(){ |
|
| 78 | - $this->app->singleton('command.wn.test', function($app){ |
|
| 77 | + protected function registerTestCommand() { |
|
| 78 | + $this->app->singleton('command.wn.test', function($app) { |
|
| 79 | 79 | return $app['Wn\Generators\Commands\TestCommand']; |
| 80 | 80 | }); |
| 81 | 81 | $this->commands('command.wn.test'); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - protected function registerResourceCommand(){ |
|
| 85 | - $this->app->singleton('command.wn.resource', function($app){ |
|
| 84 | + protected function registerResourceCommand() { |
|
| 85 | + $this->app->singleton('command.wn.resource', function($app) { |
|
| 86 | 86 | return $app['Wn\Generators\Commands\ResourceCommand']; |
| 87 | 87 | }); |
| 88 | 88 | $this->commands('command.wn.resource'); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - protected function registerResourcesCommand(){ |
|
| 92 | - $this->app->singleton('command.wn.resources', function($app){ |
|
| 91 | + protected function registerResourcesCommand() { |
|
| 92 | + $this->app->singleton('command.wn.resources', function($app) { |
|
| 93 | 93 | return $app['Wn\Generators\Commands\ResourcesCommand']; |
| 94 | 94 | }); |
| 95 | 95 | $this->commands('command.wn.resources'); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - protected function registerPivotTableCommand(){ |
|
| 99 | - $this->app->singleton('command.wn.pivot-table', function($app){ |
|
| 98 | + protected function registerPivotTableCommand() { |
|
| 99 | + $this->app->singleton('command.wn.pivot-table', function($app) { |
|
| 100 | 100 | return $app['Wn\Generators\Commands\PivotTableCommand']; |
| 101 | 101 | }); |
| 102 | 102 | $this->commands('command.wn.pivot-table'); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - protected function registerFactoryCommand(){ |
|
| 106 | - $this->app->singleton('command.wn.factory', function($app){ |
|
| 105 | + protected function registerFactoryCommand() { |
|
| 106 | + $this->app->singleton('command.wn.factory', function($app) { |
|
| 107 | 107 | return $app['Wn\Generators\Commands\FactoryCommand']; |
| 108 | 108 | }); |
| 109 | 109 | $this->commands('command.wn.factory'); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - protected function registerSeederCommand(){ |
|
| 113 | - $this->app->singleton('command.wn.seeder', function($app){ |
|
| 112 | + protected function registerSeederCommand() { |
|
| 113 | + $this->app->singleton('command.wn.seeder', function($app) { |
|
| 114 | 114 | return $app['Wn\Generators\Commands\SeederCommand']; |
| 115 | 115 | }); |
| 116 | 116 | $this->commands('command.wn.seeder'); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - protected function registerPivotSeederCommand(){ |
|
| 120 | - $this->app->singleton('command.wn.pivot.seeder', function($app){ |
|
| 119 | + protected function registerPivotSeederCommand() { |
|
| 120 | + $this->app->singleton('command.wn.pivot.seeder', function($app) { |
|
| 121 | 121 | return $app['Wn\Generators\Commands\PivotSeederCommand']; |
| 122 | 122 | }); |
| 123 | 123 | $this->commands('command.wn.pivot.seeder'); |