<commit_before><?php

namespace MyAdmin\Plugins;

/**
 * Class Loader
 *
 * Here are some of the regexes ive used to change code to using this class:
 *  ('[^']*') *=> *('[^']*'),
 *  $loader->add_requirement(\1, \2);
 *
 * @package MyAdmin
 */
class Loader {
	private $requirements;
	private $routes;
	private $admin_routes;

	/**
	 * Loader constructor.
	 */
	public function __construct() {
		$this->requirements = [];
		$this->routes = [];
		$this->admin_routes = [];
	}

	/**
	 * gets the page routes
	 *
	 * @return array of routes
	 */
	public function get_routes() {
		return $this->routes;
	}

	/**
	 * gets the admin page routes
	 *
	 * @return array of routes
	 */
	public function get_admin_routes() {
		return $this->admin_routes;
	}

	/**
	 * returns the value of a setting
	 *
	 * @param string $setting
	 * @return mixed the value of the setting
	 */
	public function get_setting($setting) {
		return constant($setting);
	}

	/**
	 * adds a requirement into the loader and registers it as a page with the router
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_page_requirement($function, $source, $namespace = '') {
		$this->routes['/'.$function] = $namespace.$function;
		$this->admin_routes['/'.$function] = $namespace.$function;
		$this->add_requirement($function, $source, $namespace);
	}

	/**
	 * adds a requirement into the loader and registers it as a page with the router
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_root_page_requirement($function, $source, $namespace = '') {
		$this->routes['/'.$function] = $namespace.$function;
		$this->add_requirement($function, $source, $namespace);
	}

	/**
	 * adds a requirement into the loader and registers it as a page with the router
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_ajax_page_requirement($function, $source, $namespace = '') {
		$this->routes['/ajax/'.$function] = $namespace.$function;
		$this->add_requirement($function, $source, $namespace);
	}

	/**
	 * adds a requirement into the loader and registers it as a page with the router
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_admin_page_requirement($function, $source, $namespace = '') {
		$this->admin_routes['/'.$function] = $namespace.$function;
		$this->add_requirement($function, $source, $namespace);
	}

	/**
	 * adds a requirement into the loader
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_requirement($function, $source, $namespace = '') {
		$this->requirements[$function] = $namespace.$source;
	}

	/**
	 * gets an array of requirements for loading
	 *
	 * @return array the array of requirements
	 */
	public function get_requirements() {
		return $this->requirements;
	}
}

<commit_msg>adding support for public paths<commit_after><?php

namespace MyAdmin\Plugins;

/**
 * Class Loader
 *
 * Here are some of the regexes ive used to change code to using this class:
 *  ('[^']*') *=> *('[^']*'),
 *  $loader->add_requirement(\1, \2);
 *
 * @package MyAdmin
 */
class Loader {
	private $requirements;
	private $routes;
	private $admin_routes;
	private $public_routes;

	/**
	 * Loader constructor.
	 */
	public function __construct() {
		$this->requirements = [];
		$this->routes = [];
		$this->admin_routes = [];
		$this->public_routes = [];
	}

	/**
	 * gets the page routes
	 *
	 * @return array of routes
	 */
	public function get_routes() {
		return $this->routes;
	}

	/**
	 * gets the admin page routes
	 *
	 * @return array of routes
	 */
	public function get_admin_routes() {
		return $this->admin_routes;
	}

	/**
	 * gets the public page routes
	 *
	 * @return array of routes
	 */
	public function get_public_routes() {
		return $this->public_routes;
	}

	/**
	 * returns the value of a setting
	 *
	 * @param string $setting
	 * @return mixed the value of the setting
	 */
	public function get_setting($setting) {
		return constant($setting);
	}

	/**
	 * adds a requirement into the loader and registers it as a page with the router
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_page_requirement($function, $source, $namespace = '') {
		$this->routes['/'.$function] = $namespace.$function;
		$this->admin_routes['/'.$function] = $namespace.$function;
		$this->add_requirement($function, $source, $namespace);
	}

	/**
	 * adds a requirement into the loader and registers it as a page with the router
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_root_page_requirement($function, $source, $namespace = '') {
		$this->routes['/'.$function] = $namespace.$function;
		$this->add_requirement($function, $source, $namespace);
	}

	/**
	 * adds a requirement into the loader and registers it as a page with the router
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $path source file path
	 */
	public function add_public_path($page, $source) {
		$this->public_routes['/'.$page] = $source;
	}

	/**
	 * adds a requirement into the loader and registers it as a page with the router
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_ajax_page_requirement($function, $source, $namespace = '') {
		$this->routes['/ajax/'.$function] = $namespace.$function;
		$this->add_requirement($function, $source, $namespace);
	}

	/**
	 * adds a requirement into the loader and registers it as a page with the router
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_admin_page_requirement($function, $source, $namespace = '') {
		$this->admin_routes['/'.$function] = $namespace.$function;
		$this->add_requirement($function, $source, $namespace);
	}

	/**
	 * adds a requirement into the loader
	 *
	 * @param string $function php function name or class.class_name
	 * @param string $source php source file
	 * @param string $namespace optional php namespace
	 */
	public function add_requirement($function, $source, $namespace = '') {
		$this->requirements[$function] = $namespace.$source;
	}

	/**
	 * gets an array of requirements for loading
	 *
	 * @return array the array of requirements
	 */
	public function get_requirements() {
		return $this->requirements;
	}
}


{'fraction_non_alphanumeric': 0.1299489584770313, 'fraction_numerical': 0.0005518002483101117, 'mean_word_length': 3.8462566844919786, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 42, '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': '2304165', 'n_tokens_mistral': 2251, 'n_tokens_neox': 2092, 'n_words': 698}