Add wrappers around XMLReader and SimpleXMLElement to improve error handling

This commit is contained in:
Adrien Loison committed 2015-07-27 00:49:43 -07:00
1 parent be3932af18
commit 1ba10ed2b0
16 files changed
+789 -155

No files matched your search

+3 -3
View File
@@ -40,7 +40,7 @@ class FileSystemHelper
$wasCreationSuccessful = mkdir($folderPath, 0777, true);
if (!$wasCreationSuccessful) {
throw new IOException('Unable to create folder: ' . $folderPath);
throw new IOException("Unable to create folder: $folderPath");
}
return $folderPath;
@@ -64,7 +64,7 @@ class FileSystemHelper
$wasCreationSuccessful = file_put_contents($filePath, $fileContents);
if ($wasCreationSuccessful === false) {
throw new IOException('Unable to create file: ' . $filePath);
throw new IOException("Unable to create file: $filePath");
}
return $filePath;
@@ -126,7 +126,7 @@ class FileSystemHelper
{
$isInBaseFolder = (strpos($operationFolderPath, $this->baseFolderPath) === 0);
if (!$isInBaseFolder) {
throw new IOException('Cannot perform I/O operation outside of the base folder: ' . $this->baseFolderPath);
throw new IOException("Cannot perform I/O operation outside of the base folder: {$this->baseFolderPath}");
}
}
}