24 static::$instances = array();
25 static::$classNames = array();
35 $classList = static::getObjectClassList($interface);
36 foreach ($classList as $className)
38 if ($code == $className::CODE)
40 return new $className();
47 protected static function getObjectInstances($interface)
50 $eventName = $interface::EVENT_NAME;
51 if (isset(static::$instances[$eventName]))
53 return static::$instances[$eventName];
56 static::$instances[$eventName] = array();
57 $classList = static::getObjectClassList($interface);
58 foreach ($classList as $className)
60 static::$instances[$eventName][] =
new $className();
63 return static::$instances[$eventName];
66 protected static function getObjectClassList($interface)
68 $interfaceCode = $interface;
70 $eventName = $interface::EVENT_NAME;
71 if (isset(static::$classNames[$eventName]))
73 return static::$classNames[$eventName];
76 static::$classNames[$eventName] = array();
77 $classList = static::getClasses();
78 $classList = isset($classList[$eventName]) ? $classList[$eventName] : array();
79 foreach ($classList as $className)
81 $interfaces = class_implements($className);
82 if ($interfaces && isset($interfaces[$interfaceCode]))
84 static::$classNames[$eventName][] = $className;
88 return static::$classNames[$eventName];