I developed my own module, and I'm trying to implement interface that could later be extended by other developers. Each time, plugin is updated, I need to read information about all these classes that implement interface and store some information in the database. I thought to use reflection for that
$classes=get_declared_classes();
$implementsIPrototype=array();
foreach($classes as $clazz){
$reflect=new ReflectionClass($clazz);
if($reflect->implementsInterface("Prototype")){
// do something with this class
}
I stored interface in /moodle/mod/mymodule/classes/interfaces.php. However, my interface is not visible and I got exception: Exception - Interface Prototype does not exist.
get_declared_interfaces() returns many Moodle interfaces, but not the one from my module. I also noticed that some Moodle interfaces are not returned.
Do you have any suggestions how to solve this?
Thanks,
Zoran