Open donquixote opened 11 years ago
You don't mean Symfony's UniversalClassLoader, do you? https://github.com/RobLoach/class-loader-adapter/blob/master/src/RobLoach/ClassLoaderAdapter/Symfony/UniversalClassLoader.php
Most of that code is taken from what Drupal had before the switch to ClassLoader. UniversalClassLoader is rather old and is rather deprecated by ClassLoader.
This package is not aimed to implement its own class loader, but rather provide interoperability between a bunch of third-party ones. Is this what you were getting at? Or are you suggesting to add more functionality to support outside the scope of PSR-0?
addPrefix()
is aimed to just target PSR-0 namespaces. PSR-0 namespace loading can cover PEAR-like namespaces. You can see that covered in the test coverage here:
https://github.com/RobLoach/class-loader-adapter/blob/master/tests/RobLoach/ClassLoaderAdapter/Test/ClassLoaderAdapterTest.php#L62
http://github.com/RobLoach/class-loader-adapter/tree/master/tests/RobLoach/ClassLoaderAdapter/Test/Fixtures
Hi, if you really want to mimick the more "modern" loaders with UniversalClassLoaders, then in certain cases you might have to register namespace AND prefix.
The following is from the current version of the Krautoload RegistrationHub, which attempts the same thing, and still does not simulate all possible "false positives". The question is, is this even intended?
Examples: