<commit_before><commit_msg>Add e2e/wp/version endpoint.<commit_after><?php
/**
 * Plugin Name: E2E WP Version REST Endpoint
 * Description: REST Endpoint for providing information about the current core version.
 *
 * @package   Google\Site_Kit
 * @copyright 2020 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://sitekit.withgoogle.com
 */

use Google\Site_Kit\Core\REST_API\REST_Routes;

add_action(
	'rest_api_init',
	function () {
		if ( ! defined( 'GOOGLESITEKIT_PLUGIN_MAIN_FILE' ) ) {
			return;
		}

		register_rest_route(
			REST_Routes::REST_ROOT,
			'e2e/wp/version',
			array(
				'methods'  => 'GET',
				'callback' => function () {
					$version = get_bloginfo( 'version' );
					list( $major, $minor ) = explode( '.', $version );

					return array(
						'version' => $version,
						'major'   => (int) $major,
						'minor'   => (int) $minor,
					);
				},
			)
		);
	},
	0
);

{'fraction_non_alphanumeric': 0.15392670157068064, 'fraction_numerical': 0.012565445026178011, 'mean_word_length': 3.0337552742616034, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, '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': '6073026', 'n_tokens_mistral': 406, 'n_tokens_neox': 339, 'n_words': 70}