HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/coolswim/wp-content/plugins/sitepress-multilingual-cms/classes/wp-cli/BootStrap.php
<?php

namespace WPML\CLI\Core;

use WPML\CLI\Core\Commands\ClearCacheFactory;
use WPML\CLI\Core\Commands\ICommand;

class BootStrap {
	const MAIN_COMMAND = 'wpml';

	/**
	 * @throws \Exception The exception thrown by \WP_CLI::add_command.
	 */
	public function init() {
		$commands_factory = [
			ClearCacheFactory::class,
		];

		foreach ( $commands_factory as $command_factory ) {
			$command_factory_obj = new $command_factory();

			$command = $command_factory_obj->create();

			$this->add_command( $this->getFullCommand( $command ), $command );
		}
	}

	/**
	 * @param string   $command_text The subcommand.
	 * @param callable $command      Command implementation as a class, function or closure.
	 *
	 * @throws \Exception The exception thrown by \WP_CLI::add_command.
	 */
	private function add_command( $command_text, $command ) {
		\WP_CLI::add_command( $command_text, $command );
	}

	/**
	 * @param ICommand $command Command implementation as a class, function or closure.
	 *
	 * @return string The sub command prefixed by the top-level command (all trimmed).
	 */
	private function getFullCommand( $command ) {
		return trim( self::MAIN_COMMAND . ' ' . $command->get_command() );
	}
}