Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 8 Jul 2018 05:04:51 +0000 (07:04 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 8 Jul 2018 05:04:51 +0000 (07:04 +0200)
- it is getFileObject() not getPointer()
- also let that method invoke wrapped file pointer instance' same method

Signed-off-by: Roland Häder <roland@mxchange.org>
17 files changed:
framework/loader/class_ClassLoader.php
framework/main/classes/file_directories/class_BaseAbstractFile.php
framework/main/classes/file_directories/class_BaseFileIo.php
framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php
framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php
framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php
framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php
framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php
framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php
framework/main/classes/file_directories/text/input/class_BaseInputTextFile.php
framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php
framework/main/classes/index/file_stack/class_FileStackIndex.php
framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php
framework/main/interfaces/io/class_CloseableFile.php
framework/main/interfaces/io/pointer/class_InputPointer.php
framework/main/interfaces/io/pointer/class_OutputPointer.php
framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php

index 330cdaa0198d9d4683e959b77c133201295a459b..5035d3f83cce41ea94ec6edf90f4a824a67f15e6 100644 (file)
@@ -455,7 +455,7 @@ class ClassLoader {
                        $currentEntry = $iteratorInstance->current();
 
                        // Get filename from iterator which is the class' name (according naming-convention)
-                       $fileName = $currentEntry->getFileName();
+                       $fileName = $currentEntry->getFilename();
 
                        // Current entry must be a file, not smaller than 100 bytes and not on ignore list
                        if ((!$currentEntry->isFile()) || (in_array($fileName, $this->ignoreList)) || ($currentEntry->getSize() < 100)) {
index 92b3f114dce1f1ad9b8cf9552ea5d1eb1ecbb921..29517f425c0b0c942cf38585d882d9b9c4572f14 100644 (file)
@@ -105,10 +105,9 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         * Getter for the file object
         *
         * @return      $fileObject             An instance of a SplFileObject
-        * @throws      UnsupportedOperationException   If this method is called
         */
        public final function getFileObject () {
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+               return $this->getPointerInstance()->getFileObject();
        }
 
        /**
@@ -144,7 +143,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         *
         * @return      mixed   The result of fread()
         * @throws      NullPointerException    If the file pointer instance
-        *                                                                      is not set by setPointer()
+        *                                                                      is not set by setFileObject()
         * @throws      InvalidResourceException        If there is being set
         */
        public function readFromFile () {
@@ -158,7 +157,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         * @param       $dataStream             The data stream we shall write to the file
         * @return      mixed                   Number of writes bytes or false on error
         * @throws      NullPointerException    If the file pointer instance
-        *                                                                      is not set by setPointer()
+        *                                                                      is not set by setFileObject()
         * @throws      InvalidResourceException        If there is being set
         *                                                                                      an invalid file resource
         */
index ce65bd898a9b8f087af82ffdd4ad13f3fa580295..f45b5ea3b9e5243297345dc224776f115cf4b8e0 100644 (file)
@@ -71,7 +71,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         * to empty.
         *
         * @return      void
-        * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
+        * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
         * @throws      LogicException  If there is no object being set
         */
        public function closeFile () {
index 4c033024fac389928d9ee40f961e22d9e21ca572..d7f346a1052a2d274354796e93ecf8b8633e542b 100644 (file)
@@ -161,7 +161,7 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem implements Framework
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: fileInfoInstance[' . gettype($fileInfoInstance) . ']=' . $fileInfoInstance . ',isDot=' . intval($this->getDirectoryIteratorInstance()->isDot()));
 
                        // Is it a dot-directory or excluded?
-                       if (($this->getDirectoryIteratorInstance()->isDot()) || (in_array($fileInfoInstance, $except))) {
+                       if (($this->getDirectoryIteratorInstance()->isDot()) && (!in_array($fileInfoInstance, $except))) {
                                // To next entry
                                $this->getDirectoryIteratorInstance()->next();
 
index fc3ab6db530a6af9e537c1fb605f06116251ef0f..3de4dc7412bc1c4433f5c3615876d39165ce10d7 100644 (file)
@@ -92,7 +92,7 @@ class FrameworkRawFileInputPointer extends BaseFileIo implements InputPointer {
         * Read data a file pointer
         *
         * @return      mixed   The result of fread()
-        * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
+        * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
         * @throws      LogicException  If there is no object being set
         */
        public function readFromFile () {
index 1b3c88eee1a338a85763a67f16b5a8770648f370..00706310c813857b180e6bb686f89ed3198f57db 100644 (file)
@@ -12,6 +12,9 @@ use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 
+// Import SPL stuff
+use \SplFileInfo;
+
 /**
  * A class for reading text files
  *
@@ -54,7 +57,8 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
         * @throws      FileReadProtectedException      If the file cannot be read from
         * @return      void
         */
-       public static final function createFrameworkTextFileInputPointer ($infoInstance) {
+       public static final function createFrameworkTextFileInputPointer (SplFileInfo $infoInstance) {
+               // Check parameter
                if (!FrameworkBootstrap::isReachableFilePath($infoInstance)) {
                        // File cannot be reached
                        throw new FileIoException($infoInstance, self::EXCEPTION_FILE_NOT_REACHABLE);
@@ -68,6 +72,11 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
 
                // Try to open a handler
                $fileObject = $infoInstance->openFile('r');
+
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TEXT-FILE-INPUT: fileObject[]=' . gettype($fileObject));
+
+               // Is it valid?
                if ((is_null($fileObject)) || ($fileObject === false)) {
                        // Something bad happend
                        throw new FileIoException($infoInstance, self::EXCEPTION_FILE_POINTER_INVALID);
@@ -77,7 +86,7 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
                $pointerInstance = new FrameworkTextFileInputPointer();
 
                // Set file pointer and file name
-               $pointerInstance->setPointer($fileObject);
+               $pointerInstance->setFileObject($fileObject);
 
                // Return the instance
                return $pointerInstance;
@@ -108,7 +117,7 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
         *
         * @param       $bytes  Amount of bytes to read or whole line (only text files)
         * @return      $data   Data read from file
-        * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
+        * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
         * @throws      InvalidResourceException        If there is no object being set
         */
        public function read ($bytes = NULL) {
index 971b3acaa468c6ab954ea18e058568f3a2f4b5b3..1217e83a4bcd63be9ad7f935f318ea820d13a32e 100644 (file)
@@ -102,7 +102,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
         *
         * @return      void
         * @throws      NullPointerException    If the file pointer instance
-        *                                                                      is not set by setPointer()
+        *                                                                      is not set by setFileObject()
         * @todo Add more checks
         */
        private function validateFilePointer () {
index 81bd343370059b3113137b50a7e1c59bba184041..7c9b190147226cf15eda691139d8183a50ee7071 100644 (file)
@@ -83,7 +83,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer
         *
         * @param       $dataStream             The data stream we shall write to the file
         * @return      mixed                   Number of writes bytes or false on error
-        * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
+        * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
         * @throws      LogicException  If there is no object being set
         */
        public function writeToFile ($dataStream) {
index d94ec9ce86664f1203313ceee86a45b40ca88199..11dd3735c0fdfa1fe938f6de5dbe08f0669e56b2 100644 (file)
@@ -86,7 +86,7 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer
         *
         * @param       $dataStream             The data stream we shall write to the file
         * @return      mixed                   Number of writes bytes or false on error
-        * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
+        * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
         * @throws      LogicException  If there is no object being set
         */
        public function writeToFile ($dataStream) {
index 1767a55a753c620b47976b431863a763456d8f15..9216f12ad74ecd75171bc9ac29ed1453ae35b1b0 100644 (file)
@@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Filesystem\Text;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\File\BaseTextFile;
 
+// Import SPL stuff
+use \SplFileInfo;
+
 /**
  * A general text input file class
  *
@@ -43,12 +46,12 @@ abstract class BaseInputTextFile extends BaseTextFile {
        /**
         * Initializes this text file for reading
         *
-        * @param       $fileName       File's name
+        * @param       $infoInstance   An instance of a SplFileInfo class
         * @return      void
         */
-       protected function initFile ($fileName) {
+       protected function initFile (SplFileInfo $infoInstance) {
                // Get a file i/o pointer instance
-               $pointerInstance = ObjectFactory::createObjectByConfiguredName('text_file_input_class', array($fileName));
+               $pointerInstance = ObjectFactory::createObjectByConfiguredName('text_file_input_class', array($infoInstance));
 
                // ... and set it here
                $this->setPointerInstance($pointerInstance);
index 3343c6dd6fe11b5551578752e877be333d54b0d9..efd42eb1159e27309049738974cfacf065348b22 100644 (file)
@@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Filesystem\Input\Csv;
 use Org\Mxchange\CoreFramework\Filesystem\Text\BaseInputTextFile;
 use Org\Mxchange\CoreFramework\Stream\Filesystem\CsvInputStreamer;
 
+// Import SPL stuff
+use \SplFileInfo;
+
 /**
  * A CSV file input class for writing CSV files
  *
@@ -42,15 +45,15 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer {
        /**
         * Creates an instance of this File class and prepares it for usage
         *
-        * @param       $fileName               Name of the index file
+        * @param       $infoInstance   An instance of a SplFileInfo class
         * @return      $fileInstance   An instance of this File class
         */
-       public final static function createCsvInputFile ($fileName) {
+       public final static function createCsvInputFile (SplFileInfo $infoInstance) {
                // Get a new instance
                $fileInstance = new CsvInputFile();
 
                // Init this abstract file
-               $fileInstance->initFile($fileName);
+               $fileInstance->initFile($infoInstance);
 
                // Return the prepared instance
                return $fileInstance;
index 7d3306090e8d3d5a7ea9a171633f7a78e11b8806..7deb716af6878cfc4fb6afe32dd52e94ad66e7ec 100644 (file)
@@ -6,7 +6,7 @@ namespace Org\Mxchange\CoreFramework\Index\Stack;
 use Org\Mxchange\CoreFramework\Index\BaseIndex;
 use Org\Mxchange\CoreFramework\Index\Indexable;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Stacker\Filesystem\BaseFileStacker;
+use Org\Mxchange\CoreFramework\Stacker\Filesystem\BaseFileStack;
 use Org\Mxchange\CoreFramework\Stacker\Index\IndexableStack;
 
 // Import SPL stuff
index 9994e38cb3ed071f05f68af972d75c9c3051c73d..d015cf7199f324459d11fa24ae2cb77d21522b2d 100644 (file)
@@ -6,7 +6,7 @@ namespace Org\Mxchange\CoreFramework\Stacker\Filesystem;
 use Org\Mxchange\CoreFramework\Filesystem\Block\CalculatableBlock;
 use Org\Mxchange\CoreFramework\Filesystem\Stack\StackableFile;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Stacker\Filesystem\BaseFileStacker;
+use Org\Mxchange\CoreFramework\Stacker\Filesystem\BaseFileStack;
 
 // Import SPL stuff
 use \SplFileInfo;
index ebfc1c3c9754b02ba00eb2d40be2e9ff428cfa37..1d4d0d9b941a24f9d6720849f08f49951190320f 100644 (file)
@@ -34,7 +34,7 @@ interface CloseableFile extends FrameworkInterface {
         * to empty.
         *
         * @return      void
-        * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
+        * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
         * @throws      InvalidResourceException        If there is being set
         */
        function closeFile ();
index 334ed78cb27d71ccb4a251b4c10f3dce074cd4a7..47a8935023cf7b1adfeeb91451c04ad3c7e18306 100644 (file)
@@ -49,7 +49,7 @@ interface InputPointer extends StreamableInput, FilePointer {
         * @param       $bytes  Amount of bytes to read or whole line (only text files)
         * @return      $data   Data read from file
         * @throws      NullPointerException    If the file pointer instance
-        *                                                                      is not set by setPointer()
+        *                                                                      is not set by setFileObject()
         * @throws      InvalidResourceException        If there is being set
         */
        function read ($bytes = NULL);
index 403e6625b415644450b53778b35a68c69c22c91c..f4a240bb1060ae82112ae4d78e4be8febd2e5212 100644 (file)
@@ -35,7 +35,7 @@ interface OutputPointer extends StreamableOutput, FilePointer {
         * @param       $dataStream             The data stream we shall write to the file
         * @return      mixed                   Number of writes bytes or false on error
         * @throws      NullPointerException    If the file pointer instance
-        *                                                                      is not set by setPointer()
+        *                                                                      is not set by setFileObject()
         * @throws      InvalidResourceException        If there is being set
         *                                                                                      an invalid file resource
         */
index 925bb04e83a948a5ae193681e9631c8320edfd17..7220e3e0165b058127c010162406326981958031 100644 (file)
@@ -69,6 +69,7 @@ class TestsConsoleCommandResolver extends BaseCommandResolver implements Command
 
                // Set namespace for command
                $resolverInstance->setNamespace('Org\Mxchange\CoreFramework\Tests\Command');
+               $resolverInstance->setCommandName($commandName);
 
                // Return the prepared instance
                return $resolverInstance;