<commit_before><?php
/**
 * Manage terms.
 *
 * @package wp-cli
 */
class Term_Command extends WP_CLI_Command {

	/**
	 * List terms in a taxonomy.
	 *
	 * @subcommand list
	 * @synopsis <taxonomy> [--format=<format>]
	 */
	public function _list( $args, $assoc_args ) {

		list( $taxonomy ) = $args;

		$defaults = array(
			'format'     => 'table',
			'hide_empty' => false,
		);
		$assoc_args = wp_parse_args( $assoc_args, $defaults );

		$terms = get_terms( array( $taxonomy ), $assoc_args );

		if ( 'ids' == $assoc_args['format'] )
			$terms = wp_list_pluck( $terms, 'term_id' );

		$fields = array(
			'term_id',
			'term_taxonomy_id',
			'name',
			'slug',
			'description',
			'parent',
			'count',
			);

		WP_CLI\Utils\format_items( $assoc_args['format'], $fields, $terms );
	}

	/**
	 * Create a term.
	 *
	 * @synopsis <term> <taxonomy> [--slug=<slug>] [--description=<description>] [--parent=<term-id>] [--porcelain]
	 */
	public function create( $args, $assoc_args ) {

		list( $term, $taxonomy ) = $args;

		$defaults = array(
			'slug'        => sanitize_title( $term ),
			'description' => '',
			'parent'      => '',
		);
		$assoc_args = wp_parse_args( $assoc_args, $defaults );

		if ( isset( $assoc_args['porcelain'] ) ) {
			$porcelain = true;
			unset( $assoc_args['porcelain'] );
		} else
			$porcelain = false;

		$ret = wp_insert_term( $term, $taxonomy, $assoc_args );

		if ( is_wp_error( $ret ) )
			WP_CLI::error( $ret->get_error_message() );
		else {
			if ( $porcelain )
				WP_CLI::line( $ret['term_id'] );
			else
				WP_CLI::success( sprintf( "Created %s %d.", $taxonomy, $ret['term_id'] ) );
		}
	}

	/**<commit_msg>Balance ze curly braces to meet WP standards<commit_after><?php
/**
 * Manage terms.
 *
 * @package wp-cli
 */
class Term_Command extends WP_CLI_Command {

	/**
	 * List terms in a taxonomy.
	 *
	 * @subcommand list
	 * @synopsis <taxonomy> [--format=<format>]
	 */
	public function _list( $args, $assoc_args ) {

		list( $taxonomy ) = $args;

		$defaults = array(
			'format'     => 'table',
			'hide_empty' => false,
		);
		$assoc_args = wp_parse_args( $assoc_args, $defaults );

		$terms = get_terms( array( $taxonomy ), $assoc_args );

		if ( 'ids' == $assoc_args['format'] )
			$terms = wp_list_pluck( $terms, 'term_id' );

		$fields = array(
			'term_id',
			'term_taxonomy_id',
			'name',
			'slug',
			'description',
			'parent',
			'count',
			);

		WP_CLI\Utils\format_items( $assoc_args['format'], $fields, $terms );
	}

	/**
	 * Create a term.
	 *
	 * @synopsis <term> <taxonomy> [--slug=<slug>] [--description=<description>] [--parent=<term-id>] [--porcelain]
	 */
	public function create( $args, $assoc_args ) {

		list( $term, $taxonomy ) = $args;

		$defaults = array(
			'slug'        => sanitize_title( $term ),
			'description' => '',
			'parent'      => '',
		);
		$assoc_args = wp_parse_args( $assoc_args, $defaults );

		if ( isset( $assoc_args['porcelain'] ) ) {
			$porcelain = true;
			unset( $assoc_args['porcelain'] );
		} else {
			$porcelain = false;
		}

		$ret = wp_insert_term( $term, $taxonomy, $assoc_args );

		if ( is_wp_error( $ret ) ) {
			WP_CLI::error( $ret->get_error_message() );
		} else {
			if ( $porcelain )
				WP_CLI::line( $ret['term_id'] );
			else
				WP_CLI::success( sprintf( "Created %s %d.", $taxonomy, $ret['term_id'] ) );
		}
	}

	/**
{'fraction_non_alphanumeric': 0.19515115234959593, 'fraction_numerical': 0.0, 'mean_word_length': 3.2196969696969697, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, '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': '1510850', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1307, 'n_words': 257}