HEX
Server: LiteSpeed
System: Linux cde2.duelhost.dk 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64
User: dtptviut (1121)
PHP: 8.0.30
Disabled: exec,system,passthru,shell_exec,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/dtptviut/public_html/wp-content/plugins/easy-wp-smtp/src/WPCLI/Bootstrap.php
<?php

namespace EasyWPSMTP\WPCLI;

use WP_CLI;

/**
 * Registers Easy WP SMTP commands with WP-CLI.
 *
 * @since 2.15.0
 */
class Bootstrap {

	/**
	 * Register the `easy-wp-smtp` namespace and its subcommands with WP-CLI.
	 *
	 * @since 2.15.0
	 *
	 * @return void
	 */
	public function register() {

		if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) {
			return;
		}

		WP_CLI::add_command( 'easy-wp-smtp', Commands\Manage::class );
		WP_CLI::add_command( 'easy-wp-smtp test', Commands\Test::class );

		$setup  = [ 'shortdesc' => Commands\Setup::shortdesc() ];
		$option = [ 'shortdesc' => Commands\Option::shortdesc() ];

		// longdesc is only displayed for help / our-namespace invocations, but
		// building it walks the full arg registry; skip that work otherwise.
		if ( $this->needs_longdesc() ) {
			$registry = new Options\Registry();

			$setup['longdesc']  = Commands\Setup::help( $registry );
			$option['longdesc'] = Commands\Option::help( $registry );
		}

		WP_CLI::add_command( 'easy-wp-smtp setup', Commands\Setup::class, $setup );
		WP_CLI::add_command( 'easy-wp-smtp option', Commands\Option::class, $option );
	}

	/**
	 * Whether this invocation will display a command longdesc: a
	 * `wp easy-wp-smtp ...` command (including `--help`) or a
	 * `wp help easy-wp-smtp ...` lookup.
	 *
	 * @since 2.15.0
	 *
	 * @return bool
	 */
	private function needs_longdesc() {

		$args = WP_CLI::get_runner()->arguments;

		return ! empty( $args ) && ( $args[0] === 'easy-wp-smtp' || $args[0] === 'help' );
	}
}