getHelpMessage() . "\n"); return 0; } if(isset($args[CliCommands::INITIALIZE->value])) { return CliCommands::INITIALIZE->handle($args); } if(isset($args[CliCommands::DNS_RECORD->value])) { return CliCommands::DNS_RECORD->handle($args); } return self::displayHelp(); } /** * Displays the help message for the Socialbox CLI Management Interface. * * This method prints out the usage instructions and a list of available commands. * * @return int Returns 0 upon successful display of the help message. */ private static function displayHelp(): int { print("Socialbox - CLI Management Interface\n"); print("Usage: socialbox [command] [arguments]\n\n"); print("Commands:\n"); print(" help - Displays this help message.\n"); foreach(CliCommands::cases() as $command) { print(sprintf(" %s - %s\n", $command->value, $command->getShortHelpMessage())); } print("Use 'socialbox --help=[command]' for more information about a command.\n"); return 0; } /** * Retrieves the logger instance for the Socialbox program. * * @return Logger Returns the logger instance. */ public static function getLogger(): Logger { if(self::$logger === null) { self::$logger = new Logger('net.nosial.socialbox'); Logger::registerHandlers(); } return self::$logger; } }