more 'final' statements added
[mailer.git] / inc / classes / main / database / classes / class_LocalFileDatabase.php
index 5a83742767a118b41b886e3555fc660925a6c4da..ea4a8e19e49db057d7385fb2c677fe0092aa7391 100644 (file)
@@ -4,8 +4,24 @@
  *
  * This class serializes objects and saves them to local files.
  *
- * @author     Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @version    0.1
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.3.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.mxchange.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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 LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface {
        /**
@@ -18,11 +34,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         */
        private $fileExtension = "serialized";
 
-       /**
-        * The IO handler for file handling which should be FileIOHandler.
-        */
-       private $ioInstance = null;
-
        /**
         * The last read file's name
         */
@@ -95,7 +106,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
 
                // Set save path and IO instance
                $dbInstance->setSavePath($savePath);
-               $dbInstance->setIOInstance($ioInstance);
+               $dbInstance->setFileIOInstance($ioInstance);
 
                // Return database instance
                return $dbInstance;
@@ -130,15 +141,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                return $this->savePath;
        }
 
-       /**
-        * Getter for file extension
-        *
-        * @return      $fileExtension          The file extension for all file names
-        */
-       public final function getFileExtension () {
-               return $this->fileExtension;
-       }
-
        /**
         * Saves a given object to the local file system by serializing and
         * transparently compressing it
@@ -185,7 +187,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
 
                // Save the file to disc we don't care here if the path is there,
                // this must be done in later methods.
-               $this->getIOInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized));
+               $this->getFileIOInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized));
        }
 
        /**
@@ -285,7 +287,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        $this->setLastFile($fqfn);
 
                        // Get instance for file handler
-                       $inputHandler = $this->getIOInstance();
+                       $inputHandler = $this->getFileIOInstance();
 
                        // Try to read from it. This makes it sure that the file is
                        // readable and a valid database file
@@ -308,34 +310,13 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                return $isUsed;
        }
 
-       /**
-        * Getter for the file IO instance
-        *
-        * @return      $ioInstance     An instance for IO operations
-        * @see         FileIOHandler   The concrete handler for IO operations
-        */
-       public final function getIOInstance () {
-               return $this->ioInstance;
-       }
-
-       /**
-        * Setter for the file IO instance
-        *
-        * @param               $ioInstance     An instance for IO operations (should be
-        *                                              FileIOHandler)
-        * @return      void
-        */
-       public final function setIOInstance (FileIOHandler $ioInstance) {
-               $this->ioInstance = $ioInstance;
-       }
-
        /**
         * Setter for the last read file
         *
         * @param               $fqfn   The FQFN of the last read file
         * @return      void
         */
-       private function setLastFile ($fqfn) {
+       private final function setLastFile ($fqfn) {
                // Cast string
                $fqfn = (string) $fqfn;
                $this->lastFile = $fqfn;
@@ -356,7 +337,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         * @param               $contents               An array with header and data elements
         * @return      void
         */
-       private function setLastFileContents ($contents) {
+       private final function setLastFileContents ($contents) {
                // Cast array
                $contents = (array) $contents;
                $this->lastContents = $contents;
@@ -379,7 +360,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         *                                              serialized data
         * @throws      MismatchingCompressorsException If the compressor from
         *                                                                              the loaded file
-        *                                                                              mismatches with the 
+        *                                                                              mismatches with the
         *                                                                              current used one.
         * @throws      NullPointerException                    If the restored object
         *                                                                              is null
@@ -388,9 +369,9 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         * @throws      MissingMethodException                  If the required method
         *                                                                              toString() is missing
         */
-       public function getObjectFromCachedData ($uniqueID) {
+       public final function getObjectFromCachedData ($uniqueID) {
                // Get instance for file handler
-               $inputHandler = $this->getIOInstance();
+               $inputHandler = $this->getFileIOInstance();
 
                // Get last file's name and contents
                $fqfn = $this->repairFQFN($this->getLastFile(), $uniqueID);