@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'TABLE' => 'users' |
28 | 28 | ]; |
29 | 29 | |
30 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedDirectoryPath, $expectedStubName, $expectedStubOptions) { |
|
30 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedDirectoryPath, $expectedStubName, $expectedStubOptions) { |
|
31 | 31 | $this->assertStringContainsString($expectedDirectoryPath, $event->getFilePath()); |
32 | 32 | $this->assertEquals($expectedStubName, $event->getStubName()); |
33 | 33 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | Event::fake(); |
41 | 41 | GeneratorManager::createMigration("User", "CreateUserCollection", 'users', true); |
42 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) { |
|
42 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) { |
|
43 | 43 | $this->assertEquals("migration-mongo.stub", $event->getStubName()); |
44 | 44 | return true; |
45 | 45 | }); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | Event::fake(); |
52 | 52 | GeneratorManager::createFactory($moduleName, "User"); |
53 | 53 | |
54 | - $expectedFileName = Larapi::getModule($moduleName)->getFactories()->getPath() . '/UserFactory.php'; |
|
54 | + $expectedFileName = Larapi::getModule($moduleName)->getFactories()->getPath().'/UserFactory.php'; |
|
55 | 55 | $expectedStubName = "factory.stub"; |
56 | 56 | $expectedStubOptions = [ |
57 | 57 | 'CLASS' => 'UserFactory', |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'MODEL_NAMESPACE' => 'Modules\User\Entities\User' |
60 | 60 | ]; |
61 | 61 | |
62 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
62 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
63 | 63 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
64 | 64 | $this->assertEquals($expectedStubName, $event->getStubName()); |
65 | 65 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | Event::fake(); |
74 | 74 | GeneratorManager::createController($moduleName, "UserController"); |
75 | 75 | |
76 | - $expectedFileName = Larapi::getModule($moduleName)->getControllers()->getPath() . '/UserController.php'; |
|
76 | + $expectedFileName = Larapi::getModule($moduleName)->getControllers()->getPath().'/UserController.php'; |
|
77 | 77 | $expectedStubName = "controller.stub"; |
78 | 78 | $expectedStubOptions = [ |
79 | 79 | 'CLASS' => 'UserController', |
80 | 80 | 'NAMESPACE' => 'Modules\User\Http\Controllers' |
81 | 81 | ]; |
82 | 82 | |
83 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
83 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
84 | 84 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
85 | 85 | $this->assertEquals($expectedStubName, $event->getStubName()); |
86 | 86 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | Event::fake(); |
95 | 95 | GeneratorManager::createListener($moduleName, "SendWelcomeMail", "UserRegisteredEvent"); |
96 | 96 | |
97 | - $expectedFileName = Larapi::getModule($moduleName)->getListeners()->getPath() . '/SendWelcomeMail.php'; |
|
97 | + $expectedFileName = Larapi::getModule($moduleName)->getListeners()->getPath().'/SendWelcomeMail.php'; |
|
98 | 98 | $expectedStubName = "listener.stub"; |
99 | 99 | $expectedStubOptions = [ |
100 | 100 | 'CLASS' => 'SendWelcomeMail', |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'SHORTEVENTNAME' => 'UserRegisteredEvent', |
104 | 104 | ]; |
105 | 105 | |
106 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
106 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
107 | 107 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
108 | 108 | $this->assertEquals($expectedStubName, $event->getStubName()); |
109 | 109 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | Event::fake(); |
117 | 117 | GeneratorManager::createListener("User", "SendWelcomeMail", "UserRegisteredEvent", true); |
118 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) { |
|
118 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) { |
|
119 | 119 | $this->assertEquals("listener-queued.stub", $event->getStubName()); |
120 | 120 | return true; |
121 | 121 | }); |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | Event::fake(); |
129 | 129 | GeneratorManager::createJob($moduleName, $fileName, false); |
130 | 130 | |
131 | - $expectedFileName = Larapi::getModule($moduleName)->getJobs()->getPath() . "/$fileName.php"; |
|
131 | + $expectedFileName = Larapi::getModule($moduleName)->getJobs()->getPath()."/$fileName.php"; |
|
132 | 132 | $expectedStubName = "job-queued.stub"; |
133 | 133 | $expectedStubOptions = [ |
134 | 134 | 'NAMESPACE' => 'Modules\User\Jobs', |
135 | 135 | 'CLASS' => 'RandomUserJob' |
136 | 136 | ]; |
137 | 137 | |
138 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
138 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
139 | 139 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
140 | 140 | $this->assertEquals($expectedStubName, $event->getStubName()); |
141 | 141 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | Event::fake(); |
149 | 149 | GeneratorManager::createJob("User", "AJob", true); |
150 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) { |
|
150 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) { |
|
151 | 151 | $this->assertEquals("job.stub", $event->getStubName()); |
152 | 152 | return true; |
153 | 153 | }); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | Event::fake(); |
163 | 163 | GeneratorManager::createCommand($moduleName, $fileName, $commandName); |
164 | 164 | |
165 | - $expectedFileName = Larapi::getModule($moduleName)->getCommands()->getPath() . "/$fileName.php"; |
|
165 | + $expectedFileName = Larapi::getModule($moduleName)->getCommands()->getPath()."/$fileName.php"; |
|
166 | 166 | $expectedStubName = "command.stub"; |
167 | 167 | $expectedStubOptions = [ |
168 | 168 | 'NAMESPACE' => 'Modules\User\Console', |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | 'COMMAND_NAME' => $commandName |
171 | 171 | ]; |
172 | 172 | |
173 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
173 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
174 | 174 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
175 | 175 | $this->assertEquals($expectedStubName, $event->getStubName()); |
176 | 176 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | Event::fake(); |
187 | 187 | GeneratorManager::createMiddleware($moduleName, $fileName); |
188 | 188 | |
189 | - $expectedFileName = Larapi::getModule($moduleName)->getMiddleWare()->getPath() . "/$fileName.php"; |
|
189 | + $expectedFileName = Larapi::getModule($moduleName)->getMiddleWare()->getPath()."/$fileName.php"; |
|
190 | 190 | $expectedStubName = "middleware.stub"; |
191 | 191 | $expectedStubOptions = [ |
192 | 192 | 'CLASS' => 'RandomMiddleware', |
193 | 193 | 'NAMESPACE' => 'Modules\User\Http\Middleware' |
194 | 194 | ]; |
195 | 195 | |
196 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
196 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
197 | 197 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
198 | 198 | $this->assertEquals($expectedStubName, $event->getStubName()); |
199 | 199 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | Event::fake(); |
210 | 210 | GeneratorManager::createServiceProvider($moduleName, $fileName); |
211 | 211 | |
212 | - $expectedFileName = Larapi::getModule($moduleName)->getServiceProviders()->getPath() . "/$fileName.php"; |
|
212 | + $expectedFileName = Larapi::getModule($moduleName)->getServiceProviders()->getPath()."/$fileName.php"; |
|
213 | 213 | $expectedStubName = "provider.stub"; |
214 | 214 | $expectedStubOptions = [ |
215 | 215 | 'NAMESPACE' => 'Modules\User\Providers', |
216 | 216 | 'CLASS' => 'RandomServiceProvider' |
217 | 217 | ]; |
218 | 218 | |
219 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
219 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
220 | 220 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
221 | 221 | $this->assertEquals($expectedStubName, $event->getStubName()); |
222 | 222 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | Event::fake(); |
233 | 233 | GeneratorManager::createNotification($moduleName, $fileName); |
234 | 234 | |
235 | - $expectedFileName = Larapi::getModule($moduleName)->getNotifications()->getPath() . "/$fileName.php"; |
|
235 | + $expectedFileName = Larapi::getModule($moduleName)->getNotifications()->getPath()."/$fileName.php"; |
|
236 | 236 | $expectedStubName = "notification.stub"; |
237 | 237 | $expectedStubOptions = [ |
238 | 238 | 'NAMESPACE' => 'Modules\User\Notifications', |
239 | 239 | 'CLASS' => 'RandomNotification' |
240 | 240 | ]; |
241 | 241 | |
242 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
242 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
243 | 243 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
244 | 244 | $this->assertEquals($expectedStubName, $event->getStubName()); |
245 | 245 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | protected function getArguments() |
64 | 64 | { |
65 | 65 | return [ |
66 | - ['model', InputArgument::REQUIRED, 'The name of model will be created.'], |
|
67 | - ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
66 | + [ 'model', InputArgument::REQUIRED, 'The name of model will be created.' ], |
|
67 | + [ 'module', InputArgument::OPTIONAL, 'The name of module will be used.' ], |
|
68 | 68 | ]; |
69 | 69 | } |
70 | 70 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | protected function getOptions() |
77 | 77 | { |
78 | 78 | return [ |
79 | - ['fillable', null, InputOption::VALUE_IS_ARRAY, 'The fillable attributes.', null], |
|
80 | - ['migration', 'm', InputOption::VALUE_NONE, 'Flag to create associated migrations', null], |
|
79 | + [ 'fillable', null, InputOption::VALUE_IS_ARRAY, 'The fillable attributes.', null ], |
|
80 | + [ 'migration', 'm', InputOption::VALUE_NONE, 'Flag to create associated migrations', null ], |
|
81 | 81 | ]; |
82 | 82 | } |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | if ($this->option('migration') === true) { |
90 | 90 | $migrationName = 'create_'.$this->createMigrationName().'_table'; |
91 | - $this->call('module:make-migration', ['name' => $migrationName, 'module' => $this->argument('module')]); |
|
91 | + $this->call('module:make-migration', [ 'name' => $migrationName, 'module' => $this->argument('module') ]); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function getTemplateContents() |
99 | 99 | { |
100 | - $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
100 | + $module = $this->laravel[ 'modules' ]->findOrFail($this->getModuleName()); |
|
101 | 101 | |
102 | 102 | return (new Stub('/model.stub', [ |
103 | 103 | 'NAME' => $this->getModelName(), |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'LOWER_NAME' => $module->getLowerName(), |
108 | 108 | 'MODULE' => $this->getModuleName(), |
109 | 109 | 'STUDLY_NAME' => $module->getStudlyName(), |
110 | - 'MODULE_NAMESPACE' => $this->laravel['modules']->config('namespace'), |
|
110 | + 'MODULE_NAMESPACE' => $this->laravel[ 'modules' ]->config('namespace'), |
|
111 | 111 | ]))->render(); |
112 | 112 | } |
113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function getDestinationFilePath() |
118 | 118 | { |
119 | - $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
119 | + $path = $this->laravel[ 'modules' ]->getModulePath($this->getModuleName()); |
|
120 | 120 | |
121 | 121 | $modelPath = GenerateConfigReader::read('model'); |
122 | 122 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | { |
139 | 139 | $fillable = $this->option('fillable'); |
140 | 140 | |
141 | - if (! is_null($fillable)) { |
|
141 | + if (!is_null($fillable)) { |
|
142 | 142 | $arrays = explode(',', $fillable); |
143 | 143 | |
144 | 144 | return json_encode($arrays); |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getDefaultNamespace() : string |
156 | 156 | { |
157 | - return $this->laravel['modules']->config('paths.generator.model.path', 'Entities'); |
|
157 | + return $this->laravel[ 'modules' ]->config('paths.generator.model.path', 'Entities'); |
|
158 | 158 | } |
159 | 159 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | */ |
59 | 59 | protected function getOptions() |
60 | 60 | { |
61 | - return []; |
|
61 | + return [ ]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } |
@@ -51,16 +51,16 @@ |
||
51 | 51 | protected function getOptions() |
52 | 52 | { |
53 | 53 | return [ |
54 | - ['sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous.'], |
|
54 | + [ 'sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous.' ], |
|
55 | 55 | ]; |
56 | 56 | } |
57 | 57 | |
58 | 58 | protected function isJobSynchronous(): bool |
59 | 59 | { |
60 | - return once(function () { |
|
60 | + return once(function() { |
|
61 | 61 | $option = $this->option('sync'); |
62 | 62 | if ($option !== null) |
63 | - $option = (bool)$option; |
|
63 | + $option = (bool) $option; |
|
64 | 64 | |
65 | 65 | return $option === null ? $this->confirm('Should the job run Synchronously?', false) : $option; |
66 | 66 | }); |
@@ -59,8 +59,9 @@ |
||
59 | 59 | { |
60 | 60 | return once(function () { |
61 | 61 | $option = $this->option('sync'); |
62 | - if ($option !== null) |
|
63 | - $option = (bool)$option; |
|
62 | + if ($option !== null) { |
|
63 | + $option = (bool)$option; |
|
64 | + } |
|
64 | 65 | |
65 | 66 | return $option === null ? $this->confirm('Should the job run Synchronously?', false) : $option; |
66 | 67 | }); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function getTableName(): string |
51 | 51 | { |
52 | - return once(function () { |
|
52 | + return once(function() { |
|
53 | 53 | return $this->option('table') ?? $this->ask('What is the name of the table/collection?', strtolower(Str::plural($this->getModuleName()))); |
54 | 54 | }); |
55 | 55 | } |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | protected function getOptions() |
63 | 63 | { |
64 | 64 | return [ |
65 | - ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null], |
|
66 | - ['table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null], |
|
65 | + [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null ], |
|
66 | + [ 'table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null ], |
|
67 | 67 | ]; |
68 | 68 | } |
69 | 69 | |
70 | 70 | protected function isMongoMigration(): bool |
71 | 71 | { |
72 | - return once(function () { |
|
72 | + return once(function() { |
|
73 | 73 | $option = $this->option('mongo'); |
74 | 74 | if ($option !== null) |
75 | - $option = (bool)$option; |
|
75 | + $option = (bool) $option; |
|
76 | 76 | |
77 | 77 | return $option === null ? $this->confirm('Is this migration for a mongodb database?', false) : $option; |
78 | 78 | }); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | protected function getDestinationFilePath() |
97 | 97 | { |
98 | - return $this->getModule()->getPath() . $this->filePath . '/' . $this->getDestinationFileName() . '.php'; |
|
98 | + return $this->getModule()->getPath().$this->filePath.'/'.$this->getDestinationFileName().'.php'; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | private function getDestinationFileName() |
105 | 105 | { |
106 | - return date('Y_m_d_His_') . $this->getSchemaName(); |
|
106 | + return date('Y_m_d_His_').$this->getSchemaName(); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $schemaName = ""; |
115 | 115 | $splittedInCapsName = $pieces = preg_split('/(?=[A-Z])/', $this->getClassName()); |
116 | 116 | foreach ($splittedInCapsName as $word) { |
117 | - $schemaName = $schemaName . $word . '_'; |
|
117 | + $schemaName = $schemaName.$word.'_'; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return strtolower(rtrim($schemaName, '_')); |
@@ -71,8 +71,9 @@ |
||
71 | 71 | { |
72 | 72 | return once(function () { |
73 | 73 | $option = $this->option('mongo'); |
74 | - if ($option !== null) |
|
75 | - $option = (bool)$option; |
|
74 | + if ($option !== null) { |
|
75 | + $option = (bool)$option; |
|
76 | + } |
|
76 | 77 | |
77 | 78 | return $option === null ? $this->confirm('Is this migration for a mongodb database?', false) : $option; |
78 | 79 | }); |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | return [ |
42 | 42 | 'NAMESPACE' => $this->getClassNamespace(), |
43 | 43 | 'CLASS' => $this->getClassName(), |
44 | - 'EVENTNAME' => $this->getModule()->getNamespace() . '\\' . 'Events' . '\\' . $this->getEventName(), |
|
44 | + 'EVENTNAME' => $this->getModule()->getNamespace().'\\'.'Events'.'\\'.$this->getEventName(), |
|
45 | 45 | 'SHORTEVENTNAME' => $this->getEventName(), |
46 | 46 | ]; |
47 | 47 | } |
48 | 48 | |
49 | 49 | protected function getEventName(): string |
50 | 50 | { |
51 | - return once(function () { |
|
51 | + return once(function() { |
|
52 | 52 | $eventName = $this->option('event') ?? $this->ask('What is the name of the event that should be listened on?', false) ?? 'null'; |
53 | 53 | if ($eventName === null) { |
54 | 54 | throw new Exception('Eventname for listener not given'); |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | |
61 | 61 | protected function listenerNeedsQueueing(): bool |
62 | 62 | { |
63 | - return once(function () { |
|
63 | + return once(function() { |
|
64 | 64 | $option = $this->option('queued'); |
65 | 65 | if ($option !== null) |
66 | - $option = (bool)$option; |
|
66 | + $option = (bool) $option; |
|
67 | 67 | |
68 | 68 | return $option === null ? $this->confirm('Should the listener be queued?', false) : $option; |
69 | 69 | }); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | protected function afterGeneration(): void |
73 | 73 | { |
74 | - $this->info("don't forget to add the listener to " . $this->getEventName()); |
|
74 | + $this->info("don't forget to add the listener to ".$this->getEventName()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | protected function getOptions() |
95 | 95 | { |
96 | 96 | return [ |
97 | - ['event', 'e', InputOption::VALUE_OPTIONAL, 'The event class being listened for.'], |
|
98 | - ['queued', null, InputOption::VALUE_OPTIONAL, 'Indicates the event listener should be queued.'], |
|
97 | + [ 'event', 'e', InputOption::VALUE_OPTIONAL, 'The event class being listened for.' ], |
|
98 | + [ 'queued', null, InputOption::VALUE_OPTIONAL, 'Indicates the event listener should be queued.' ], |
|
99 | 99 | ]; |
100 | 100 | } |
101 | 101 | } |
@@ -62,8 +62,9 @@ |
||
62 | 62 | { |
63 | 63 | return once(function () { |
64 | 64 | $option = $this->option('queued'); |
65 | - if ($option !== null) |
|
66 | - $option = (bool)$option; |
|
65 | + if ($option !== null) { |
|
66 | + $option = (bool)$option; |
|
67 | + } |
|
67 | 68 | |
68 | 69 | return $option === null ? $this->confirm('Should the listener be queued?', false) : $option; |
69 | 70 | }); |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function getDestinationFilePath() |
46 | 46 | { |
47 | - return $this->getModule()->getPath() . $this->filePath . '/' . $this->getFileName(); |
|
47 | + return $this->getModule()->getPath().$this->filePath.'/'.$this->getFileName(); |
|
48 | 48 | } |
49 | 49 | |
50 | - protected function getTemplateContents(){ |
|
50 | + protected function getTemplateContents() { |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | $this->beforeGeneration(); |
57 | 57 | $path = str_replace('\\', '/', $this->getDestinationFilePath()); |
58 | 58 | |
59 | - if (!$this->laravel['files']->isDirectory($dir = dirname($path))) { |
|
60 | - $this->laravel['files']->makeDirectory($dir, 0777, true); |
|
59 | + if (!$this->laravel[ 'files' ]->isDirectory($dir = dirname($path))) { |
|
60 | + $this->laravel[ 'files' ]->makeDirectory($dir, 0777, true); |
|
61 | 61 | } |
62 | 62 | |
63 | - if(file_exists($path)){ |
|
63 | + if (file_exists($path)) { |
|
64 | 64 | $this->error("File : {$path} already exists."); |
65 | 65 | } |
66 | 66 | |
@@ -76,26 +76,26 @@ discard block |
||
76 | 76 | */ |
77 | 77 | protected function getFileName() |
78 | 78 | { |
79 | - return $this->getClassName() . '.php'; |
|
79 | + return $this->getClassName().'.php'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | protected function getModule(): Module |
83 | 83 | { |
84 | - return once(function () { |
|
84 | + return once(function() { |
|
85 | 85 | return Larapi::getModule($this->getModuleName()); |
86 | 86 | }); |
87 | 87 | } |
88 | 88 | |
89 | 89 | protected function getModuleName(): string |
90 | 90 | { |
91 | - return once(function () { |
|
91 | + return once(function() { |
|
92 | 92 | return Str::studly($this->askModuleName()); |
93 | 93 | }); |
94 | 94 | } |
95 | 95 | |
96 | 96 | private function askModuleName(): string |
97 | 97 | { |
98 | - $moduleName = $this->argument('module') ?? $this->ask('For what module would you like to generate a ' . $this->getGeneratorName() . '.'); |
|
98 | + $moduleName = $this->argument('module') ?? $this->ask('For what module would you like to generate a '.$this->getGeneratorName().'.'); |
|
99 | 99 | |
100 | 100 | if ($moduleName === null) { |
101 | 101 | throw new \Exception('Name of module not set.'); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getClassNamespace($module = null): string |
114 | 114 | { |
115 | - return $this->getModule()->getNamespace() . str_replace('/', '\\', $this->filePath); |
|
115 | + return $this->getModule()->getNamespace().str_replace('/', '\\', $this->filePath); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -129,17 +129,17 @@ discard block |
||
129 | 129 | |
130 | 130 | protected function getClassName(): string |
131 | 131 | { |
132 | - return once(function () { |
|
132 | + return once(function() { |
|
133 | 133 | return Str::studly($this->askClassName()); |
134 | 134 | }); |
135 | 135 | } |
136 | 136 | |
137 | 137 | private function askClassName(): string |
138 | 138 | { |
139 | - $className = $this->argument('name') ?? $this->ask('Specify the name of the ' . $this->getGeneratorName() . '.'); |
|
139 | + $className = $this->argument('name') ?? $this->ask('Specify the name of the '.$this->getGeneratorName().'.'); |
|
140 | 140 | |
141 | 141 | if ($className === null) { |
142 | - throw new \Exception('Name of ' . $this->getGeneratorName() . ' not set.'); |
|
142 | + throw new \Exception('Name of '.$this->getGeneratorName().' not set.'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | return $className; |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | protected function getArguments() |
154 | 154 | { |
155 | 155 | return [ |
156 | - ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
157 | - ['name', InputArgument::OPTIONAL, 'The name of the ' . $this->getGeneratorName() . '.'], |
|
156 | + [ 'module', InputArgument::OPTIONAL, 'The name of module will be used.' ], |
|
157 | + [ 'name', InputArgument::OPTIONAL, 'The name of the '.$this->getGeneratorName().'.' ], |
|
158 | 158 | ]; |
159 | 159 | } |
160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | protected function getOptions() |
167 | 167 | { |
168 | - return []; |
|
168 | + return [ ]; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | protected function getGeneratorName(): string |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use Faker\Generator as Faker; |
4 | 4 | use Modules\Proxy\Entities\Proxy; |
5 | 5 | |
6 | -$factory->define(Proxy::class, function (Faker $faker) { |
|
6 | +$factory->define(Proxy::class, function(Faker $faker) { |
|
7 | 7 | return [ |
8 | 8 | 'alias' => $faker->userName.' proxy', |
9 | 9 | 'user_id' => null, |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | 'username' => $faker->unique()->userName, |
13 | 13 | 'password' => $faker->password, |
14 | 14 | 'online' => $faker->boolean(85), |
15 | - 'uptime' => $faker->numberBetween(0,100), |
|
16 | - 'type' => get_random_array_element(['SOCKS5', 'SOCKS4', 'HTTP', 'HTTPS']), |
|
15 | + 'uptime' => $faker->numberBetween(0, 100), |
|
16 | + 'type' => get_random_array_element([ 'SOCKS5', 'SOCKS4', 'HTTP', 'HTTPS' ]), |
|
17 | 17 | 'monitor' => $faker->boolean, |
18 | - 'anonimity_level' => get_random_array_element(['ELITE', 'ANONYMOUS', 'TRANSPARANT']), |
|
18 | + 'anonimity_level' => get_random_array_element([ 'ELITE', 'ANONYMOUS', 'TRANSPARANT' ]), |
|
19 | 19 | 'last_alive_at' => \Carbon\Carbon::now()->subMinutes($faker->numberBetween(0, 24 * 60)), |
20 | 20 | 'last_checked_at' => \Carbon\Carbon::now()->subMinutes($faker->numberBetween(0, 24 * 60)), |
21 | 21 | ]; |