@@ -15,40 +15,40 @@ |
||
| 15 | 15 | use Symfony\Component\Console\Output\OutputInterface; |
| 16 | 16 | |
| 17 | 17 | class SnowflakeDecodeId extends Base { |
| 18 | - public function __construct( |
|
| 19 | - private readonly IDecoder $decoder, |
|
| 20 | - ) { |
|
| 21 | - parent::__construct(); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - protected function configure(): void { |
|
| 25 | - parent::configure(); |
|
| 26 | - |
|
| 27 | - $this |
|
| 28 | - ->setName('snowflake:decode') |
|
| 29 | - ->setDescription('Decode Snowflake IDs used by Nextcloud') |
|
| 30 | - ->addArgument('snowflake-id', InputArgument::REQUIRED, 'Nextcloud Snowflake ID to decode'); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 34 | - $snowflakeId = $input->getArgument('snowflake-id'); |
|
| 35 | - $data = $this->decoder->decode($snowflakeId); |
|
| 36 | - |
|
| 37 | - $rows = [ |
|
| 38 | - ['Snowflake ID', $snowflakeId], |
|
| 39 | - ['Seconds', $data['seconds']], |
|
| 40 | - ['Milliseconds', $data['milliseconds']], |
|
| 41 | - ['Created from CLI', $data['isCli'] ? 'yes' : 'no'], |
|
| 42 | - ['Server ID', $data['serverId']], |
|
| 43 | - ['Sequence ID', $data['sequenceId']], |
|
| 44 | - ['Creation timestamp', $data['createdAt']->format('U.v')], |
|
| 45 | - ['Creation date', $data['createdAt']->format('Y-m-d H:i:s.v')], |
|
| 46 | - ]; |
|
| 47 | - |
|
| 48 | - $table = new Table($output); |
|
| 49 | - $table->setRows($rows); |
|
| 50 | - $table->render(); |
|
| 51 | - |
|
| 52 | - return Base::SUCCESS; |
|
| 53 | - } |
|
| 18 | + public function __construct( |
|
| 19 | + private readonly IDecoder $decoder, |
|
| 20 | + ) { |
|
| 21 | + parent::__construct(); |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + protected function configure(): void { |
|
| 25 | + parent::configure(); |
|
| 26 | + |
|
| 27 | + $this |
|
| 28 | + ->setName('snowflake:decode') |
|
| 29 | + ->setDescription('Decode Snowflake IDs used by Nextcloud') |
|
| 30 | + ->addArgument('snowflake-id', InputArgument::REQUIRED, 'Nextcloud Snowflake ID to decode'); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 34 | + $snowflakeId = $input->getArgument('snowflake-id'); |
|
| 35 | + $data = $this->decoder->decode($snowflakeId); |
|
| 36 | + |
|
| 37 | + $rows = [ |
|
| 38 | + ['Snowflake ID', $snowflakeId], |
|
| 39 | + ['Seconds', $data['seconds']], |
|
| 40 | + ['Milliseconds', $data['milliseconds']], |
|
| 41 | + ['Created from CLI', $data['isCli'] ? 'yes' : 'no'], |
|
| 42 | + ['Server ID', $data['serverId']], |
|
| 43 | + ['Sequence ID', $data['sequenceId']], |
|
| 44 | + ['Creation timestamp', $data['createdAt']->format('U.v')], |
|
| 45 | + ['Creation date', $data['createdAt']->format('Y-m-d H:i:s.v')], |
|
| 46 | + ]; |
|
| 47 | + |
|
| 48 | + $table = new Table($output); |
|
| 49 | + $table->setRows($rows); |
|
| 50 | + $table->render(); |
|
| 51 | + |
|
| 52 | + return Base::SUCCESS; |
|
| 53 | + } |
|
| 54 | 54 | } |