Installer tweaks
This commit is contained in:
		@@ -7,12 +7,14 @@ use Spark\Pipe\Filters\PhpFilter;
 | 
			
		||||
use Spark\Resource\ResourceType;
 | 
			
		||||
use Spark\SparkApplication;
 | 
			
		||||
 | 
			
		||||
$HELPERS = [];
 | 
			
		||||
 | 
			
		||||
function object(...$data) {
 | 
			
		||||
    return (object)$data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------- Helpers -------
 | 
			
		||||
 | 
			
		||||
$HELPERS = [];
 | 
			
		||||
 | 
			
		||||
function register_helper(string $name, callable $helper) {
 | 
			
		||||
    global $HELPERS;
 | 
			
		||||
    $HELPERS[$name] = $helper;
 | 
			
		||||
@@ -28,6 +30,8 @@ function helper(string $name, ...$args) {
 | 
			
		||||
    return $helper(...$args);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------ Plugins ------
 | 
			
		||||
 | 
			
		||||
function register_plugin(string $name, SparkPlug $plugin) {
 | 
			
		||||
    $refl = new ReflectionClass($plugin);
 | 
			
		||||
    $psr4 = object(
 | 
			
		||||
@@ -50,6 +54,8 @@ function get_plugin(string $name) {
 | 
			
		||||
    return SparkApplication::$instance->getPluginManager()->getPlugin($name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------ Commands ------
 | 
			
		||||
 | 
			
		||||
function register_command(Command $command) {
 | 
			
		||||
    SparkApplication::$instance->add($command);    
 | 
			
		||||
}
 | 
			
		||||
@@ -58,6 +64,8 @@ function get_environment(): Environment {
 | 
			
		||||
    return SparkApplication::$instance->getEnvironment();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------ Resources ------
 | 
			
		||||
 | 
			
		||||
function register_resource_type(string $name, string $type) {
 | 
			
		||||
    SparkApplication::$instance->getResourceManager()->registerResourceType($name, $type);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user