system/Events/Events.php
public static function on($event_name, $callback, $priority = EVENT_PRIORITY_NORMAL)
	{
		if (! isset(static::$listeners[$event_name]))
		{
			static::$listeners[$event_name] = [
				true, // If there's only 1 item, it's sorted.
				[$priority],
				[$callback],
			];
		}
		else
		{
			static::$listeners[$event_name][0]   = false; // Not sorted
			static::$listeners[$event_name][1][] = $priority;
			static::$listeners[$event_name][2][] = $callback;
		}
	}
public static function on($event_name, $callback, $priority = EVENT_PRIORITY_NORMAL)
	{
		if (! isset(static::$listeners[$event_name]))
		{
			static::$listeners[$event_name] = [
				true, // If there's only 1 item, it's sorted.
				[$priority],
				[$callback],
			];
		}
		else
		{
			static::$listeners[$event_name][0]   = false; // Not sorted
			static::$listeners[$event_name][1][] = $priority;
			static::$listeners[$event_name][2][] = $callback;
		}
	}
Registers an action to happen on an event. The action can be any sort
of callable:

Events::on('create', 'myFunction');               // procedural function
Events::on('create', ['myClass', 'myMethod']);    // Class::method
Events::on('create', [$myInstance, 'myMethod']);  // Method on an existing instance
Events::on('create', function() {});              // Closure

@param $event_name
@param callable   $callback
@param integer    $priority