1 | <?php |
||
8 | class AlphabetGenerateCommand extends Command |
||
9 | { |
||
10 | /** |
||
11 | * The console command name. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $name = 'hashid:alphabet'; |
||
16 | |||
17 | /** |
||
18 | * The console command description. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $description = 'Generate a random alphabet for Hashid encoder'; |
||
23 | |||
24 | /** |
||
25 | * The default characters. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $defaultCharacters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
||
30 | |||
31 | /** |
||
32 | * Execute the console command. |
||
33 | * |
||
34 | * @return mixed |
||
35 | */ |
||
36 | 1 | public function handle() |
|
45 | |||
46 | /** |
||
47 | * Get "times" option value. |
||
48 | * |
||
49 | * @return int |
||
50 | */ |
||
51 | 1 | protected function getTimes() |
|
55 | |||
56 | /** |
||
57 | * Generate random alphabets. |
||
58 | * |
||
59 | * @param int $times |
||
60 | * @param string $characters |
||
61 | * @return array |
||
62 | */ |
||
63 | 1 | protected function generateRandomAlphabets($times = 1, $characters = null) |
|
74 | |||
75 | /** |
||
76 | * Get the console command options. |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | 2 | protected function getOptions() |
|
87 | } |
||
88 |