<commit_before><?php

/**
 * DocumentationService
 *
 * Handles the management of the documentation services delivered by the entity.
 * 
 * Includes registering which components to document and handles the entities being
 * documented.
 *
 * @package docsviewer
 */

class DocumentationService {
	
	/**
	 * A mapping of known / popular languages to nice titles. 
	 *
	 * @var Array
	 */
	private static $language_mapping = array(
		'en' => 'English',
		'fr' => 'Français',
		'de' => 'Deutsch'
	);
	
	/**
	 * Files to ignore from any documentation listing.
	 *
	 * @var array
	 */
	private static $ignored_files = array(
		'.', '..', '.DS_Store', 
		'.svn', '.git', 'assets', 'themes', '_images'
	);

	/**
	 * Case insenstive values to use as extensions on markdown pages. The
	 * recommended extension is .md.
	 *
	 * @var array
	 */
	public static $valid_markdown_extensions = array('md', 'txt', 'markdown');
	
	/**
	 * Registered {@link DocumentationEntity} objects to include in the 
	 * documentation. 
	 *
	 * Either pre-filled by the automatic filesystem parser or via 
	 * {@link DocumentationService::register()}. 
	 *
	 * Stores the {@link DocumentEntity} objects which contain the languages 
	 * and versions of each entity.
	 *
	 * You can remove registered {@link DocumentationEntity} objects by using 
	 * {@link DocumentationService::unregister()}
	 *
	 * @var array
	 */
	private static $registered_entities = array();
	
	
	/**
	 * Should generation of documentation categories be automatic? 
	 *
	 * If this is set to true then it will generate {@link DocumentationEntity}
	 * objects from the filesystem. This can be slow and also some projects 
	 * may want to restrict to specific project folders (rather than everything).
	 *
	 * You can also disable or remove a given folder from registration using 
	 * {@link DocumentationService::unregister()}
	 *
	 * @see DocumentationService::$registered_entities
	 * @see DocumentationService::set_automatic_registration();
	 *
	 * @var bool
	 */
	private static $automatic_registration = true;
	
	/**
	 * Return the allowed extensions
	 *
	 * @return array
	 */
	public static function get_valid_extensions() {
		return self::$valid_markdown_extensions;
	}
	
	/**
	 * Check to see if a given extension is a valid extension to be rendered.
	 * Assumes that $ext has a leading dot as that is what $valid_extension uses.
	 *
	 * @return bool
	 */
	public static function is_valid_extension($ext) {
		return in_array(strtolower($ext), self::get_valid_extensions());
	}
	
	/**
	 * Set the ignored files list
	 *
	 * @param array
	 */
	public function set_ignored_files($files) {
		self::$ignored_files = $files;
	}
	
	/**
	 * Return the list of files which are ignored
	 *
	 * @return array
	 */
	public static function get_ignored_files() {
		return self::$ignored_files;
	}

	/**
	 * Set automatic registration of entities and documentation folders
	 *
	 * @see DocumentationService::$automatic_registration
	 * @param bool
	 */
	public static function set_automatic_registration($bool = true) {<commit_msg>FIX: Fixed E_STRICT error - static function not marked as such.<commit_after><?php

/**
 * DocumentationService
 *
 * Handles the management of the documentation services delivered by the entity.
 * 
 * Includes registering which components to document and handles the entities being
 * documented.
 *
 * @package docsviewer
 */

class DocumentationService {
	
	/**
	 * A mapping of known / popular languages to nice titles. 
	 *
	 * @var Array
	 */
	private static $language_mapping = array(
		'en' => 'English',
		'fr' => 'Français',
		'de' => 'Deutsch'
	);
	
	/**
	 * Files to ignore from any documentation listing.
	 *
	 * @var array
	 */
	private static $ignored_files = array(
		'.', '..', '.DS_Store', 
		'.svn', '.git', 'assets', 'themes', '_images'
	);

	/**
	 * Case insenstive values to use as extensions on markdown pages. The
	 * recommended extension is .md.
	 *
	 * @var array
	 */
	public static $valid_markdown_extensions = array('md', 'txt', 'markdown');
	
	/**
	 * Registered {@link DocumentationEntity} objects to include in the 
	 * documentation. 
	 *
	 * Either pre-filled by the automatic filesystem parser or via 
	 * {@link DocumentationService::register()}. 
	 *
	 * Stores the {@link DocumentEntity} objects which contain the languages 
	 * and versions of each entity.
	 *
	 * You can remove registered {@link DocumentationEntity} objects by using 
	 * {@link DocumentationService::unregister()}
	 *
	 * @var array
	 */
	private static $registered_entities = array();
	
	
	/**
	 * Should generation of documentation categories be automatic? 
	 *
	 * If this is set to true then it will generate {@link DocumentationEntity}
	 * objects from the filesystem. This can be slow and also some projects 
	 * may want to restrict to specific project folders (rather than everything).
	 *
	 * You can also disable or remove a given folder from registration using 
	 * {@link DocumentationService::unregister()}
	 *
	 * @see DocumentationService::$registered_entities
	 * @see DocumentationService::set_automatic_registration();
	 *
	 * @var bool
	 */
	private static $automatic_registration = true;
	
	/**
	 * Return the allowed extensions
	 *
	 * @return array
	 */
	public static function get_valid_extensions() {
		return self::$valid_markdown_extensions;
	}
	
	/**
	 * Check to see if a given extension is a valid extension to be rendered.
	 * Assumes that $ext has a leading dot as that is what $valid_extension uses.
	 *
	 * @return bool
	 */
	public static function is_valid_extension($ext) {
		return in_array(strtolower($ext), self::get_valid_extensions());
	}
	
	/**
	 * Set the ignored files list
	 *
	 * @param array
	 */
	public static function set_ignored_files($files) {
		self::$ignored_files = $files;
	}
	
	/**
	 * Return the list of files which are ignored
	 *
	 * @return array
	 */
	public static function get_ignored_files() {
		return self::$ignored_files;
	}

	/**
	 * Set automatic registration of entities and documentation folders
	 *
	 * @see DocumentationService::$automatic_registration
	 * @param bool
	 */
	public static function set_automatic_registration($bool = true) {
{'fraction_non_alphanumeric': 0.10676788887094169, 'fraction_numerical': 0.0, 'mean_word_length': 3.600297176820208, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7562384', 'n_tokens_mistral': 1867, 'n_tokens_neox': 1641, 'n_words': 614}