if ((is_null($fileName)) || (empty($fileName))) {
// No filename given
throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif ((file_exists($fileName)) && (!is_readable($fileName))) {
+ } elseif (!BaseFrameworkSystem::isReachableFilePath($fileName)) {
+ // File exists but cannot be read
+ throw new FileIoException($fileName, self::EXCEPTION_FILE_NOT_REACHABLE);
+ } elseif (!BaseFrameworkSystem::isReadableFile($fileName)) {
// File exists but cannot be read
throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
- } elseif ((file_exists($fileName)) && (!is_writable($fileName))) {
+ } elseif (!is_writable($fileName)) {
// File exists but cannot be written
- throw new FileWriteProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
+ throw new FileWriteProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_WRITTEN);
}
// Try to open a handler