@@ -135,7 +135,7 @@ |
||
135 | 135 | $process->setTimeout($this->timeout); |
136 | 136 | |
137 | 137 | if ($this->console instanceof Command) { |
138 | - $process->run(function ($type, $line) { |
|
138 | + $process->run(function($type, $line) { |
|
139 | 139 | $this->console->line($line); |
140 | 140 | }); |
141 | 141 | } |
@@ -122,7 +122,7 @@ |
||
122 | 122 | return json_decode($this->getContents(), 1); |
123 | 123 | } |
124 | 124 | |
125 | - return app('cache')->remember($this->getPath(), config('modules.cache.lifetime'), function () { |
|
125 | + return app('cache')->remember($this->getPath(), config('modules.cache.lifetime'), function() { |
|
126 | 126 | return json_decode($this->getContents(), 1); |
127 | 127 | }); |
128 | 128 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * @return mixed |
|
60 | + * @return string |
|
61 | 61 | */ |
62 | 62 | protected function getTemplateContents() |
63 | 63 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | - * @return mixed |
|
73 | + * @return string |
|
74 | 74 | */ |
75 | 75 | protected function getDestinationFilePath() |
76 | 76 | { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * @return mixed |
|
60 | + * @return string |
|
61 | 61 | */ |
62 | 62 | protected function getTemplateContents() |
63 | 63 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | - * @return mixed |
|
73 | + * @return string |
|
74 | 74 | */ |
75 | 75 | protected function getDestinationFilePath() |
76 | 76 | { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * @return mixed |
|
60 | + * @return string |
|
61 | 61 | */ |
62 | 62 | protected function getTemplateContents() |
63 | 63 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | - * @return mixed |
|
73 | + * @return string |
|
74 | 74 | */ |
75 | 75 | protected function getDestinationFilePath() |
76 | 76 | { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getCached() |
177 | 177 | { |
178 | - return $this->app['cache']->remember($this->config('cache.key'), $this->config('cache.lifetime'), function () { |
|
178 | + return $this->app['cache']->remember($this->config('cache.key'), $this->config('cache.lifetime'), function() { |
|
179 | 179 | return $this->toCollection()->toArray(); |
180 | 180 | }); |
181 | 181 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | { |
264 | 264 | $modules = $this->enabled(); |
265 | 265 | |
266 | - uasort($modules, function (Module $a, Module $b) use ($direction) { |
|
266 | + uasort($modules, function(Module $a, Module $b) use ($direction) { |
|
267 | 267 | if ($a->order == $b->order) { |
268 | 268 | return 0; |
269 | 269 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * Get scanned modules paths. |
91 | 91 | * |
92 | - * @return array |
|
92 | + * @return string[] |
|
93 | 93 | */ |
94 | 94 | public function getScanPaths() |
95 | 95 | { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | /** |
368 | 368 | * Get module path for a specific module. |
369 | 369 | * |
370 | - * @param $module |
|
370 | + * @param string $module |
|
371 | 371 | * |
372 | 372 | * @return string |
373 | 373 | */ |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | /** |
396 | 396 | * Get a specific config data from a configuration file. |
397 | 397 | * |
398 | - * @param $key |
|
398 | + * @param string $key |
|
399 | 399 | * |
400 | 400 | * @return mixed |
401 | 401 | */ |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | /** |
436 | 436 | * Get module used for cli session. |
437 | 437 | * |
438 | - * @return string |
|
438 | + * @return Module |
|
439 | 439 | */ |
440 | 440 | public function getUsedNow() |
441 | 441 | { |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | /** |
446 | 446 | * Get used now. |
447 | 447 | * |
448 | - * @return string |
|
448 | + * @return Module |
|
449 | 449 | */ |
450 | 450 | public function getUsed() |
451 | 451 | { |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | * |
520 | 520 | * @param string $name |
521 | 521 | * |
522 | - * @return bool |
|
522 | + * @return boolean|null |
|
523 | 523 | */ |
524 | 524 | public function enable($name) |
525 | 525 | { |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | * |
532 | 532 | * @param string $name |
533 | 533 | * |
534 | - * @return bool |
|
534 | + * @return boolean|null |
|
535 | 535 | */ |
536 | 536 | public function disable($name) |
537 | 537 | { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * @return mixed |
|
60 | + * @return string |
|
61 | 61 | */ |
62 | 62 | protected function getTemplateContents() |
63 | 63 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | - * @return mixed |
|
73 | + * @return string |
|
74 | 74 | */ |
75 | 75 | protected function getDestinationFilePath() |
76 | 76 | { |
@@ -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 | } |