From: Roland Häder <roland@mxchange.org>
Date: Wed, 3 Jan 2018 23:38:35 +0000 (+0100)
Subject: Continued:
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bb121094b0c87c1ed028dfb5f86565b782742e6d;p=core.git

Continued:
- even more rewrites towards SplFilInfo

Signed-off-by: Roland Häder <roland@mxchange.org>
---

diff --git a/framework/main/classes/index/class_BaseIndex.php b/framework/main/classes/index/class_BaseIndex.php
index 47a6f715..dbc65fe8 100644
--- a/framework/main/classes/index/class_BaseIndex.php
+++ b/framework/main/classes/index/class_BaseIndex.php
@@ -9,6 +9,9 @@ use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Iterator\Filesystem\SeekableWritableFileIterator;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 
+// Import SPL stuff
+use \SplFileInfo;
+
 /**
  * A general index class
  *
@@ -155,16 +158,13 @@ abstract class BaseIndex extends BaseFrameworkSystem {
 	/**
 	 * Initializes this index
 	 *
-	 * @param	$fileName	File name of this index
+	 * @param	$fileInfoInstance	An instance of a SplFileInfo class
 	 * @return	void
 	 * @todo	Currently the index file is not cached, please implement a memory-handling class and if enough RAM is found, cache the whole index file.
 	 */
-	protected function initIndex ($fileName) {
-		// Append index file extension
-		$fileName .= $this->getConfigInstance()->getConfigEntry('index_extension');
-
+	protected function initIndex (SplFileInfo $fileInfoInstance) {
 		// Get a file i/o pointer instance for index file
-		$fileInstance = ObjectFactory::createObjectByConfiguredName('index_file_class', array($fileName, $this));
+		$fileInstance = ObjectFactory::createObjectByConfiguredName('index_file_class', array($fileInfoInstance, $this));
 
 		// Get iterator instance
 		$iteratorInstance = ObjectFactory::createObjectByConfiguredName('file_iterator_class', array($fileInstance));
diff --git a/framework/main/classes/index/file_stack/class_FileStackIndex.php b/framework/main/classes/index/file_stack/class_FileStackIndex.php
index 72da66dc..7d330609 100644
--- a/framework/main/classes/index/file_stack/class_FileStackIndex.php
+++ b/framework/main/classes/index/file_stack/class_FileStackIndex.php
@@ -9,6 +9,9 @@ use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Stacker\Filesystem\BaseFileStacker;
 use Org\Mxchange\CoreFramework\Stacker\Index\IndexableStack;
 
+// Import SPL stuff
+use \SplFileInfo;
+
 /**
  * A FileStack index class
  *
@@ -45,15 +48,15 @@ class FileStackIndex extends BaseIndex implements IndexableStack, Registerable {
 	/**
 	 * Creates an instance of this Index class and prepares it for usage
 	 *
-	 * @param	$fileName		Name of the file stack to create an index file for
+	 * @param	$fileInfoInstance	An instance of a SplFileInfo class
 	 * @return	$indexInstance	An instance of this Index class
 	 */
-	public final static function createFileStackIndex ($fileName) {
+	public final static function createFileStackIndex (SplFileInfo $fileInfoInstance) {
 		// Get a new instance
 		$indexInstance = new FileStackIndex();
 
 		// Initialize index
-		$indexInstance->initIndex($fileName);
+		$indexInstance->initIndex($fileInfoInstance);
 
 		// Return the prepared instance
 		return $indexInstance;