]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/factories/index/class_FileStackIndexFactory.php
Continued with indexes/stacks:
[core.git] / inc / classes / main / factories / index / class_FileStackIndexFactory.php
index ca1fb7cc1363b6d63ca247f428d2e03585f49930..df10a1c84f0cb742b4067faf1c08402d7fd91443 100644 (file)
@@ -38,9 +38,18 @@ class FileStackIndexFactory extends ObjectFactory {
         * @param       $stackName                      Name of the stack's file
         * @return      $indexInstance          An instance of a IndexableStack class
         */
         * @param       $stackName                      Name of the stack's file
         * @return      $indexInstance          An instance of a IndexableStack class
         */
-       public static final function createFileStackIndexInstance ($fileName) {
-               // Call parent factory
-               $indexInstance self::createObjectByConfiguredName('file_stack_index_class', array($fileName));
+       public static final function createFileStackIndexInstance ($fileName, $type) {
+               // If there is no handler?
+               if (Registry::getRegistry()->instanceExists($type . '_index')) {
+                       // Get handler from registry
+                       $indexInstance = Registry::getRegistry()->getInstance($type . '_index');
+               } else {
+                       // Get the handler instance
+                       $indexInstance = self::createObjectByConfiguredName('file_stack_' . $type . '_index_class', array($fileName));
+
+                       // Add it to the registry
+                       Registry::getRegistry()->addInstance($type . '_index', $indexInstance);
+               }
 
                // Return the instance
                return $indexInstance;
 
                // Return the instance
                return $indexInstance;