<commit_before><?php
	namespace Skopek\Hooks;

	class Action
	{
		/**
		 * list of hooks
		 * @var array
		 */
		private static $actions = [];

		/**
		 * @param string $name The name of the action.
		 * @param callback $function
		 * @param integer $priority
		 */
		public static function add( $name, $function, $priority = 10 ) {
			static::$actions[ $name ][ $priority ][] = $function;
		}

		/**
		 * @param string $name The name of the action.
		 * @return boolean
		 */
		public static function run( $name ) {
			$args = array_slice(func_get_args(), 1);

			if ( !static::has( $name ) )
				return false;

			ksort(static::$actions[ $name ]);

			foreach (static::$actions[$name] as $priority => $functions) {
				foreach ($functions as $function) {
					call_user_func_array( $function, $args );
					return true;
				}
			}
		}

		/**
		 * @param string $name The name of the action.
		 * @return boolean
		 */
		public static function has( $name ) {
			if( isset( static::$actions[$name] ) && !empty( static::$actions[$name] ) )
				return true;

			return false;
		}
	}
?><commit_msg>Update Action.php<commit_after><?php
	namespace Skopek\Hooks;

	class Action
	{
		/**
		 * list of hooks
		 * @var array
		 */
		private static $actions = [];

		/**
		 * @param string $name The name of the action.
		 * @param callback $function
		 * @param integer $priority
		 */
		public static function add( $name, $function, $priority = 10 ) {
			static::$actions[ $name ][ $priority ][] = $function;
		}

		/**
		 * @param string $name The name of the action.
		 * @return boolean
		 */
		public static function run( $name ) {
			$args = array_slice(func_get_args(), 1);

			if ( !static::has( $name ) )
				return false;

			ksort(static::$actions[ $name ]);

			foreach (static::$actions[$name] as $priority => $functions) {
				foreach ($functions as $function) {
					call_user_func_array( $function, $args );
				}
			}
			return true;
		}

		/**
		 * @param string $name The name of the action.
		 * @return boolean
		 */
		public static function has( $name ) {
			if( isset( static::$actions[$name] ) && !empty( static::$actions[$name] ) )
				return true;

			return false;
		}
	}
?>
{'fraction_non_alphanumeric': 0.15647810218978103, 'fraction_numerical': 0.002737226277372263, 'mean_word_length': 2.8272251308900525, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3896445', 'n_tokens_mistral': 846, 'n_tokens_neox': 693, 'n_words': 205}