@@ -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 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | public function register() |
9 | 9 | { |
10 | - $configPath = __DIR__.'/../config/lumen-generators.php'; |
|
10 | + $configPath = __DIR__ . '/../config/lumen-generators.php'; |
|
11 | 11 | $this->mergeConfigFrom($configPath, 'lumen-generators'); |
12 | 12 | |
13 | 13 | $this->registerModelCommand(); |
@@ -24,85 +24,85 @@ discard block |
||
24 | 24 | // registerTestCommand |
25 | 25 | } |
26 | 26 | |
27 | - protected function registerModelCommand(){ |
|
28 | - $this->app->singleton('command.wn.model', function($app){ |
|
27 | + protected function registerModelCommand() { |
|
28 | + $this->app->singleton('command.wn.model', function($app) { |
|
29 | 29 | return $app['Wn\Generators\Commands\ModelCommand']; |
30 | 30 | }); |
31 | 31 | $this->commands('command.wn.model'); |
32 | 32 | } |
33 | 33 | |
34 | - protected function registerControllerRestActionsCommand(){ |
|
35 | - $this->app->singleton('command.wn.controller.rest-actions', function($app){ |
|
34 | + protected function registerControllerRestActionsCommand() { |
|
35 | + $this->app->singleton('command.wn.controller.rest-actions', function($app) { |
|
36 | 36 | return $app['Wn\Generators\Commands\ControllerRestActionsCommand']; |
37 | 37 | }); |
38 | 38 | $this->commands('command.wn.controller.rest-actions'); |
39 | 39 | } |
40 | 40 | |
41 | - protected function registerControllerCommand(){ |
|
42 | - $this->app->singleton('command.wn.controller', function($app){ |
|
41 | + protected function registerControllerCommand() { |
|
42 | + $this->app->singleton('command.wn.controller', function($app) { |
|
43 | 43 | return $app['Wn\Generators\Commands\ControllerCommand']; |
44 | 44 | }); |
45 | 45 | $this->commands('command.wn.controller'); |
46 | 46 | } |
47 | 47 | |
48 | - protected function registerMigrationCommand(){ |
|
49 | - $this->app->singleton('command.wn.migration', function($app){ |
|
48 | + protected function registerMigrationCommand() { |
|
49 | + $this->app->singleton('command.wn.migration', function($app) { |
|
50 | 50 | return $app['Wn\Generators\Commands\MigrationCommand']; |
51 | 51 | }); |
52 | 52 | $this->commands('command.wn.migration'); |
53 | 53 | } |
54 | 54 | |
55 | - protected function registerRouteCommand(){ |
|
56 | - $this->app->singleton('command.wn.route', function($app){ |
|
55 | + protected function registerRouteCommand() { |
|
56 | + $this->app->singleton('command.wn.route', function($app) { |
|
57 | 57 | return $app['Wn\Generators\Commands\RouteCommand']; |
58 | 58 | }); |
59 | 59 | $this->commands('command.wn.route'); |
60 | 60 | } |
61 | 61 | |
62 | - protected function registerTestCommand(){ |
|
63 | - $this->app->singleton('command.wn.test', function($app){ |
|
62 | + protected function registerTestCommand() { |
|
63 | + $this->app->singleton('command.wn.test', function($app) { |
|
64 | 64 | return $app['Wn\Generators\Commands\TestCommand']; |
65 | 65 | }); |
66 | 66 | $this->commands('command.wn.test'); |
67 | 67 | } |
68 | 68 | |
69 | - protected function registerResourceCommand(){ |
|
70 | - $this->app->singleton('command.wn.resource', function($app){ |
|
69 | + protected function registerResourceCommand() { |
|
70 | + $this->app->singleton('command.wn.resource', function($app) { |
|
71 | 71 | return $app['Wn\Generators\Commands\ResourceCommand']; |
72 | 72 | }); |
73 | 73 | $this->commands('command.wn.resource'); |
74 | 74 | } |
75 | 75 | |
76 | - protected function registerResourcesCommand(){ |
|
77 | - $this->app->singleton('command.wn.resources', function($app){ |
|
76 | + protected function registerResourcesCommand() { |
|
77 | + $this->app->singleton('command.wn.resources', function($app) { |
|
78 | 78 | return $app['Wn\Generators\Commands\ResourcesCommand']; |
79 | 79 | }); |
80 | 80 | $this->commands('command.wn.resources'); |
81 | 81 | } |
82 | 82 | |
83 | - protected function registerPivotTableCommand(){ |
|
84 | - $this->app->singleton('command.wn.pivot-table', function($app){ |
|
83 | + protected function registerPivotTableCommand() { |
|
84 | + $this->app->singleton('command.wn.pivot-table', function($app) { |
|
85 | 85 | return $app['Wn\Generators\Commands\PivotTableCommand']; |
86 | 86 | }); |
87 | 87 | $this->commands('command.wn.pivot-table'); |
88 | 88 | } |
89 | 89 | |
90 | - protected function registerFactoryCommand(){ |
|
91 | - $this->app->singleton('command.wn.factory', function($app){ |
|
90 | + protected function registerFactoryCommand() { |
|
91 | + $this->app->singleton('command.wn.factory', function($app) { |
|
92 | 92 | return $app['Wn\Generators\Commands\FactoryCommand']; |
93 | 93 | }); |
94 | 94 | $this->commands('command.wn.factory'); |
95 | 95 | } |
96 | 96 | |
97 | - protected function registerSeederCommand(){ |
|
98 | - $this->app->singleton('command.wn.seeder', function($app){ |
|
97 | + protected function registerSeederCommand() { |
|
98 | + $this->app->singleton('command.wn.seeder', function($app) { |
|
99 | 99 | return $app['Wn\Generators\Commands\SeederCommand']; |
100 | 100 | }); |
101 | 101 | $this->commands('command.wn.seeder'); |
102 | 102 | } |
103 | 103 | |
104 | - protected function registerPivotSeederCommand(){ |
|
105 | - $this->app->singleton('command.wn.pivot.seeder', function($app){ |
|
104 | + protected function registerPivotSeederCommand() { |
|
105 | + $this->app->singleton('command.wn.pivot.seeder', function($app) { |
|
106 | 106 | return $app['Wn\Generators\Commands\PivotSeederCommand']; |
107 | 107 | }); |
108 | 108 | $this->commands('command.wn.pivot.seeder'); |