Don't "abuse" setters for actually "unsetting" (closing) instances. Better use
[core.git] / inc / classes / main / file_directories / directory / class_FrameworkDirectoryPointer.php
index 3d824272257fff01c74fd27e0cbc98a01f39d48c..42380fd142469c9834e39a3abf9878f167383e90 100644 (file)
@@ -196,18 +196,18 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem implements Framework
         */
        public function closeDirectory () {
                // Close the directory by unsetting it
-               $this->setDirectoryIteratorInstance(NULL);
+               $this->unsetDirectoryIteratorInstance();
                $this->setPathName('');
        }
 
        /**
         * Setter for the directory pointer
         *
-        * @param       $iteratorInstance       An instanceof a DirectoryIterator class or NULL to unset ("close") it.
+        * @param       $iteratorInstance       An instanceof a DirectoryIterator class
         * @return      void
         */
-       protected final function setDirectoryIteratorInstance (DirectoryIterator $iteratorInstance = NULL) {
-               // Set instance (or NULL)
+       protected final function setDirectoryIteratorInstance (DirectoryIterator $iteratorInstance) {
+               // Set instance
                $this->iteratorInstance = $iteratorInstance;
        }
 
@@ -220,6 +220,19 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem implements Framework
                return $this->iteratorInstance;
        }
 
+       /**
+        * Remove directory iterator instance (effectively closing it) by setting
+        * it to NULL. This will trigger a call on the destructor which will then
+        * "close" the iterator.
+        *
+        * @param       $iteratorInstance       An instanceof a DirectoryIterator class
+        * @return      void
+        */
+       protected final function unsetDirectoryIteratorInstance (e) {
+               // "Unset" the instance
+               $this->iteratorInstance = NULL;
+       }
+
        /**
         * Setter for path name
         *