@@ -36,31 +36,31 @@ |
||
| 36 | 36 | * |
| 37 | 37 | * @return mixed |
| 38 | 38 | */ |
| 39 | - public function handle() |
|
| 40 | - { |
|
| 41 | - $categories = Category::get(); |
|
| 39 | + public function handle() |
|
| 40 | + { |
|
| 41 | + $categories = Category::get(); |
|
| 42 | 42 | |
| 43 | - if ($categories->isEmpty()) { |
|
| 44 | - $this->info("No categories to export"); |
|
| 45 | - return; |
|
| 46 | - } |
|
| 43 | + if ($categories->isEmpty()) { |
|
| 44 | + $this->info("No categories to export"); |
|
| 45 | + return; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - foreach ($categories as $category){ |
|
| 49 | - $accounts = $this->fecthAccounts(['category_id' => $category->id]); |
|
| 48 | + foreach ($categories as $category){ |
|
| 49 | + $accounts = $this->fecthAccounts(['category_id' => $category->id]); |
|
| 50 | 50 | |
| 51 | - $name = normalise($category->name); |
|
| 52 | - $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
|
| 51 | + $name = normalise($category->name); |
|
| 52 | + $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
|
| 53 | 53 | |
| 54 | - $count = $this->exportAccounts($accounts, $filename, false, $this->option('ci')); |
|
| 54 | + $count = $this->exportAccounts($accounts, $filename, false, $this->option('ci')); |
|
| 55 | 55 | |
| 56 | - try { |
|
| 57 | - $url = $this->exportToLocation($filename); |
|
| 58 | - } catch(\Exception $e) { |
|
| 59 | - $this->error('Export cancelled by user!'); |
|
| 60 | - return; |
|
| 61 | - } |
|
| 56 | + try { |
|
| 57 | + $url = $this->exportToLocation($filename); |
|
| 58 | + } catch(\Exception $e) { |
|
| 59 | + $this->error('Export cancelled by user!'); |
|
| 60 | + return; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - $this->info("{$count} accounts '{$category->name}' exported into file '{$url}'"); |
|
| 64 | - } |
|
| 65 | - } |
|
| 63 | + $this->info("{$count} accounts '{$category->name}' exported into file '{$url}'"); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - foreach ($categories as $category){ |
|
| 48 | + foreach ($categories as $category) { |
|
| 49 | 49 | $accounts = $this->fecthAccounts(['category_id' => $category->id]); |
| 50 | 50 | |
| 51 | 51 | $name = normalise($category->name); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | try { |
| 57 | 57 | $url = $this->exportToLocation($filename); |
| 58 | - } catch(\Exception $e) { |
|
| 58 | + } catch (\Exception $e) { |
|
| 59 | 59 | $this->error('Export cancelled by user!'); |
| 60 | 60 | return; |
| 61 | 61 | } |
@@ -66,19 +66,19 @@ |
||
| 66 | 66 | |
| 67 | 67 | $flagCI = $this->option('ci'); |
| 68 | 68 | if ($flagCI === false) { |
| 69 | - $bar = $this->output->createProgressBar($count); |
|
| 69 | + $bar = $this->output->createProgressBar($count); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | foreach ($items as $item) { |
| 73 | 73 | $this->storage->prepend($filename, "{$item->value}"); |
| 74 | 74 | if (isset($bar)) { |
| 75 | - $bar->advance(); |
|
| 75 | + $bar->advance(); |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if (isset($bar)) { |
| 80 | - $bar->finish(); |
|
| 81 | - $this->info("\n"); |
|
| 80 | + $bar->finish(); |
|
| 81 | + $this->info("\n"); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | try { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | public function handle() |
| 40 | 40 | { |
| 41 | 41 | $whitelist = empty($this->option('blacklist')); |
| 42 | - if ( false === empty($this->option('list'))) { |
|
| 42 | + if (false === empty($this->option('list'))) { |
|
| 43 | 43 | $this->exportProxyList($this->option('list'), $whitelist); |
| 44 | 44 | } else { |
| 45 | 45 | $this->exportProxyList('domain', $whitelist); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | try { |
| 85 | 85 | $url = $this->exportToLocation($filename); |
| 86 | - } catch(\Exception $e) { |
|
| 86 | + } catch (\Exception $e) { |
|
| 87 | 87 | $this->error('Export cancelled by user!'); |
| 88 | 88 | return; |
| 89 | 89 | } |
@@ -36,31 +36,31 @@ |
||
| 36 | 36 | * |
| 37 | 37 | * @return mixed |
| 38 | 38 | */ |
| 39 | - public function handle() |
|
| 40 | - { |
|
| 41 | - $groups = Group::get(); |
|
| 39 | + public function handle() |
|
| 40 | + { |
|
| 41 | + $groups = Group::get(); |
|
| 42 | 42 | |
| 43 | - if ($groups->isEmpty()) { |
|
| 44 | - $this->info("No groups to export"); |
|
| 45 | - return; |
|
| 46 | - } |
|
| 43 | + if ($groups->isEmpty()) { |
|
| 44 | + $this->info("No groups to export"); |
|
| 45 | + return; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - foreach ($groups as $group){ |
|
| 48 | + foreach ($groups as $group){ |
|
| 49 | 49 | $accounts = $this->fecthAccounts(['group_id' => $group->id]); |
| 50 | 50 | |
| 51 | - $name = normalise($group->name); |
|
| 52 | - $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
|
| 51 | + $name = normalise($group->name); |
|
| 52 | + $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
|
| 53 | 53 | |
| 54 | - $count = $this->exportAccounts($accounts, $filename, false, $this->option('ci')); |
|
| 54 | + $count = $this->exportAccounts($accounts, $filename, false, $this->option('ci')); |
|
| 55 | 55 | |
| 56 | - try { |
|
| 57 | - $url = $this->exportToLocation($filename); |
|
| 58 | - } catch(\Exception $e) { |
|
| 59 | - $this->error('Export cancelled by user!'); |
|
| 60 | - return; |
|
| 61 | - } |
|
| 56 | + try { |
|
| 57 | + $url = $this->exportToLocation($filename); |
|
| 58 | + } catch(\Exception $e) { |
|
| 59 | + $this->error('Export cancelled by user!'); |
|
| 60 | + return; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - $this->info("{$count} accounts '{$group->name}' exported into file '{$url}'"); |
|
| 64 | - } |
|
| 65 | - } |
|
| 63 | + $this->info("{$count} accounts '{$group->name}' exported into file '{$url}'"); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - foreach ($groups as $group){ |
|
| 48 | + foreach ($groups as $group) { |
|
| 49 | 49 | $accounts = $this->fecthAccounts(['group_id' => $group->id]); |
| 50 | 50 | |
| 51 | 51 | $name = normalise($group->name); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | try { |
| 57 | 57 | $url = $this->exportToLocation($filename); |
| 58 | - } catch(\Exception $e) { |
|
| 58 | + } catch (\Exception $e) { |
|
| 59 | 59 | $this->error('Export cancelled by user!'); |
| 60 | 60 | return; |
| 61 | 61 | } |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | protected $description = 'Export accounts, groups and categories at once'; |
| 24 | 24 | |
| 25 | 25 | protected $commands = [ |
| 26 | - 'export:accounts', |
|
| 27 | - 'export:groups', |
|
| 28 | - 'export:categories' |
|
| 26 | + 'export:accounts', |
|
| 27 | + 'export:groups', |
|
| 28 | + 'export:categories' |
|
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | public function handle() |
| 47 | 47 | { |
| 48 | 48 | foreach ($this->commands as $cmd) { |
| 49 | - $this->call($cmd, [ |
|
| 49 | + $this->call($cmd, [ |
|
| 50 | 50 | '--ci' => $this->option('ci'), |
| 51 | 51 | 'output' => $this->argument('output'), |
| 52 | - ]); |
|
| 52 | + ]); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $count = count($accounts); |
| 98 | 98 | |
| 99 | 99 | if ($flagCI === false) { |
| 100 | - $bar = $this->output->createProgressBar($count); |
|
| 100 | + $bar = $this->output->createProgressBar($count); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | foreach ($accounts as $account) { |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | $record .= $password ? ":{$account->netpass}" : ''; |
| 106 | 106 | $this->storage->prepend($filename, $record); |
| 107 | 107 | if (isset($bar)) { |
| 108 | - $bar->advance(); |
|
| 108 | + $bar->advance(); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | if (isset($bar)) { |
| 113 | - $bar->finish(); |
|
| 114 | - $this->info("\n"); |
|
| 113 | + $bar->finish(); |
|
| 114 | + $this->info("\n"); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | return $count; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $query = Account::where('status', Account::ACCOUNT_ENABLE); |
| 130 | 130 | |
| 131 | 131 | if(is_null($filter) === false && is_array($filter)) { |
| 132 | - $query = $query->where($filter); |
|
| 132 | + $query = $query->where($filter); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | return $query->orderBy('netlogin', 'desc')->get(); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if ($this->confirm("Overwrite existing '$target' ?")) { |
| 152 | 152 | $fs->delete($target); |
| 153 | 153 | } else { |
| 154 | - throw new \Exception(); |
|
| 154 | + throw new \Exception(); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $fs->rename($source, $target); |
| 160 | 160 | |
| 161 | 161 | } else { |
| 162 | - $target = $source; |
|
| 162 | + $target = $source; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | return $target; |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @return App\Account |
| 126 | 126 | */ |
| 127 | - final protected function fecthAccounts($filter=null) |
|
| 127 | + final protected function fecthAccounts($filter = null) |
|
| 128 | 128 | { |
| 129 | 129 | $query = Account::where('status', Account::ACCOUNT_ENABLE); |
| 130 | 130 | |
| 131 | - if(is_null($filter) === false && is_array($filter)) { |
|
| 131 | + if (is_null($filter) === false && is_array($filter)) { |
|
| 132 | 132 | $query = $query->where($filter); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $source = $this->storage->path($filename); |
| 141 | 141 | |
| 142 | - if($this->argument('output')) { |
|
| 143 | - $target = $this->argument('output') . '/' . $filename; |
|
| 142 | + if ($this->argument('output')) { |
|
| 143 | + $target = $this->argument('output').'/'.$filename; |
|
| 144 | 144 | |
| 145 | 145 | $fs = new Filesystem(new Local('/')); |
| 146 | 146 | |
| 147 | - if ($fs->has($target) ) { |
|
| 147 | + if ($fs->has($target)) { |
|
| 148 | 148 | if ($this->option('ci')) { |
| 149 | 149 | $fs->delete($target); |
| 150 | 150 | } else { |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | try { |
| 57 | 57 | $url = $this->exportToLocation($filename); |
| 58 | - } catch(\Exception $e) { |
|
| 58 | + } catch (\Exception $e) { |
|
| 59 | 59 | $this->error('Export cancelled by user!'); |
| 60 | 60 | return; |
| 61 | 61 | } |