@@ -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 | ]; |