|
4 | 4 |
|
5 | 5 | namespace CodeIgniter\Shield\Commands; |
6 | 6 |
|
7 | | -use CodeIgniter\CLI\BaseCommand; |
8 | 7 | use CodeIgniter\Shield\Authentication\Authenticators\Session; |
9 | 8 | use CodeIgniter\Shield\Commands\Exceptions\BadInputException; |
10 | 9 | use CodeIgniter\Shield\Commands\Exceptions\CancelException; |
11 | | -use CodeIgniter\Shield\Commands\Utils\InputOutput; |
12 | 10 | use CodeIgniter\Shield\Config\Auth; |
13 | 11 | use CodeIgniter\Shield\Entities\User as UserEntity; |
14 | 12 | use CodeIgniter\Shield\Exceptions\UserNotFoundException; |
|
18 | 16 |
|
19 | 17 | class User extends BaseCommand |
20 | 18 | { |
21 | | - private static ?InputOutput $io = null; |
22 | | - private array $validActions = [ |
| 19 | + private array $validActions = [ |
23 | 20 | 'create', 'activate', 'deactivate', 'changename', 'changeemail', |
24 | 21 | 'delete', 'password', 'list', 'addgroup', 'removegroup', |
25 | 22 | ]; |
26 | 23 |
|
27 | | - /** |
28 | | - * The group the command is lumped under |
29 | | - * when listing commands. |
30 | | - * |
31 | | - * @var string |
32 | | - */ |
33 | | - protected $group = 'Shield'; |
34 | | - |
35 | 24 | /** |
36 | 25 | * Command's name |
37 | 26 | * |
@@ -251,31 +240,6 @@ private function setValidationRules(): void |
251 | 240 | ]; |
252 | 241 | } |
253 | 242 |
|
254 | | - /** |
255 | | - * Asks the user for input. |
256 | | - * |
257 | | - * @param string $field Output "field" question |
258 | | - * @param array|string $options String to a default value, array to a list of options (the first option will be the default value) |
259 | | - * @param array|string $validation Validation rules |
260 | | - * |
261 | | - * @return string The user input |
262 | | - */ |
263 | | - private function prompt(string $field, $options = null, $validation = null): string |
264 | | - { |
265 | | - return self::$io->prompt($field, $options, $validation); |
266 | | - } |
267 | | - |
268 | | - /** |
269 | | - * Outputs a string to the cli on its own line. |
270 | | - */ |
271 | | - private function write( |
272 | | - string $text = '', |
273 | | - ?string $foreground = null, |
274 | | - ?string $background = null |
275 | | - ): void { |
276 | | - self::$io->write($text, $foreground, $background); |
277 | | - } |
278 | | - |
279 | 243 | /** |
280 | 244 | * Create a new user |
281 | 245 | * |
@@ -692,27 +656,4 @@ private function findUser($question = '', $username = null, $email = null): User |
692 | 656 |
|
693 | 657 | return $userModel->findById($user['id']); |
694 | 658 | } |
695 | | - |
696 | | - private function ensureInputOutput(): void |
697 | | - { |
698 | | - if (self::$io === null) { |
699 | | - self::$io = new InputOutput(); |
700 | | - } |
701 | | - } |
702 | | - |
703 | | - /** |
704 | | - * @internal Testing purpose only |
705 | | - */ |
706 | | - public static function setInputOutput(InputOutput $io): void |
707 | | - { |
708 | | - self::$io = $io; |
709 | | - } |
710 | | - |
711 | | - /** |
712 | | - * @internal Testing purpose only |
713 | | - */ |
714 | | - public static function resetInputOutput(): void |
715 | | - { |
716 | | - self::$io = null; |
717 | | - } |
718 | 659 | } |
0 commit comments