Just wondering if there is some plan on making it compatible with PHP 5.3 namespaces?
There are some issues with relative vs absolute scope (which can be overcome) but the main issue is with the factory calls (cant make a new_\My\Name\Space\Class function). Without a proper rewrite there are two quick ways to resolve this:
- Translate the namespace separator to something else - in this case '_':
function create($classname) {
$classname = $this->scope->getImplementation($classname);
$funcname=strtr($classname,'\\','_');
if (isset($this->factory->{'new_' . strtolower($funcname)})) {
return call_user_func($this->factory->{'new_'.$funcname}, $this);
}
if (method_exists($this->factory, 'new_' . $funcname)) {
return $this->factory->{'new_'.$funcname}($this);
}
return $this->createThroughReflection($classname);
}
- Instead of checking for the existence of the 'new_' function call it and require the factory to have a __call catchall method that either handles the classname conversion or returns false.
Just wondering if there is some plan on making it compatible with PHP 5.3 namespaces?
There are some issues with relative vs absolute scope (which can be overcome) but the main issue is with the factory calls (cant make a new_\My\Name\Space\Class function). Without a proper rewrite there are two quick ways to resolve this: