Exemple #1
0
 private static function getAllTaggableObjectsHandlers()
 {
     if (self::$TaggableObjectsHandlers === null) {
         $directory = new DirectoryIterator(FRAMEWORK_TAGS_HANDLERS_PATH);
         self::$TaggableObjectsHandlers = array();
         foreach ($directory as $fileInfo) {
             if ($fileInfo->isFile()) {
                 $className = $fileInfo->getBasename('.php');
                 try {
                     //FIXME: the require_once here was necessary to be able to run the unit tests on Mac platforms => find why!
                     require_once FRAMEWORK_TAGS_HANDLERS_PATH . '/' . $fileInfo->getBasename();
                     $obj = call_user_func(array($className, 'getInstance'));
                     if ($obj === false) {
                         throw new EyeBadMethodCallException('Unable to create instance of class ' . $className);
                     }
                 } catch (EyeErrorException $e) {
                     throw new EyeException('Unable to create instance of the TaggableObjectHandler class ' . $className . '.', 0, $e);
                 }
                 self::$TaggableObjectsHandlers[$className] = $obj;
             }
         }
     }
     return self::$TaggableObjectsHandlers;
 }