X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Ffactories%2Findex%2Fclass_FileStackIndexFactory.php;h=df10a1c84f0cb742b4067faf1c08402d7fd91443;hp=ca1fb7cc1363b6d63ca247f428d2e03585f49930;hb=fa4a8357806244a39eb6e8dadf028190b03d34fb;hpb=68196bdb8eb0308a8c117d78190c33c60f823287 diff --git a/inc/classes/main/factories/index/class_FileStackIndexFactory.php b/inc/classes/main/factories/index/class_FileStackIndexFactory.php index ca1fb7cc..df10a1c8 100644 --- a/inc/classes/main/factories/index/class_FileStackIndexFactory.php +++ b/inc/classes/main/factories/index/class_FileStackIndexFactory.php @@ -38,9 +38,18 @@ class FileStackIndexFactory extends ObjectFactory { * @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;