Signed-off-by: Roland Häder <roland@mxchange.org>
// No filename given
throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (!BaseFrameworkSystem::isReachableFilePath($fileName)) {
// No filename given
throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (!BaseFrameworkSystem::isReachableFilePath($fileName)) {
- // File does not exist!
+ // File cannot be reached
throw new FileIoException($fileName, self::EXCEPTION_FILE_NOT_REACHABLE);
throw new FileIoException($fileName, self::EXCEPTION_FILE_NOT_REACHABLE);
- } elseif (!BaseFrameworkSystem::isReadableFile($fileName)) {
+ } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (!file_exists($fileName))) {
+ throw new FileNotFoundException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
+ } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (file_exists($fileName))) {
+ // File cannot be read from (but exists)
throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
}
throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
}
* @param $template The template we shall load
* @param $extOther An other extension to use
* @return void
* @param $template The template we shall load
* @param $extOther An other extension to use
* @return void
- * @throws FileIoException If the template was not found
+ * @throws FileNotFoundException If the template was not found
*/
protected function loadTemplate ($template, $extOther = '') {
// Get extension for the template if empty
*/
protected function loadTemplate ($template, $extOther = '') {
// Get extension for the template if empty
$this->loadTemplate($template, $ext);
} else {
// Throw it again
$this->loadTemplate($template, $ext);
} else {
// Throw it again
- throw new FileIoException($fqfn, self::EXCEPTION_FILE_NOT_FOUND);
+ throw new FileNotFoundException($fqfn, self::EXCEPTION_FILE_NOT_FOUND);