mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 09:52:13 +00:00
[FEATURE] Added class + method loading to IClassLoader.
This commit is contained in:
@@ -22,6 +22,18 @@ class ClassLoader implements IClassLoader
|
||||
return new $class();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when loading class method
|
||||
* @param object $class
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return object
|
||||
*/
|
||||
public function loadClassMethod($class, string $method, array $parameters)
|
||||
{
|
||||
return call_user_func_array([$class, $method], array_values($parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load closure
|
||||
*
|
||||
|
||||
@@ -12,6 +12,15 @@ interface IClassLoader
|
||||
*/
|
||||
public function loadClass(string $class);
|
||||
|
||||
/**
|
||||
* Called when loading class method
|
||||
* @param object $class
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return object
|
||||
*/
|
||||
public function loadClassMethod($class, string $method, array $parameters);
|
||||
|
||||
/**
|
||||
* Called when loading method
|
||||
*
|
||||
@@ -21,4 +30,4 @@ interface IClassLoader
|
||||
*/
|
||||
public function loadClosure(Callable $closure, array $parameters);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user