Merge branch 'remastering' of https://git.steelants.cz/SImple-Home/PHP_SMART_HOME_V3 into remastering

This commit is contained in:
JonatanRek 2020-04-21 14:11:46 +02:00
commit 15dfc8464d

View File

@ -1,9 +1,9 @@
<?php <?php
/** /**
* Mini Router * Mini Router
* @author github.com/Xinatorus * @author github.com/Xinatorus
* https://github.com/Xinatorus/MiniRouter * https://github.com/Xinatorus/MiniRouter
*/ */
class Router{ class Router{
private $routes; private $routes;
@ -60,6 +60,7 @@ class Router{
} }
if($this->function !== NULL){ if($this->function !== NULL){
if(is_string($this->function)){
if(strpos($this->function, '@') !== false){ if(strpos($this->function, '@') !== false){
list($class, $function) = explode('@', $this->function); list($class, $function) = explode('@', $this->function);
$method = new ReflectionMethod($class, $function); $method = new ReflectionMethod($class, $function);
@ -73,6 +74,9 @@ class Router{
}else if (is_callable($this->function)) { }else if (is_callable($this->function)) {
call_user_func_array($this->function, $this->params); call_user_func_array($this->function, $this->params);
} }
}else if (is_callable($this->function)) {
call_user_func_array($this->function, $this->params);
}
} }
} }