OK, Here is the actual issue broken down:
using namespacing:
\home\Homecontroller::get(); // returns what I want
Without using namespacing:
$str = "Homecontroller@get"
$caller = explode('@', $str);
$caller[0]::$caller[1](); // returns what I want
Every attempt to do this dynamically fails
\$namespace\$caller[0]::$caller[1](); // fails
eval("\\${namespace}\\${caller[0]}::${caller[1]}()"); // fails
in the homecontroller.php file I have:
<?php
namespace home;
class Homecontroller {
public function Homecontroller()
{
throw new Exception("Homecontroller is a static class");
}
public static function jsonify($data)
{
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 2016 05:00:00 GMT');
header('Content-type: application/json');
print json_encode ($data);
exit();
}
public static function get()
{
$data = [];
$data['message'] = "You have called the GET function";
self::jsonify($data);
}
}
I am building a framework that needs to respect the namespacing, but not specifically aware of them. I need to keep the namespaces listed in an external config file.