Rewrites:
[core.git] / framework / main / classes / file_directories / directory / class_FrameworkDirectoryPointer.php
index 64688af7ab1d674bff4d0da15e7a32a94dcf7ea3..5dfb15cb9ae6224fb34a0ccfe1484db81834dbc8 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Filesytem\Pointer;
 
 // Import framework stuff
 use CoreFramework\Filesystem\FrameworkDirectory;
+use CoreFramework\Generic\NullPointerException;
 use CoreFramework\Object\BaseFrameworkSystem;
 
 // Import SPL stuff
@@ -69,44 +70,26 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem implements Framework
         * be verified here.
         *
         * @param       $pathName               The path name we shall pass to opendir()
-        * @param       $inConstructor  If we are in de/con-structor or from somewhere else
         * @return      $pointerInstance        A prepared instance of FrameworkDirectoryPointer
-        * @throws      PathIsEmptyException    If the provided path name is empty
+        * @throws      NullPointerException    If the provided path name is null
         * @throws      InvalidPathStringException      If the provided path name is not a string
         * @throws      PathIsNoDirectoryException      If the provided path name is not valid
         * @throws      PathReadProtectedException      If the provided path name is read-protected
-        * @todo        Get rid of inConstructor, could be old-lost code.
         */
-       public static final function createFrameworkDirectoryPointer ($pathName, $inConstructor = false) {
+       public static final function createFrameworkDirectoryPointer ($pathName) {
                // Some pre-sanity checks...
                if (is_null($pathName)) {
                        // No pathname given
-                       if ($inConstructor) {
-                               return NULL;
-                       } else {
-                               throw new PathIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-                       }
+                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
                } elseif (!is_string($pathName)) {
                        // Is not a string
-                       if ($inConstructor) {
-                               return NULL;
-                       } else {
-                               throw new InvalidPathStringException(NULL, self::EXCEPTION_INVALID_STRING);
-                       }
+                       throw new InvalidPathStringException(NULL, self::EXCEPTION_INVALID_STRING);
                } elseif (!is_dir($pathName)) {
                        // Not a directory
-                       if ($inConstructor) {
-                               return NULL;
-                       } else {
-                               throw new PathIsNoDirectoryException($pathName, self::EXCEPTION_INVALID_PATH_NAME);
-                       }
+                       throw new PathIsNoDirectoryException($pathName, self::EXCEPTION_INVALID_PATH_NAME);
                } elseif (!is_readable($pathName)) {
                        // Not readable
-                       if ($inConstructor) {
-                               return NULL;
-                       } else {
-                               throw new PathReadProtectedException($pathName, self::EXCEPTION_READ_PROTECED_PATH);
-                       }
+                       throw new PathReadProtectedException($pathName, self::EXCEPTION_READ_PROTECED_PATH);
                }
 
                // Create new instance