// Import framework stuff
use CoreFramework\Filesystem\FrameworkDirectory;
+use CoreFramework\Generic\NullPointerException;
use CoreFramework\Object\BaseFrameworkSystem;
// Import SPL stuff
* 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