@@ -10,88 +10,88 @@ |
||
10 | 10 | |
11 | 11 | class GenerateEventCommand extends GeneratorCommand |
12 | 12 | { |
13 | - use ModuleCommandTrait; |
|
13 | + use ModuleCommandTrait; |
|
14 | 14 | |
15 | - protected $argumentName = 'name'; |
|
15 | + protected $argumentName = 'name'; |
|
16 | 16 | |
17 | - /** |
|
18 | - * The console command name. |
|
19 | - * |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - protected $name = 'module:make-event'; |
|
23 | - |
|
24 | - /** |
|
25 | - * The console command description. |
|
26 | - * |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - protected $description = 'Generate a new Event Class for the specified module'; |
|
30 | - |
|
31 | - /** |
|
32 | - * Create a new command instance. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function __construct() |
|
37 | - { |
|
38 | - parent::__construct(); |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * Get the console command arguments. |
|
43 | - * |
|
44 | - * @return array |
|
45 | - */ |
|
46 | - protected function getArguments() |
|
47 | - { |
|
48 | - return [ |
|
49 | - ['name', InputArgument::REQUIRED, 'The name of the command.'], |
|
50 | - ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
51 | - ]; |
|
52 | - |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Get the console command options. |
|
57 | - * |
|
58 | - * @return array |
|
59 | - */ |
|
60 | - protected function getOptions() |
|
61 | - { |
|
62 | - return [ |
|
63 | - ['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null], |
|
64 | - ]; |
|
65 | - } |
|
66 | - |
|
67 | - public function getTemplateContents() |
|
68 | - { |
|
69 | - $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
70 | - |
|
71 | - return (new Stub('/event.stub', [ |
|
72 | - 'NAMESPACE' => $this->getClassNamespace($module) . "\\" . config("modules.paths.generator.event"), |
|
73 | - "CLASS" => $this->getClass(), |
|
74 | - 'DUMMYNAMESPACE' => $this->laravel->getNamespace() . "Events" |
|
75 | - ]))->render(); |
|
76 | - } |
|
77 | - |
|
78 | - public function getDestinationFilePath() |
|
79 | - { |
|
80 | - $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
81 | - |
|
82 | - $seederPath = $this->laravel['modules']->config('paths.generator.event'); |
|
83 | - |
|
84 | - return $path . $seederPath . '/' . $this->getFileName() . '.php'; |
|
85 | - |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * @return string |
|
90 | - */ |
|
91 | - protected function getFileName() |
|
92 | - { |
|
93 | - return studly_case($this->argument('name')); |
|
94 | - } |
|
17 | + /** |
|
18 | + * The console command name. |
|
19 | + * |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + protected $name = 'module:make-event'; |
|
23 | + |
|
24 | + /** |
|
25 | + * The console command description. |
|
26 | + * |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + protected $description = 'Generate a new Event Class for the specified module'; |
|
30 | + |
|
31 | + /** |
|
32 | + * Create a new command instance. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function __construct() |
|
37 | + { |
|
38 | + parent::__construct(); |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * Get the console command arguments. |
|
43 | + * |
|
44 | + * @return array |
|
45 | + */ |
|
46 | + protected function getArguments() |
|
47 | + { |
|
48 | + return [ |
|
49 | + ['name', InputArgument::REQUIRED, 'The name of the command.'], |
|
50 | + ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
51 | + ]; |
|
52 | + |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Get the console command options. |
|
57 | + * |
|
58 | + * @return array |
|
59 | + */ |
|
60 | + protected function getOptions() |
|
61 | + { |
|
62 | + return [ |
|
63 | + ['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null], |
|
64 | + ]; |
|
65 | + } |
|
66 | + |
|
67 | + public function getTemplateContents() |
|
68 | + { |
|
69 | + $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
70 | + |
|
71 | + return (new Stub('/event.stub', [ |
|
72 | + 'NAMESPACE' => $this->getClassNamespace($module) . "\\" . config("modules.paths.generator.event"), |
|
73 | + "CLASS" => $this->getClass(), |
|
74 | + 'DUMMYNAMESPACE' => $this->laravel->getNamespace() . "Events" |
|
75 | + ]))->render(); |
|
76 | + } |
|
77 | + |
|
78 | + public function getDestinationFilePath() |
|
79 | + { |
|
80 | + $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
81 | + |
|
82 | + $seederPath = $this->laravel['modules']->config('paths.generator.event'); |
|
83 | + |
|
84 | + return $path . $seederPath . '/' . $this->getFileName() . '.php'; |
|
85 | + |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * @return string |
|
90 | + */ |
|
91 | + protected function getFileName() |
|
92 | + { |
|
93 | + return studly_case($this->argument('name')); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | 97 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
70 | 70 | |
71 | 71 | return (new Stub('/event.stub', [ |
72 | - 'NAMESPACE' => $this->getClassNamespace($module) . "\\" . config("modules.paths.generator.event"), |
|
72 | + 'NAMESPACE' => $this->getClassNamespace($module)."\\".config("modules.paths.generator.event"), |
|
73 | 73 | "CLASS" => $this->getClass(), |
74 | - 'DUMMYNAMESPACE' => $this->laravel->getNamespace() . "Events" |
|
74 | + 'DUMMYNAMESPACE' => $this->laravel->getNamespace()."Events" |
|
75 | 75 | ]))->render(); |
76 | 76 | } |
77 | 77 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | $seederPath = $this->laravel['modules']->config('paths.generator.event'); |
83 | 83 | |
84 | - return $path . $seederPath . '/' . $this->getFileName() . '.php'; |
|
84 | + return $path.$seederPath.'/'.$this->getFileName().'.php'; |
|
85 | 85 | |
86 | 86 | } |
87 | 87 |
@@ -11,102 +11,102 @@ |
||
11 | 11 | |
12 | 12 | class GenerateListenerCommand extends GeneratorCommand |
13 | 13 | { |
14 | - use ModuleCommandTrait; |
|
15 | - |
|
16 | - protected $argumentName = 'name'; |
|
17 | - |
|
18 | - /** |
|
19 | - * The console command name. |
|
20 | - * |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - protected $name = 'module:make-listener'; |
|
24 | - |
|
25 | - /** |
|
26 | - * The console command description. |
|
27 | - * |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - protected $description = 'Generate a new Listener Class for the specified module'; |
|
31 | - |
|
32 | - /** |
|
33 | - * Create a new command instance. |
|
34 | - * |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - public function __construct() |
|
38 | - { |
|
39 | - parent::__construct(); |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * Get the console command arguments. |
|
44 | - * |
|
45 | - * @return array |
|
46 | - */ |
|
47 | - protected function getArguments() |
|
48 | - { |
|
49 | - return [ |
|
50 | - ['name', InputArgument::REQUIRED, 'The name of the command.'], |
|
51 | - ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
52 | - ]; |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Get the console command options. |
|
57 | - * |
|
58 | - * @return array |
|
59 | - */ |
|
60 | - protected function getOptions() |
|
61 | - { |
|
62 | - return [ |
|
63 | - ['event', null, InputOption::VALUE_REQUIRED, 'An example option.', null], |
|
64 | - ]; |
|
65 | - } |
|
66 | - |
|
67 | - protected function getTemplateContents() |
|
68 | - { |
|
69 | - $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
70 | - |
|
71 | - return (new Stub('/listener.stub', [ |
|
72 | - 'NAMESPACE' => $this->getClassNamespace($module) . "\\" . config("modules.paths.generator.listener"), |
|
73 | - "EVENTNAME" => $this->getEventName($module), |
|
74 | - "EVENTSHORTENEDNAME" => $this->option('event'), |
|
75 | - "CLASS" => $this->getClass(), |
|
76 | - 'DUMMYNAMESPACE' => $this->laravel->getNamespace() . "Events" |
|
77 | - ]))->render(); |
|
78 | - |
|
79 | - } |
|
80 | - |
|
81 | - protected function getDestinationFilePath() |
|
82 | - { |
|
83 | - $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
84 | - |
|
85 | - $seederPath = $this->laravel['modules']->config('paths.generator.listener'); |
|
86 | - |
|
87 | - return $path . $seederPath . '/' . $this->getFileName() . '.php'; |
|
88 | - |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - protected function getFileName() |
|
95 | - { |
|
96 | - return studly_case($this->argument('name')); |
|
97 | - } |
|
98 | - |
|
99 | - public function fire() |
|
100 | - { |
|
101 | - if (!$this->option('event')) { |
|
102 | - return $this->error("The --event option is neccessary"); |
|
103 | - } |
|
104 | - |
|
105 | - parent::fire(); |
|
106 | - } |
|
107 | - |
|
108 | - protected function getEventName(Module $module) |
|
109 | - { |
|
110 | - return $this->getClassNamespace($module) . "\\" . config("modules.paths.generator.event") . "\\" . $this->option('event'); |
|
111 | - } |
|
14 | + use ModuleCommandTrait; |
|
15 | + |
|
16 | + protected $argumentName = 'name'; |
|
17 | + |
|
18 | + /** |
|
19 | + * The console command name. |
|
20 | + * |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + protected $name = 'module:make-listener'; |
|
24 | + |
|
25 | + /** |
|
26 | + * The console command description. |
|
27 | + * |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + protected $description = 'Generate a new Listener Class for the specified module'; |
|
31 | + |
|
32 | + /** |
|
33 | + * Create a new command instance. |
|
34 | + * |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + public function __construct() |
|
38 | + { |
|
39 | + parent::__construct(); |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * Get the console command arguments. |
|
44 | + * |
|
45 | + * @return array |
|
46 | + */ |
|
47 | + protected function getArguments() |
|
48 | + { |
|
49 | + return [ |
|
50 | + ['name', InputArgument::REQUIRED, 'The name of the command.'], |
|
51 | + ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
52 | + ]; |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Get the console command options. |
|
57 | + * |
|
58 | + * @return array |
|
59 | + */ |
|
60 | + protected function getOptions() |
|
61 | + { |
|
62 | + return [ |
|
63 | + ['event', null, InputOption::VALUE_REQUIRED, 'An example option.', null], |
|
64 | + ]; |
|
65 | + } |
|
66 | + |
|
67 | + protected function getTemplateContents() |
|
68 | + { |
|
69 | + $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
70 | + |
|
71 | + return (new Stub('/listener.stub', [ |
|
72 | + 'NAMESPACE' => $this->getClassNamespace($module) . "\\" . config("modules.paths.generator.listener"), |
|
73 | + "EVENTNAME" => $this->getEventName($module), |
|
74 | + "EVENTSHORTENEDNAME" => $this->option('event'), |
|
75 | + "CLASS" => $this->getClass(), |
|
76 | + 'DUMMYNAMESPACE' => $this->laravel->getNamespace() . "Events" |
|
77 | + ]))->render(); |
|
78 | + |
|
79 | + } |
|
80 | + |
|
81 | + protected function getDestinationFilePath() |
|
82 | + { |
|
83 | + $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
84 | + |
|
85 | + $seederPath = $this->laravel['modules']->config('paths.generator.listener'); |
|
86 | + |
|
87 | + return $path . $seederPath . '/' . $this->getFileName() . '.php'; |
|
88 | + |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + protected function getFileName() |
|
95 | + { |
|
96 | + return studly_case($this->argument('name')); |
|
97 | + } |
|
98 | + |
|
99 | + public function fire() |
|
100 | + { |
|
101 | + if (!$this->option('event')) { |
|
102 | + return $this->error("The --event option is neccessary"); |
|
103 | + } |
|
104 | + |
|
105 | + parent::fire(); |
|
106 | + } |
|
107 | + |
|
108 | + protected function getEventName(Module $module) |
|
109 | + { |
|
110 | + return $this->getClassNamespace($module) . "\\" . config("modules.paths.generator.event") . "\\" . $this->option('event'); |
|
111 | + } |
|
112 | 112 | } |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
70 | 70 | |
71 | 71 | return (new Stub('/listener.stub', [ |
72 | - 'NAMESPACE' => $this->getClassNamespace($module) . "\\" . config("modules.paths.generator.listener"), |
|
72 | + 'NAMESPACE' => $this->getClassNamespace($module)."\\".config("modules.paths.generator.listener"), |
|
73 | 73 | "EVENTNAME" => $this->getEventName($module), |
74 | 74 | "EVENTSHORTENEDNAME" => $this->option('event'), |
75 | 75 | "CLASS" => $this->getClass(), |
76 | - 'DUMMYNAMESPACE' => $this->laravel->getNamespace() . "Events" |
|
76 | + 'DUMMYNAMESPACE' => $this->laravel->getNamespace()."Events" |
|
77 | 77 | ]))->render(); |
78 | 78 | |
79 | 79 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | $seederPath = $this->laravel['modules']->config('paths.generator.listener'); |
86 | 86 | |
87 | - return $path . $seederPath . '/' . $this->getFileName() . '.php'; |
|
87 | + return $path.$seederPath.'/'.$this->getFileName().'.php'; |
|
88 | 88 | |
89 | 89 | } |
90 | 90 | |
@@ -107,6 +107,6 @@ discard block |
||
107 | 107 | |
108 | 108 | protected function getEventName(Module $module) |
109 | 109 | { |
110 | - return $this->getClassNamespace($module) . "\\" . config("modules.paths.generator.event") . "\\" . $this->option('event'); |
|
110 | + return $this->getClassNamespace($module)."\\".config("modules.paths.generator.event")."\\".$this->option('event'); |
|
111 | 111 | } |
112 | 112 | } |