update descartes

This commit is contained in:
osaajani 2019-10-29 18:33:30 +01:00
parent 508aeb0957
commit e15fb3cf8c
15 changed files with 112 additions and 60 deletions

View file

@ -1,5 +1,6 @@
<?php
/**
namespace descartes;
/**
* Class to route console query
*/
class Console
@ -108,7 +109,7 @@
$params[$name] = $value;
}
$reflection = new ReflectionMethod($controller, $method);
$reflection = new \ReflectionMethod($controller, $method);
$method_arguments = [];
foreach ($reflection->getParameters() as $parameter)
@ -168,12 +169,12 @@
$retour .= 'Help of Controller ' . $controller . "\n" .
"Methods : \n";
$reflection = new ReflectionClass($controller);
$reflection = new \ReflectionClass($controller);
$reflection_methods = $reflection->getMethods();
}
else
{
$reflection_methods = [new ReflectionMethod($controller, $method)];
$reflection_methods = [new \ReflectionMethod($controller, $method)];
$retour .= 'Help of Controller ' . $controller . ' and method ' . $method . "\n";
}
@ -228,7 +229,14 @@
return true;
}
$controller = new $controller(...$args);
$reflection = new \ReflectionClass($controller);
$reflection_method = $reflection->getMethod($method);
if (!$reflection_method->isStatic())
{
$controller = new $controller(...$args);
}
return call_user_func_array([$controller, $method], $params);
}