@@ -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 | }); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | protected function getTableName(): string |
| 60 | 60 | { |
| 61 | - return once(function () { |
|
| 61 | + return once(function() { |
|
| 62 | 62 | return $this->option('table') ?? $this->ask('What is the name of the table/collection?', strtolower(Str::plural($this->getModuleName()))); |
| 63 | 63 | }); |
| 64 | 64 | } |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | protected function setOptions() :array |
| 72 | 72 | { |
| 73 | 73 | return [ |
| 74 | - ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null], |
|
| 75 | - ['table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null], |
|
| 74 | + [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null ], |
|
| 75 | + [ 'table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null ], |
|
| 76 | 76 | ]; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | protected function isMongoMigration(): bool |
| 80 | 80 | { |
| 81 | - return once(function () { |
|
| 81 | + return once(function() { |
|
| 82 | 82 | $option = $this->option('mongo'); |
| 83 | 83 | if ($option !== null) |
| 84 | - $option = (bool)$option; |
|
| 84 | + $option = (bool) $option; |
|
| 85 | 85 | |
| 86 | 86 | return $option === null ? $this->confirm('Is this migration for a mongodb database?', false) : $option; |
| 87 | 87 | }); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | protected function getDestinationFilePath() :string |
| 106 | 106 | { |
| 107 | - return $this->getModule()->getPath() . $this->filePath . '/' . $this->getDestinationFileName() . '.php'; |
|
| 107 | + return $this->getModule()->getPath().$this->filePath.'/'.$this->getDestinationFileName().'.php'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -112,6 +112,6 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function getDestinationFileName() |
| 114 | 114 | { |
| 115 | - return date('Y_m_d_His_') . split_caps_to_underscore($this->getClassName()); |
|
| 115 | + return date('Y_m_d_His_').split_caps_to_underscore($this->getClassName()); |
|
| 116 | 116 | } |
| 117 | 117 | } |
@@ -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 | ]; |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | function get_module_path(string $module) |
| 5 | 5 | { |
| 6 | 6 | $module = ucfirst($module); |
| 7 | - $path = base_path('src/Modules') . '/' . $module; |
|
| 7 | + $path = base_path('src/Modules').'/'.$module; |
|
| 8 | 8 | if (file_exists($path)) { |
| 9 | 9 | return $path; |
| 10 | 10 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | $randomIndex = random_int(0, count($array) - 1); |
| 62 | 62 | |
| 63 | - return $array[$randomIndex]; |
|
| 63 | + return $array[ $randomIndex ]; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | if (!function_exists('create_multiple_from_factory')) { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $traits = array_flip(class_uses_recursive($class)); |
| 111 | 111 | |
| 112 | - return isset($traits[$trait]); |
|
| 112 | + return isset($traits[ $trait ]); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | if (!function_exists('array_keys_exists')) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | if (!function_exists('is_associative_array')) { |
| 154 | 154 | function is_associative_array(array $arr) |
| 155 | 155 | { |
| 156 | - if ([] === $arr) { |
|
| 156 | + if ([ ] === $arr) { |
|
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $i = 0; |
| 233 | 233 | foreach ($splittedInCapsName as $word) { |
| 234 | 234 | if ($i !== 0) |
| 235 | - $splittedString = $splittedString . $word . '_'; |
|
| 235 | + $splittedString = $splittedString.$word.'_'; |
|
| 236 | 236 | $i++; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -231,8 +231,9 @@ |
||
| 231 | 231 | $splittedInCapsName = preg_split('/(?=[A-Z])/', $string); |
| 232 | 232 | $i = 0; |
| 233 | 233 | foreach ($splittedInCapsName as $word) { |
| 234 | - if ($i !== 0) |
|
| 235 | - $splittedString = $splittedString . $word . '_'; |
|
| 234 | + if ($i !== 0) { |
|
| 235 | + $splittedString = $splittedString . $word . '_'; |
|
| 236 | + } |
|
| 236 | 237 | $i++; |
| 237 | 238 | } |
| 238 | 239 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | public function testGetClassConstants() |
| 177 | 177 | { |
| 178 | 178 | $this->assertArrayHasKey('TEST_CONSTANT', get_class_constants(static::class)); |
| 179 | - $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)['TEST_CONSTANT']); |
|
| 179 | + $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)[ 'TEST_CONSTANT' ]); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | public function testInstanceWithoutConstructor() |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $this->assertInstanceOf(Larapi::class, instance_without_constructor(Larapi::class)); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - public function testSplitCapitalStringToUnderscores(){ |
|
| 187 | + public function testSplitCapitalStringToUnderscores() { |
|
| 188 | 188 | $this->assertEquals("proxy_uptime_collection", split_caps_to_underscore("ProxyUptimeCollection")); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function getDispatchedEvents(?string $class): array |
| 23 | 23 | { |
| 24 | - $events = []; |
|
| 25 | - Event::assertDispatched($class, function ($event) use (&$events) { |
|
| 26 | - $events[] = $event; |
|
| 24 | + $events = [ ]; |
|
| 25 | + Event::assertDispatched($class, function($event) use (&$events) { |
|
| 26 | + $events[ ] = $event; |
|
| 27 | 27 | return true; |
| 28 | 28 | }); |
| 29 | 29 | return $events; |
@@ -38,6 +38,6 @@ discard block |
||
| 38 | 38 | $events = $this->getDispatchedEvents($class); |
| 39 | 39 | if (empty($events)) |
| 40 | 40 | return null; |
| 41 | - return $events[0]; |
|
| 41 | + return $events[ 0 ]; |
|
| 42 | 42 | } |
| 43 | 43 | } |
@@ -36,8 +36,9 @@ |
||
| 36 | 36 | protected function getFirstDispatchedEvent(?string $class): ResourceGenerationContract |
| 37 | 37 | { |
| 38 | 38 | $events = $this->getDispatchedEvents($class); |
| 39 | - if (empty($events)) |
|
| 40 | - return null; |
|
| 39 | + if (empty($events)) { |
|
| 40 | + return null; |
|
| 41 | + } |
|
| 41 | 42 | return $events[0]; |
| 42 | 43 | } |
| 43 | 44 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | protected function setOptions(): array |
| 69 | 69 | { |
| 70 | 70 | return [ |
| 71 | - ['command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', null], |
|
| 71 | + [ 'command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', null ], |
|
| 72 | 72 | ]; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | return $this->getOption('command'); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - protected function handleCommandOption($shortcut, $type, $question, $default){ |
|
| 84 | - return $this->ask('What is the name of the terminal command?',str_replace('command', '', strtolower($this->getModuleName()) . ':' . strtolower($this->getClassName()))); |
|
| 83 | + protected function handleCommandOption($shortcut, $type, $question, $default) { |
|
| 84 | + return $this->ask('What is the name of the terminal command?', str_replace('command', '', strtolower($this->getModuleName()).':'.strtolower($this->getClassName()))); |
|
| 85 | 85 | } |
| 86 | 86 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function getPath() |
| 19 | 19 | { |
| 20 | - return get_foundation_path() . '/Generator/Stubs/' . $this->path; |
|
| 20 | + return get_foundation_path().'/Generator/Stubs/'.$this->path; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function getName() |
@@ -59,8 +59,9 @@ |
||
| 59 | 59 | protected function alterOptions($options) |
| 60 | 60 | { |
| 61 | 61 | $options['module'] = Str::studly($this->moduleName); |
| 62 | - if ($this->overwrite) |
|
| 63 | - $options['--overwrite'] = null; |
|
| 62 | + if ($this->overwrite) { |
|
| 63 | + $options['--overwrite'] = null; |
|
| 64 | + } |
|
| 64 | 65 | return $options; |
| 65 | 66 | } |
| 66 | 67 | |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | protected function alterOptions($options) |
| 60 | 60 | { |
| 61 | - $options['module'] = Str::studly($this->moduleName); |
|
| 61 | + $options[ 'module' ] = Str::studly($this->moduleName); |
|
| 62 | 62 | if ($this->overwrite) |
| 63 | - $options['--overwrite'] = null; |
|
| 63 | + $options[ '--overwrite' ] = null; |
|
| 64 | 64 | return $options; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function createComposer() |
| 240 | 240 | { |
| 241 | - $this->call('composer', []); |
|
| 241 | + $this->call('composer', [ ]); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -29,8 +29,9 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function handle(ResourceGenerationContract $event) |
| 31 | 31 | { |
| 32 | - if (file_exists($event->getFilePath())) |
|
| 33 | - unlink($event->getFilePath()); |
|
| 32 | + if (file_exists($event->getFilePath())) { |
|
| 33 | + unlink($event->getFilePath()); |
|
| 34 | + } |
|
| 34 | 35 | |
| 35 | 36 | (new FileGenerator( |
| 36 | 37 | $event->getFilePath(), |