<commit_before><?php

/**
 * Base class for WP-CLI commands
 *
 * @package wp-cli
 * @author <NAME>
 */
abstract class WP_CLI_Command {

    /**
     * Construct for this class, transfers the cli arguments to the right class
     *
     * @param Array $args
     */
    function __construct( $command, $args, $assoc_args ) {
        // The first command is the sub command
        $sub_command = array_shift($args);

        // If the method exists, try to load it
        if(method_exists($this, $sub_command)) {
            $this->$sub_command($args, $assoc_args);
        }
        // If a dummy method exists, use it. This if for reserved keywords in php (like list, isset)
        elseif(method_exists($this, '_'.$sub_command)) {
            $sub_command = '_'.$sub_command;
            $this->$sub_command($args, $assoc_args);
        }
        // Otherwise, show the help for this command
        else {
            $this->help($command, $sub_command);
        }
    }

    /**
     * General help function for this command
     *
     * @param string $command
     * @param string $sub_command
     * @return void
     */
    public function help( $command, $sub_command = false ) {
        // Show the list of sub-commands for this command
        WP_CLI::line('Example usage:');
        WP_CLI::out('    wp '.$command);

        $methods = WP_CLI_Command::getMethods($this);
        if(!empty($methods)) {
            WP_CLI::out(' ['.implode('|', $methods).']');
        }
        WP_CLI::line(' ...');
        WP_CLI::line();

        WP_CLI::warning('The command has no dedicated help function; ask the creator to fix it.');
    }<commit_msg>forgot that the help method could be called explicitly<commit_after><?php

/**
 * Base class for WP-CLI commands
 *
 * @package wp-cli
 * @author <NAME>
 */
abstract class WP_CLI_Command {

	/**
	 * Keeps a reference to the current command name
	 *
	 * @param string
	 */
	protected $command;

    /**
     * Construct for this class, transfers the cli arguments to the right class
     *
     * @param Array $args
     */
    function __construct( $command, $args, $assoc_args ) {
		$this->command = $command;

        // The first command is the sub command
        $sub_command = array_shift($args);

		if ( !method_exists($this, $sub_command) ) {
			// This if for reserved keywords in php (like list, isset)
			$sub_command = '_'.$sub_command;
		}

		if ( !method_exists($this, $sub_command) ) {
			$sub_command = 'help';
		}

		$this->$sub_command($args, $assoc_args);
    }

    /**
     * General help function for this command
     *
     * @param string $command
     * @param string $sub_command
     * @return void
     */
    public function help( $args, $assoc_args ) {
        // Show the list of sub-commands for this command
        WP_CLI::line('Example usage:');
        WP_CLI::out('    wp '.$this->command);

        $methods = WP_CLI_Command::getMethods($this);
        if(!empty($methods)) {
            WP_CLI::out(' ['.implode('|', $methods).']');
        }
        WP_CLI::line(' ...');
        WP_CLI::line();

        WP_CLI::warning('The command has no dedicated help function; ask the creator to fix it.');
    }
{'fraction_non_alphanumeric': 0.13794182045667813, 'fraction_numerical': 0.0, 'mean_word_length': 2.324324324324324, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5797088', 'n_tokens_mistral': 992, 'n_tokens_neox': 966, 'n_words': 280}