]> git.mxchange.org Git - core.git/commitdiff
Updated core:
authorRoland Häder <roland@mxchange.org>
Fri, 22 Feb 2013 07:54:02 +0000 (07:54 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 22 Feb 2013 07:54:02 +0000 (07:54 +0000)
- Make use of new interface IoHandler (as type-hint and class implementation)
- Used optional parameter to give all database "rows" unique name

inc/classes/interfaces/io/file/class_FileOutputStreamer.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/database/databases/class_LocalFileDatabase.php
inc/classes/middleware/io/class_FileIoHandler.php

index 8840e00464568209bd384e5255dd47052c1cc0f6..89fd26ac28ef30633a8ded4c865ac5430cd32fa7 100644 (file)
@@ -26,8 +26,8 @@ interface FileOutputStreamer extends Streamable {
         * Saves streamed (that are mostly serialized objects) data to files or
         * external servers.
         *
         * Saves streamed (that are mostly serialized objects) data to files or
         * external servers.
         *
-        * @param       $fileName       The local file's name including full path
-        * @param       $dataArray      Array containing the compressor's extension and streamed data
+        * @param       $fileName                       The local file's name including full path
+        * @param       $dataArray                      Array containing the compressor's extension and streamed data
         * @return      void
         */
        function saveFile ($fileName, array $dataArray);
         * @return      void
         */
        function saveFile ($fileName, array $dataArray);
index 679e5e4af81ee8c9586a6afcdb22c62702362ebc..6c7eb5d245101cc930a0ca0503fe383a9821eeab 100644 (file)
@@ -783,7 +783,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @param       $fileIoInstance         An instance to the file I/O sub-system
         * @return      void
         */
         * @param       $fileIoInstance         An instance to the file I/O sub-system
         * @return      void
         */
-       public final function setFileIoInstance (FileIoHandler $fileIoInstance) {
+       public final function setFileIoInstance (IoHandler $fileIoInstance) {
                $this->fileIoInstance = $fileIoInstance;
        }
 
                $this->fileIoInstance = $fileIoInstance;
        }
 
index c4c67ee5a565c6b583d8d4e64d73691eb77be963..f49a9f16bdae6bdd546fc538628007097558431c 100644 (file)
@@ -206,7 +206,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: Writing ' . strlen($compressedData) . ' bytes ...');
 
                // Write this data BASE64 encoded to the file
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: Writing ' . strlen($compressedData) . ' bytes ...');
 
                // Write this data BASE64 encoded to the file
-               $this->getFileIoInstance()->saveFile($fqfn, $compressedData);
+               $this->getFileIoInstance()->saveFile($fqfn, $compressedData, $this);
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file completed.');
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file completed.');
index 533dce3e2fb0b7744dd4fa4c6b968c7c0c8656c9..88b0401f7f20647cf507dfd482759db9e1e365ec 100644 (file)
@@ -22,7 +22,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class FileIoHandler extends BaseMiddleware {
+class FileIoHandler extends BaseMiddleware implements IoHandler {
        /**
         * The *real* file input class we shall use for reading data
         */
        /**
         * The *real* file input class we shall use for reading data
         */
@@ -119,19 +119,27 @@ class FileIoHandler extends BaseMiddleware {
        /**
         * Saves a file with data by using the current output stream
         *
        /**
         * Saves a file with data by using the current output stream
         *
-        * @param       $fileName               Name of the file
-        * @param       $dataStream             File data stream
+        * @param       $fileName                       Name of the file
+        * @param       $dataStream                     File data stream
+        * @param       $objectInstance         An instance of a FrameworkInterface class (default: NULL)
         * @return      void
         * @return      void
-        * @see         FileOutputStreamer
         */
         */
-       public function saveFile ($fileName, $dataStream) {
+       public function saveFile ($fileName, $dataStream, FrameworkInterface $objectInstance = NULL) {
                // Get output stream
                $outInstance = $this->getOutputStream();
 
                // Get output stream
                $outInstance = $this->getOutputStream();
 
+               // Default is this array
+               $className = $this->__toString();
+
+               // Is the object instance set?
+               if ($objectInstance instanceof FrameworkInterface) {
+                       // Then use this
+                       $className = $objectInstance->__toString();
+               } // END - if
+
                // Prepare output array
                $dataArray = array(
                // Prepare output array
                $dataArray = array(
-                       // @TODO What is this for?
-                       0 => $this->__toString(),
+                       0 => $className,
                        1 => $dataStream
                );
 
                        1 => $dataStream
                );
 
@@ -141,8 +149,8 @@ class FileIoHandler extends BaseMiddleware {
 
        /** Loads data from a file over the input handler
         *
 
        /** Loads data from a file over the input handler
         *
+        * @param       $fqfn   Given full-qualified file name (FQFN) to load
         * @return      $array  Array with the file contents
         * @return      $array  Array with the file contents
-        * @see         FileInputStreamer
         */
        public function loadFileContents ($fqfn) {
                // Get output stream
         */
        public function loadFileContents ($fqfn) {
                // Get output stream